//---------------------- // // Generated using the NSwag toolchain v14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0)) (http://NSwag.org) // //---------------------- /* tslint:disable */ /* eslint-disable */ // ReSharper disable InconsistentNaming import { TribufuApiBase } from "./api.base"; export class TribufuApiGenerated extends TribufuApiBase { private http: { fetch(url: RequestInfo, init?: RequestInit): Promise }; private baseUrl: string; protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined; constructor(baseUrl?: string, http?: { fetch(url: RequestInfo, init?: RequestInit): Promise }) { super(); this.http = http ? http : window as any; this.baseUrl = baseUrl ?? ""; } /** * @return OK */ authGetUserInfo(): Promise { let url_ = this.baseUrl + "/v1/me"; url_ = url_.replace(/[?&]$/, ""); let options_: RequestInit = { method: "GET", headers: { "Accept": "text/plain" } }; return this.transformOptions(options_).then(transformedOptions_ => { return this.http.fetch(url_, transformedOptions_); }).then((_response: Response) => { return this.processAuthGetUserInfo(_response); }); } protected processAuthGetUserInfo(response: Response): Promise { const status = response.status; let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); }; if (status === 200) { return response.text().then((_responseText) => { let result200: any = null; result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as UserInfo; return result200; }); } else if (status !== 200 && status !== 204) { return response.text().then((_responseText) => { return throwException("An unexpected server error occurred.", status, _responseText, _headers); }); } return Promise.resolve(null as any); } /** * @param body (optional) * @return OK */ authLogin(body: LoginRequest | undefined): Promise { let url_ = this.baseUrl + "/v1/login"; url_ = url_.replace(/[?&]$/, ""); const content_ = JSON.stringify(body); let options_: RequestInit = { body: content_, method: "POST", headers: { "Content-Type": "application/json-patch+json", "Accept": "text/plain" } }; return this.transformOptions(options_).then(transformedOptions_ => { return this.http.fetch(url_, transformedOptions_); }).then((_response: Response) => { return this.processAuthLogin(_response); }); } protected processAuthLogin(response: Response): Promise { const status = response.status; let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); }; if (status === 200) { return response.text().then((_responseText) => { let result200: any = null; result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as LoginResponse; return result200; }); } else if (status !== 200 && status !== 204) { return response.text().then((_responseText) => { return throwException("An unexpected server error occurred.", status, _responseText, _headers); }); } return Promise.resolve(null as any); } /** * @param body (optional) * @return OK */ authRegister(body: RegisterRequest | undefined): Promise { let url_ = this.baseUrl + "/v1/register"; url_ = url_.replace(/[?&]$/, ""); const content_ = JSON.stringify(body); let options_: RequestInit = { body: content_, method: "POST", headers: { "Content-Type": "application/json-patch+json", "Accept": "text/plain" } }; return this.transformOptions(options_).then(transformedOptions_ => { return this.http.fetch(url_, transformedOptions_); }).then((_response: Response) => { return this.processAuthRegister(_response); }); } protected processAuthRegister(response: Response): Promise { const status = response.status; let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); }; if (status === 200) { return response.text().then((_responseText) => { let result200: any = null; result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as LoginResponse; return result200; }); } else if (status !== 200 && status !== 204) { return response.text().then((_responseText) => { return throwException("An unexpected server error occurred.", status, _responseText, _headers); }); } return Promise.resolve(null as any); } /** * @param body (optional) * @return OK */ authRefresh(body: RefreshRequest | undefined): Promise { let url_ = this.baseUrl + "/v1/refresh"; url_ = url_.replace(/[?&]$/, ""); const content_ = JSON.stringify(body); let options_: RequestInit = { body: content_, method: "POST", headers: { "Content-Type": "application/json-patch+json", "Accept": "text/plain" } }; return this.transformOptions(options_).then(transformedOptions_ => { return this.http.fetch(url_, transformedOptions_); }).then((_response: Response) => { return this.processAuthRefresh(_response); }); } protected processAuthRefresh(response: Response): Promise { const status = response.status; let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); }; if (status === 200) { return response.text().then((_responseText) => { let result200: any = null; result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as LoginResponse; return result200; }); } else if (status !== 200 && status !== 204) { return response.text().then((_responseText) => { return throwException("An unexpected server error occurred.", status, _responseText, _headers); }); } return Promise.resolve(null as any); } /** * @return OK */ authLogout(): Promise { let url_ = this.baseUrl + "/v1/logout"; url_ = url_.replace(/[?&]$/, ""); let options_: RequestInit = { method: "POST", headers: { } }; return this.transformOptions(options_).then(transformedOptions_ => { return this.http.fetch(url_, transformedOptions_); }).then((_response: Response) => { return this.processAuthLogout(_response); }); } protected processAuthLogout(response: Response): Promise { const status = response.status; let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); }; if (status === 200) { return response.text().then((_responseText) => { return; }); } else if (status !== 200 && status !== 204) { return response.text().then((_responseText) => { return throwException("An unexpected server error occurred.", status, _responseText, _headers); }); } return Promise.resolve(null as any); } /** * @param page (optional) * @return OK */ clustersGetPage(page: number | undefined): Promise { let url_ = this.baseUrl + "/v1/clusters?"; if (page === null) throw new Error("The parameter 'page' cannot be null."); else if (page !== undefined) url_ += "page=" + encodeURIComponent("" + page) + "&"; url_ = url_.replace(/[?&]$/, ""); let options_: RequestInit = { method: "GET", headers: { "Accept": "text/plain" } }; return this.transformOptions(options_).then(transformedOptions_ => { return this.http.fetch(url_, transformedOptions_); }).then((_response: Response) => { return this.processClustersGetPage(_response); }); } protected processClustersGetPage(response: Response): Promise { const status = response.status; let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); }; if (status === 200) { return response.text().then((_responseText) => { let result200: any = null; result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as GameServerCluster[]; return result200; }); } else if (status !== 200 && status !== 204) { return response.text().then((_responseText) => { return throwException("An unexpected server error occurred.", status, _responseText, _headers); }); } return Promise.resolve(null as any); } /** * @return OK */ clustersGetById(id: string): Promise { let url_ = this.baseUrl + "/v1/clusters/{id}"; if (id === undefined || id === null) throw new Error("The parameter 'id' must be defined."); url_ = url_.replace("{id}", encodeURIComponent("" + id)); url_ = url_.replace(/[?&]$/, ""); let options_: RequestInit = { method: "GET", headers: { "Accept": "text/plain" } }; return this.transformOptions(options_).then(transformedOptions_ => { return this.http.fetch(url_, transformedOptions_); }).then((_response: Response) => { return this.processClustersGetById(_response); }); } protected processClustersGetById(response: Response): Promise { const status = response.status; let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); }; if (status === 200) { return response.text().then((_responseText) => { let result200: any = null; result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as GameServerCluster; return result200; }); } else if (status !== 200 && status !== 204) { return response.text().then((_responseText) => { return throwException("An unexpected server error occurred.", status, _responseText, _headers); }); } return Promise.resolve(null as any); } /** * @param page (optional) * @return OK */ filesGetPage(page: number | undefined): Promise { let url_ = this.baseUrl + "/v1/files?"; if (page === null) throw new Error("The parameter 'page' cannot be null."); else if (page !== undefined) url_ += "page=" + encodeURIComponent("" + page) + "&"; url_ = url_.replace(/[?&]$/, ""); let options_: RequestInit = { method: "GET", headers: { "Accept": "text/plain" } }; return this.transformOptions(options_).then(transformedOptions_ => { return this.http.fetch(url_, transformedOptions_); }).then((_response: Response) => { return this.processFilesGetPage(_response); }); } protected processFilesGetPage(response: Response): Promise { const status = response.status; let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); }; if (status === 200) { return response.text().then((_responseText) => { let result200: any = null; result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as File[]; return result200; }); } else if (status !== 200 && status !== 204) { return response.text().then((_responseText) => { return throwException("An unexpected server error occurred.", status, _responseText, _headers); }); } return Promise.resolve(null as any); } /** * @return OK */ filesGetById(id: string): Promise { let url_ = this.baseUrl + "/v1/files/{id}"; if (id === undefined || id === null) throw new Error("The parameter 'id' must be defined."); url_ = url_.replace("{id}", encodeURIComponent("" + id)); url_ = url_.replace(/[?&]$/, ""); let options_: RequestInit = { method: "GET", headers: { "Accept": "text/plain" } }; return this.transformOptions(options_).then(transformedOptions_ => { return this.http.fetch(url_, transformedOptions_); }).then((_response: Response) => { return this.processFilesGetById(_response); }); } protected processFilesGetById(response: Response): Promise { const status = response.status; let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); }; if (status === 200) { return response.text().then((_responseText) => { let result200: any = null; result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as File; return result200; }); } else if (status !== 200 && status !== 204) { return response.text().then((_responseText) => { return throwException("An unexpected server error occurred.", status, _responseText, _headers); }); } return Promise.resolve(null as any); } /** * @return OK */ gamesGetAll(): Promise { let url_ = this.baseUrl + "/v1/games"; url_ = url_.replace(/[?&]$/, ""); let options_: RequestInit = { method: "GET", headers: { "Accept": "text/plain" } }; return this.transformOptions(options_).then(transformedOptions_ => { return this.http.fetch(url_, transformedOptions_); }).then((_response: Response) => { return this.processGamesGetAll(_response); }); } protected processGamesGetAll(response: Response): Promise { const status = response.status; let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); }; if (status === 200) { return response.text().then((_responseText) => { let result200: any = null; result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as Game[]; return result200; }); } else if (status !== 200 && status !== 204) { return response.text().then((_responseText) => { return throwException("An unexpected server error occurred.", status, _responseText, _headers); }); } return Promise.resolve(null as any); } /** * @return OK */ gamesGetById(id: string): Promise { let url_ = this.baseUrl + "/v1/games/{id}"; if (id === undefined || id === null) throw new Error("The parameter 'id' must be defined."); url_ = url_.replace("{id}", encodeURIComponent("" + id)); url_ = url_.replace(/[?&]$/, ""); let options_: RequestInit = { method: "GET", headers: { "Accept": "text/plain" } }; return this.transformOptions(options_).then(transformedOptions_ => { return this.http.fetch(url_, transformedOptions_); }).then((_response: Response) => { return this.processGamesGetById(_response); }); } protected processGamesGetById(response: Response): Promise { const status = response.status; let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); }; if (status === 200) { return response.text().then((_responseText) => { let result200: any = null; result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as Game; return result200; }); } else if (status !== 200 && status !== 204) { return response.text().then((_responseText) => { return throwException("An unexpected server error occurred.", status, _responseText, _headers); }); } return Promise.resolve(null as any); } /** * @param page (optional) * @return OK */ gamesGetServers(id: string, page: number | undefined): Promise { let url_ = this.baseUrl + "/v1/games/{id}/servers?"; if (id === undefined || id === null) throw new Error("The parameter 'id' must be defined."); url_ = url_.replace("{id}", encodeURIComponent("" + id)); if (page === null) throw new Error("The parameter 'page' cannot be null."); else if (page !== undefined) url_ += "page=" + encodeURIComponent("" + page) + "&"; url_ = url_.replace(/[?&]$/, ""); let options_: RequestInit = { method: "GET", headers: { "Accept": "text/plain" } }; return this.transformOptions(options_).then(transformedOptions_ => { return this.http.fetch(url_, transformedOptions_); }).then((_response: Response) => { return this.processGamesGetServers(_response); }); } protected processGamesGetServers(response: Response): Promise { const status = response.status; let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); }; if (status === 200) { return response.text().then((_responseText) => { let result200: any = null; result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as GameServer[]; return result200; }); } else if (status !== 200 && status !== 204) { return response.text().then((_responseText) => { return throwException("An unexpected server error occurred.", status, _responseText, _headers); }); } return Promise.resolve(null as any); } /** * @param page (optional) * @return OK */ gamesGetClusters(id: string, page: number | undefined): Promise { let url_ = this.baseUrl + "/v1/games/{id}/clusters?"; if (id === undefined || id === null) throw new Error("The parameter 'id' must be defined."); url_ = url_.replace("{id}", encodeURIComponent("" + id)); if (page === null) throw new Error("The parameter 'page' cannot be null."); else if (page !== undefined) url_ += "page=" + encodeURIComponent("" + page) + "&"; url_ = url_.replace(/[?&]$/, ""); let options_: RequestInit = { method: "GET", headers: { "Accept": "text/plain" } }; return this.transformOptions(options_).then(transformedOptions_ => { return this.http.fetch(url_, transformedOptions_); }).then((_response: Response) => { return this.processGamesGetClusters(_response); }); } protected processGamesGetClusters(response: Response): Promise { const status = response.status; let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); }; if (status === 200) { return response.text().then((_responseText) => { let result200: any = null; result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as GameServerCluster[]; return result200; }); } else if (status !== 200 && status !== 204) { return response.text().then((_responseText) => { return throwException("An unexpected server error occurred.", status, _responseText, _headers); }); } return Promise.resolve(null as any); } /** * @param uuid (optional) * @param tag (optional) * @param name (optional) * @param email (optional) * @param page (optional) * @param limit (optional) * @return OK */ groupsGetPage(uuid: string | undefined, tag: string | undefined, name: string | undefined, email: string | undefined, page: number | undefined, limit: number | undefined): Promise { let url_ = this.baseUrl + "/v1/groups?"; if (uuid === null) throw new Error("The parameter 'uuid' cannot be null."); else if (uuid !== undefined) url_ += "uuid=" + encodeURIComponent("" + uuid) + "&"; if (tag === null) throw new Error("The parameter 'tag' cannot be null."); else if (tag !== undefined) url_ += "tag=" + encodeURIComponent("" + tag) + "&"; if (name === null) throw new Error("The parameter 'name' cannot be null."); else if (name !== undefined) url_ += "name=" + encodeURIComponent("" + name) + "&"; if (email === null) throw new Error("The parameter 'email' cannot be null."); else if (email !== undefined) url_ += "email=" + encodeURIComponent("" + email) + "&"; if (page === null) throw new Error("The parameter 'page' cannot be null."); else if (page !== undefined) url_ += "page=" + encodeURIComponent("" + page) + "&"; if (limit === null) throw new Error("The parameter 'limit' cannot be null."); else if (limit !== undefined) url_ += "limit=" + encodeURIComponent("" + limit) + "&"; url_ = url_.replace(/[?&]$/, ""); let options_: RequestInit = { method: "GET", headers: { "Accept": "text/plain" } }; return this.transformOptions(options_).then(transformedOptions_ => { return this.http.fetch(url_, transformedOptions_); }).then((_response: Response) => { return this.processGroupsGetPage(_response); }); } protected processGroupsGetPage(response: Response): Promise { const status = response.status; let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); }; if (status === 200) { return response.text().then((_responseText) => { let result200: any = null; result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as Group[]; return result200; }); } else if (status !== 200 && status !== 204) { return response.text().then((_responseText) => { return throwException("An unexpected server error occurred.", status, _responseText, _headers); }); } return Promise.resolve(null as any); } /** * @return OK */ groupsGetById(id: string): Promise { let url_ = this.baseUrl + "/v1/groups/{id}"; if (id === undefined || id === null) throw new Error("The parameter 'id' must be defined."); url_ = url_.replace("{id}", encodeURIComponent("" + id)); url_ = url_.replace(/[?&]$/, ""); let options_: RequestInit = { method: "GET", headers: { "Accept": "text/plain" } }; return this.transformOptions(options_).then(transformedOptions_ => { return this.http.fetch(url_, transformedOptions_); }).then((_response: Response) => { return this.processGroupsGetById(_response); }); } protected processGroupsGetById(response: Response): Promise { const status = response.status; let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); }; if (status === 200) { return response.text().then((_responseText) => { let result200: any = null; result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as Group; return result200; }); } else if (status !== 200 && status !== 204) { return response.text().then((_responseText) => { return throwException("An unexpected server error occurred.", status, _responseText, _headers); }); } return Promise.resolve(null as any); } /** * @return OK */ groupsGetMembers(id: string): Promise { let url_ = this.baseUrl + "/v1/groups/{id}/members"; if (id === undefined || id === null) throw new Error("The parameter 'id' must be defined."); url_ = url_.replace("{id}", encodeURIComponent("" + id)); url_ = url_.replace(/[?&]$/, ""); let options_: RequestInit = { method: "GET", headers: { "Accept": "text/plain" } }; return this.transformOptions(options_).then(transformedOptions_ => { return this.http.fetch(url_, transformedOptions_); }).then((_response: Response) => { return this.processGroupsGetMembers(_response); }); } protected processGroupsGetMembers(response: Response): Promise { const status = response.status; let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); }; if (status === 200) { return response.text().then((_responseText) => { let result200: any = null; result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as GroupMember[]; return result200; }); } else if (status !== 200 && status !== 204) { return response.text().then((_responseText) => { return throwException("An unexpected server error occurred.", status, _responseText, _headers); }); } return Promise.resolve(null as any); } /** * @return OK */ groupsGetGames(id: string): Promise { let url_ = this.baseUrl + "/v1/groups/{id}/games"; if (id === undefined || id === null) throw new Error("The parameter 'id' must be defined."); url_ = url_.replace("{id}", encodeURIComponent("" + id)); url_ = url_.replace(/[?&]$/, ""); let options_: RequestInit = { method: "GET", headers: { "Accept": "text/plain" } }; return this.transformOptions(options_).then(transformedOptions_ => { return this.http.fetch(url_, transformedOptions_); }).then((_response: Response) => { return this.processGroupsGetGames(_response); }); } protected processGroupsGetGames(response: Response): Promise { const status = response.status; let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); }; if (status === 200) { return response.text().then((_responseText) => { let result200: any = null; result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as GroupGame[]; return result200; }); } else if (status !== 200 && status !== 204) { return response.text().then((_responseText) => { return throwException("An unexpected server error occurred.", status, _responseText, _headers); }); } return Promise.resolve(null as any); } /** * @param order (optional) * @return OK */ leaderboardGetTop20(order: LeaderboardOrder | undefined): Promise { let url_ = this.baseUrl + "/v1/leaderboard?"; if (order === null) throw new Error("The parameter 'order' cannot be null."); else if (order !== undefined) url_ += "Order=" + encodeURIComponent("" + order) + "&"; url_ = url_.replace(/[?&]$/, ""); let options_: RequestInit = { method: "GET", headers: { "Accept": "text/plain" } }; return this.transformOptions(options_).then(transformedOptions_ => { return this.http.fetch(url_, transformedOptions_); }).then((_response: Response) => { return this.processLeaderboardGetTop20(_response); }); } protected processLeaderboardGetTop20(response: Response): Promise { const status = response.status; let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); }; if (status === 200) { return response.text().then((_responseText) => { let result200: any = null; result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as LeaderboardItem[]; return result200; }); } else if (status !== 200 && status !== 204) { return response.text().then((_responseText) => { return throwException("An unexpected server error occurred.", status, _responseText, _headers); }); } return Promise.resolve(null as any); } /** * @param body (optional) * @return OK */ searchSearch(body: SearchRequest | undefined): Promise { let url_ = this.baseUrl + "/v1/search"; url_ = url_.replace(/[?&]$/, ""); const content_ = JSON.stringify(body); let options_: RequestInit = { body: content_, method: "POST", headers: { "Content-Type": "application/json-patch+json", "Accept": "text/plain" } }; return this.transformOptions(options_).then(transformedOptions_ => { return this.http.fetch(url_, transformedOptions_); }).then((_response: Response) => { return this.processSearchSearch(_response); }); } protected processSearchSearch(response: Response): Promise { const status = response.status; let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); }; if (status === 200) { return response.text().then((_responseText) => { let result200: any = null; result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as any[]; return result200; }); } else if (status !== 200 && status !== 204) { return response.text().then((_responseText) => { return throwException("An unexpected server error occurred.", status, _responseText, _headers); }); } return Promise.resolve(null as any); } /** * @param address (optional) * @param query_port (optional) * @param country (optional) * @param page (optional) * @param limit (optional) * @return OK */ serversGetPage(address: string | undefined, query_port: number | undefined, country: string | undefined, page: number | undefined, limit: number | undefined): Promise { let url_ = this.baseUrl + "/v1/servers?"; if (address === null) throw new Error("The parameter 'address' cannot be null."); else if (address !== undefined) url_ += "address=" + encodeURIComponent("" + address) + "&"; if (query_port === null) throw new Error("The parameter 'query_port' cannot be null."); else if (query_port !== undefined) url_ += "query_port=" + encodeURIComponent("" + query_port) + "&"; if (country === null) throw new Error("The parameter 'country' cannot be null."); else if (country !== undefined) url_ += "country=" + encodeURIComponent("" + country) + "&"; if (page === null) throw new Error("The parameter 'page' cannot be null."); else if (page !== undefined) url_ += "page=" + encodeURIComponent("" + page) + "&"; if (limit === null) throw new Error("The parameter 'limit' cannot be null."); else if (limit !== undefined) url_ += "limit=" + encodeURIComponent("" + limit) + "&"; url_ = url_.replace(/[?&]$/, ""); let options_: RequestInit = { method: "GET", headers: { "Accept": "text/plain" } }; return this.transformOptions(options_).then(transformedOptions_ => { return this.http.fetch(url_, transformedOptions_); }).then((_response: Response) => { return this.processServersGetPage(_response); }); } protected processServersGetPage(response: Response): Promise { const status = response.status; let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); }; if (status === 200) { return response.text().then((_responseText) => { let result200: any = null; result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as GameServer[]; return result200; }); } else if (status !== 200 && status !== 204) { return response.text().then((_responseText) => { return throwException("An unexpected server error occurred.", status, _responseText, _headers); }); } return Promise.resolve(null as any); } /** * @return OK */ serversGetById(id: string): Promise { let url_ = this.baseUrl + "/v1/servers/{id}"; if (id === undefined || id === null) throw new Error("The parameter 'id' must be defined."); url_ = url_.replace("{id}", encodeURIComponent("" + id)); url_ = url_.replace(/[?&]$/, ""); let options_: RequestInit = { method: "GET", headers: { "Accept": "text/plain" } }; return this.transformOptions(options_).then(transformedOptions_ => { return this.http.fetch(url_, transformedOptions_); }).then((_response: Response) => { return this.processServersGetById(_response); }); } protected processServersGetById(response: Response): Promise { const status = response.status; let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); }; if (status === 200) { return response.text().then((_responseText) => { let result200: any = null; result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as GameServer; return result200; }); } else if (status !== 200 && status !== 204) { return response.text().then((_responseText) => { return throwException("An unexpected server error occurred.", status, _responseText, _headers); }); } return Promise.resolve(null as any); } /** * @return OK */ serversGetMetrics(): Promise { let url_ = this.baseUrl + "/v1/servers/metrics"; url_ = url_.replace(/[?&]$/, ""); let options_: RequestInit = { method: "GET", headers: { "Accept": "text/plain" } }; return this.transformOptions(options_).then(transformedOptions_ => { return this.http.fetch(url_, transformedOptions_); }).then((_response: Response) => { return this.processServersGetMetrics(_response); }); } protected processServersGetMetrics(response: Response): Promise { const status = response.status; let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); }; if (status === 200) { return response.text().then((_responseText) => { let result200: any = null; result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as ServerMetrics; return result200; }); } else if (status !== 200 && status !== 204) { return response.text().then((_responseText) => { return throwException("An unexpected server error occurred.", status, _responseText, _headers); }); } return Promise.resolve(null as any); } /** * @return OK */ serversGetCountries(): Promise<{ [key: string]: number; }> { let url_ = this.baseUrl + "/v1/servers/countries"; url_ = url_.replace(/[?&]$/, ""); let options_: RequestInit = { method: "GET", headers: { "Accept": "text/plain" } }; return this.transformOptions(options_).then(transformedOptions_ => { return this.http.fetch(url_, transformedOptions_); }).then((_response: Response) => { return this.processServersGetCountries(_response); }); } protected processServersGetCountries(response: Response): Promise<{ [key: string]: number; }> { const status = response.status; let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); }; if (status === 200) { return response.text().then((_responseText) => { let result200: any = null; result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as { [key: string]: number; }; return result200; }); } else if (status !== 200 && status !== 204) { return response.text().then((_responseText) => { return throwException("An unexpected server error occurred.", status, _responseText, _headers); }); } return Promise.resolve<{ [key: string]: number; }>(null as any); } /** * @param page (optional) * @return OK */ subscriptionsGetPage(page: number | undefined): Promise { let url_ = this.baseUrl + "/v1/subscriptions?"; if (page === null) throw new Error("The parameter 'page' cannot be null."); else if (page !== undefined) url_ += "page=" + encodeURIComponent("" + page) + "&"; url_ = url_.replace(/[?&]$/, ""); let options_: RequestInit = { method: "GET", headers: { "Accept": "text/plain" } }; return this.transformOptions(options_).then(transformedOptions_ => { return this.http.fetch(url_, transformedOptions_); }).then((_response: Response) => { return this.processSubscriptionsGetPage(_response); }); } protected processSubscriptionsGetPage(response: Response): Promise { const status = response.status; let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); }; if (status === 200) { return response.text().then((_responseText) => { let result200: any = null; result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as Subscription[]; return result200; }); } else if (status !== 200 && status !== 204) { return response.text().then((_responseText) => { return throwException("An unexpected server error occurred.", status, _responseText, _headers); }); } return Promise.resolve(null as any); } /** * @return OK */ subscriptionsGetById(id: string): Promise { let url_ = this.baseUrl + "/v1/subscriptions/{id}"; if (id === undefined || id === null) throw new Error("The parameter 'id' must be defined."); url_ = url_.replace("{id}", encodeURIComponent("" + id)); url_ = url_.replace(/[?&]$/, ""); let options_: RequestInit = { method: "GET", headers: { "Accept": "text/plain" } }; return this.transformOptions(options_).then(transformedOptions_ => { return this.http.fetch(url_, transformedOptions_); }).then((_response: Response) => { return this.processSubscriptionsGetById(_response); }); } protected processSubscriptionsGetById(response: Response): Promise { const status = response.status; let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); }; if (status === 200) { return response.text().then((_responseText) => { let result200: any = null; result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as Subscription; return result200; }); } else if (status !== 200 && status !== 204) { return response.text().then((_responseText) => { return throwException("An unexpected server error occurred.", status, _responseText, _headers); }); } return Promise.resolve(null as any); } /** * @param uuid (optional) * @param name (optional) * @param email (optional) * @param page (optional) * @param limit (optional) * @return OK */ usersGetPage(uuid: string | undefined, name: string | undefined, email: string | undefined, page: number | undefined, limit: number | undefined): Promise { let url_ = this.baseUrl + "/v1/users?"; if (uuid === null) throw new Error("The parameter 'uuid' cannot be null."); else if (uuid !== undefined) url_ += "uuid=" + encodeURIComponent("" + uuid) + "&"; if (name === null) throw new Error("The parameter 'name' cannot be null."); else if (name !== undefined) url_ += "name=" + encodeURIComponent("" + name) + "&"; if (email === null) throw new Error("The parameter 'email' cannot be null."); else if (email !== undefined) url_ += "email=" + encodeURIComponent("" + email) + "&"; if (page === null) throw new Error("The parameter 'page' cannot be null."); else if (page !== undefined) url_ += "page=" + encodeURIComponent("" + page) + "&"; if (limit === null) throw new Error("The parameter 'limit' cannot be null."); else if (limit !== undefined) url_ += "limit=" + encodeURIComponent("" + limit) + "&"; url_ = url_.replace(/[?&]$/, ""); let options_: RequestInit = { method: "GET", headers: { "Accept": "text/plain" } }; return this.transformOptions(options_).then(transformedOptions_ => { return this.http.fetch(url_, transformedOptions_); }).then((_response: Response) => { return this.processUsersGetPage(_response); }); } protected processUsersGetPage(response: Response): Promise { const status = response.status; let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); }; if (status === 200) { return response.text().then((_responseText) => { let result200: any = null; result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as Profile[]; return result200; }); } else if (status !== 200 && status !== 204) { return response.text().then((_responseText) => { return throwException("An unexpected server error occurred.", status, _responseText, _headers); }); } return Promise.resolve(null as any); } /** * @return OK */ usersGetById(id: string): Promise { let url_ = this.baseUrl + "/v1/users/{id}"; if (id === undefined || id === null) throw new Error("The parameter 'id' must be defined."); url_ = url_.replace("{id}", encodeURIComponent("" + id)); url_ = url_.replace(/[?&]$/, ""); let options_: RequestInit = { method: "GET", headers: { "Accept": "text/plain" } }; return this.transformOptions(options_).then(transformedOptions_ => { return this.http.fetch(url_, transformedOptions_); }).then((_response: Response) => { return this.processUsersGetById(_response); }); } protected processUsersGetById(response: Response): Promise { const status = response.status; let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); }; if (status === 200) { return response.text().then((_responseText) => { let result200: any = null; result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as Profile; return result200; }); } else if (status !== 200 && status !== 204) { return response.text().then((_responseText) => { return throwException("An unexpected server error occurred.", status, _responseText, _headers); }); } return Promise.resolve(null as any); } /** * @return OK */ usersGetGroups(id: string): Promise { let url_ = this.baseUrl + "/v1/users/{id}/groups"; if (id === undefined || id === null) throw new Error("The parameter 'id' must be defined."); url_ = url_.replace("{id}", encodeURIComponent("" + id)); url_ = url_.replace(/[?&]$/, ""); let options_: RequestInit = { method: "GET", headers: { "Accept": "text/plain" } }; return this.transformOptions(options_).then(transformedOptions_ => { return this.http.fetch(url_, transformedOptions_); }).then((_response: Response) => { return this.processUsersGetGroups(_response); }); } protected processUsersGetGroups(response: Response): Promise { const status = response.status; let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); }; if (status === 200) { return response.text().then((_responseText) => { let result200: any = null; result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as ProfileGroup[]; return result200; }); } else if (status !== 200 && status !== 204) { return response.text().then((_responseText) => { return throwException("An unexpected server error occurred.", status, _responseText, _headers); }); } return Promise.resolve(null as any); } /** * @return OK */ usersGetGames(id: string): Promise { let url_ = this.baseUrl + "/v1/users/{id}/games"; if (id === undefined || id === null) throw new Error("The parameter 'id' must be defined."); url_ = url_.replace("{id}", encodeURIComponent("" + id)); url_ = url_.replace(/[?&]$/, ""); let options_: RequestInit = { method: "GET", headers: { "Accept": "text/plain" } }; return this.transformOptions(options_).then(transformedOptions_ => { return this.http.fetch(url_, transformedOptions_); }).then((_response: Response) => { return this.processUsersGetGames(_response); }); } protected processUsersGetGames(response: Response): Promise { const status = response.status; let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); }; if (status === 200) { return response.text().then((_responseText) => { let result200: any = null; result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as ProfileGame[]; return result200; }); } else if (status !== 200 && status !== 204) { return response.text().then((_responseText) => { return throwException("An unexpected server error occurred.", status, _responseText, _headers); }); } return Promise.resolve(null as any); } /** * @return OK */ usersGetFriends(id: string): Promise { let url_ = this.baseUrl + "/v1/users/{id}/friends"; if (id === undefined || id === null) throw new Error("The parameter 'id' must be defined."); url_ = url_.replace("{id}", encodeURIComponent("" + id)); url_ = url_.replace(/[?&]$/, ""); let options_: RequestInit = { method: "GET", headers: { "Accept": "text/plain" } }; return this.transformOptions(options_).then(transformedOptions_ => { return this.http.fetch(url_, transformedOptions_); }).then((_response: Response) => { return this.processUsersGetFriends(_response); }); } protected processUsersGetFriends(response: Response): Promise { const status = response.status; let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); }; if (status === 200) { return response.text().then((_responseText) => { let result200: any = null; result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as any[]; return result200; }); } else if (status !== 200 && status !== 204) { return response.text().then((_responseText) => { return throwException("An unexpected server error occurred.", status, _responseText, _headers); }); } return Promise.resolve(null as any); } /** * @param page (optional) * @param limit (optional) * @return OK */ usersGetServers(id: string, page: number | undefined, limit: number | undefined): Promise { let url_ = this.baseUrl + "/v1/users/{id}/servers?"; if (id === undefined || id === null) throw new Error("The parameter 'id' must be defined."); url_ = url_.replace("{id}", encodeURIComponent("" + id)); if (page === null) throw new Error("The parameter 'page' cannot be null."); else if (page !== undefined) url_ += "page=" + encodeURIComponent("" + page) + "&"; if (limit === null) throw new Error("The parameter 'limit' cannot be null."); else if (limit !== undefined) url_ += "limit=" + encodeURIComponent("" + limit) + "&"; url_ = url_.replace(/[?&]$/, ""); let options_: RequestInit = { method: "GET", headers: { "Accept": "text/plain" } }; return this.transformOptions(options_).then(transformedOptions_ => { return this.http.fetch(url_, transformedOptions_); }).then((_response: Response) => { return this.processUsersGetServers(_response); }); } protected processUsersGetServers(response: Response): Promise { const status = response.status; let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); }; if (status === 200) { return response.text().then((_responseText) => { let result200: any = null; result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as GameServer[]; return result200; }); } else if (status !== 200 && status !== 204) { return response.text().then((_responseText) => { return throwException("An unexpected server error occurred.", status, _responseText, _headers); }); } return Promise.resolve(null as any); } /** * @return OK */ usersGetAccounts(id: string): Promise { let url_ = this.baseUrl + "/v1/users/{id}/accounts"; if (id === undefined || id === null) throw new Error("The parameter 'id' must be defined."); url_ = url_.replace("{id}", encodeURIComponent("" + id)); url_ = url_.replace(/[?&]$/, ""); let options_: RequestInit = { method: "GET", headers: { "Accept": "text/plain" } }; return this.transformOptions(options_).then(transformedOptions_ => { return this.http.fetch(url_, transformedOptions_); }).then((_response: Response) => { return this.processUsersGetAccounts(_response); }); } protected processUsersGetAccounts(response: Response): Promise { const status = response.status; let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); }; if (status === 200) { return response.text().then((_responseText) => { let result200: any = null; result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as Account[]; return result200; }); } else if (status !== 200 && status !== 204) { return response.text().then((_responseText) => { return throwException("An unexpected server error occurred.", status, _responseText, _headers); }); } return Promise.resolve(null as any); } /** * @return OK */ usersGetPunishments(id: string): Promise { let url_ = this.baseUrl + "/v1/users/{id}/punishments"; if (id === undefined || id === null) throw new Error("The parameter 'id' must be defined."); url_ = url_.replace("{id}", encodeURIComponent("" + id)); url_ = url_.replace(/[?&]$/, ""); let options_: RequestInit = { method: "GET", headers: { "Accept": "text/plain" } }; return this.transformOptions(options_).then(transformedOptions_ => { return this.http.fetch(url_, transformedOptions_); }).then((_response: Response) => { return this.processUsersGetPunishments(_response); }); } protected processUsersGetPunishments(response: Response): Promise { const status = response.status; let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); }; if (status === 200) { return response.text().then((_responseText) => { let result200: any = null; result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as any[]; return result200; }); } else if (status !== 200 && status !== 204) { return response.text().then((_responseText) => { return throwException("An unexpected server error occurred.", status, _responseText, _headers); }); } return Promise.resolve(null as any); } /** * @param body (optional) * @return OK */ usersUpdateProfile(id: string, body: UpdateProfile | undefined): Promise { let url_ = this.baseUrl + "/v1/users/{id}/profile"; if (id === undefined || id === null) throw new Error("The parameter 'id' must be defined."); url_ = url_.replace("{id}", encodeURIComponent("" + id)); url_ = url_.replace(/[?&]$/, ""); const content_ = JSON.stringify(body); let options_: RequestInit = { body: content_, method: "PUT", headers: { "Content-Type": "application/json-patch+json", "Accept": "text/plain" } }; return this.transformOptions(options_).then(transformedOptions_ => { return this.http.fetch(url_, transformedOptions_); }).then((_response: Response) => { return this.processUsersUpdateProfile(_response); }); } protected processUsersUpdateProfile(response: Response): Promise { const status = response.status; let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); }; if (status === 200) { return response.text().then((_responseText) => { let result200: any = null; result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as Profile; return result200; }); } else if (status !== 200 && status !== 204) { return response.text().then((_responseText) => { return throwException("An unexpected server error occurred.", status, _responseText, _headers); }); } return Promise.resolve(null as any); } /** * @param length (optional) * @param symbols (optional) * @return OK */ utilsPassword(length: number | undefined, symbols: boolean | undefined): Promise { let url_ = this.baseUrl + "/v1/utils/password?"; if (length === null) throw new Error("The parameter 'length' cannot be null."); else if (length !== undefined) url_ += "length=" + encodeURIComponent("" + length) + "&"; if (symbols === null) throw new Error("The parameter 'symbols' cannot be null."); else if (symbols !== undefined) url_ += "symbols=" + encodeURIComponent("" + symbols) + "&"; url_ = url_.replace(/[?&]$/, ""); let options_: RequestInit = { method: "GET", headers: { "Accept": "text/plain" } }; return this.transformOptions(options_).then(transformedOptions_ => { return this.http.fetch(url_, transformedOptions_); }).then((_response: Response) => { return this.processUtilsPassword(_response); }); } protected processUtilsPassword(response: Response): Promise { const status = response.status; let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); }; if (status === 200) { return response.text().then((_responseText) => { let result200: any = null; result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as HashViewModel; return result200; }); } else if (status !== 200 && status !== 204) { return response.text().then((_responseText) => { return throwException("An unexpected server error occurred.", status, _responseText, _headers); }); } return Promise.resolve(null as any); } /** * @param amount (optional) * @return OK */ utilsNewFlake(amount: number | undefined): Promise { let url_ = this.baseUrl + "/v1/utils/flake?"; if (amount === null) throw new Error("The parameter 'amount' cannot be null."); else if (amount !== undefined) url_ += "amount=" + encodeURIComponent("" + amount) + "&"; url_ = url_.replace(/[?&]$/, ""); let options_: RequestInit = { method: "GET", headers: { "Accept": "text/plain" } }; return this.transformOptions(options_).then(transformedOptions_ => { return this.http.fetch(url_, transformedOptions_); }).then((_response: Response) => { return this.processUtilsNewFlake(_response); }); } protected processUtilsNewFlake(response: Response): Promise { const status = response.status; let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); }; if (status === 200) { return response.text().then((_responseText) => { let result200: any = null; result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as string[]; return result200; }); } else if (status !== 200 && status !== 204) { return response.text().then((_responseText) => { return throwException("An unexpected server error occurred.", status, _responseText, _headers); }); } return Promise.resolve(null as any); } /** * @param version (optional) * @param amount (optional) * @return OK */ utilsNewUuid(version: number | undefined, amount: number | undefined): Promise { let url_ = this.baseUrl + "/v1/utils/uuid?"; if (version === null) throw new Error("The parameter 'version' cannot be null."); else if (version !== undefined) url_ += "version=" + encodeURIComponent("" + version) + "&"; if (amount === null) throw new Error("The parameter 'amount' cannot be null."); else if (amount !== undefined) url_ += "amount=" + encodeURIComponent("" + amount) + "&"; url_ = url_.replace(/[?&]$/, ""); let options_: RequestInit = { method: "GET", headers: { "Accept": "text/plain" } }; return this.transformOptions(options_).then(transformedOptions_ => { return this.http.fetch(url_, transformedOptions_); }).then((_response: Response) => { return this.processUtilsNewUuid(_response); }); } protected processUtilsNewUuid(response: Response): Promise { const status = response.status; let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); }; if (status === 200) { return response.text().then((_responseText) => { let result200: any = null; result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as string[]; return result200; }); } else if (status !== 200 && status !== 204) { return response.text().then((_responseText) => { return throwException("An unexpected server error occurred.", status, _responseText, _headers); }); } return Promise.resolve(null as any); } /** * @param body (optional) * @return OK */ utilsBase64(body: CryptoViewModel | undefined): Promise { let url_ = this.baseUrl + "/v1/utils/base64"; url_ = url_.replace(/[?&]$/, ""); const content_ = JSON.stringify(body); let options_: RequestInit = { body: content_, method: "POST", headers: { "Content-Type": "application/json-patch+json", "Accept": "text/plain" } }; return this.transformOptions(options_).then(transformedOptions_ => { return this.http.fetch(url_, transformedOptions_); }).then((_response: Response) => { return this.processUtilsBase64(_response); }); } protected processUtilsBase64(response: Response): Promise { const status = response.status; let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); }; if (status === 200) { return response.text().then((_responseText) => { let result200: any = null; result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as CryptoViewModel; return result200; }); } else if (status !== 200 && status !== 204) { return response.text().then((_responseText) => { return throwException("An unexpected server error occurred.", status, _responseText, _headers); }); } return Promise.resolve(null as any); } /** * @param body (optional) * @return OK */ utilsMd5Hash(body: HashViewModel | undefined): Promise { let url_ = this.baseUrl + "/v1/utils/md5"; url_ = url_.replace(/[?&]$/, ""); const content_ = JSON.stringify(body); let options_: RequestInit = { body: content_, method: "POST", headers: { "Content-Type": "application/json-patch+json", "Accept": "text/plain" } }; return this.transformOptions(options_).then(transformedOptions_ => { return this.http.fetch(url_, transformedOptions_); }).then((_response: Response) => { return this.processUtilsMd5Hash(_response); }); } protected processUtilsMd5Hash(response: Response): Promise { const status = response.status; let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); }; if (status === 200) { return response.text().then((_responseText) => { let result200: any = null; result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as HashViewModel; return result200; }); } else if (status !== 200 && status !== 204) { return response.text().then((_responseText) => { return throwException("An unexpected server error occurred.", status, _responseText, _headers); }); } return Promise.resolve(null as any); } /** * @param body (optional) * @return OK */ utilsSha256Hash(body: HashViewModel | undefined): Promise { let url_ = this.baseUrl + "/v1/utils/sha256"; url_ = url_.replace(/[?&]$/, ""); const content_ = JSON.stringify(body); let options_: RequestInit = { body: content_, method: "POST", headers: { "Content-Type": "application/json-patch+json", "Accept": "text/plain" } }; return this.transformOptions(options_).then(transformedOptions_ => { return this.http.fetch(url_, transformedOptions_); }).then((_response: Response) => { return this.processUtilsSha256Hash(_response); }); } protected processUtilsSha256Hash(response: Response): Promise { const status = response.status; let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); }; if (status === 200) { return response.text().then((_responseText) => { let result200: any = null; result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as HashViewModel; return result200; }); } else if (status !== 200 && status !== 204) { return response.text().then((_responseText) => { return throwException("An unexpected server error occurred.", status, _responseText, _headers); }); } return Promise.resolve(null as any); } /** * @param body (optional) * @return OK */ utilsBcryptHash(body: HashViewModel | undefined): Promise { let url_ = this.baseUrl + "/v1/utils/bcrypt"; url_ = url_.replace(/[?&]$/, ""); const content_ = JSON.stringify(body); let options_: RequestInit = { body: content_, method: "POST", headers: { "Content-Type": "application/json-patch+json", "Accept": "text/plain" } }; return this.transformOptions(options_).then(transformedOptions_ => { return this.http.fetch(url_, transformedOptions_); }).then((_response: Response) => { return this.processUtilsBcryptHash(_response); }); } protected processUtilsBcryptHash(response: Response): Promise { const status = response.status; let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); }; if (status === 200) { return response.text().then((_responseText) => { let result200: any = null; result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as HashViewModel; return result200; }); } else if (status !== 200 && status !== 204) { return response.text().then((_responseText) => { return throwException("An unexpected server error occurred.", status, _responseText, _headers); }); } return Promise.resolve(null as any); } /** * @param body (optional) * @return OK */ utilsArgon2Hash(body: HashViewModel | undefined): Promise { let url_ = this.baseUrl + "/v1/utils/argon2"; url_ = url_.replace(/[?&]$/, ""); const content_ = JSON.stringify(body); let options_: RequestInit = { body: content_, method: "POST", headers: { "Content-Type": "application/json-patch+json", "Accept": "text/plain" } }; return this.transformOptions(options_).then(transformedOptions_ => { return this.http.fetch(url_, transformedOptions_); }).then((_response: Response) => { return this.processUtilsArgon2Hash(_response); }); } protected processUtilsArgon2Hash(response: Response): Promise { const status = response.status; let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); }; if (status === 200) { return response.text().then((_responseText) => { let result200: any = null; result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as HashViewModel; return result200; }); } else if (status !== 200 && status !== 204) { return response.text().then((_responseText) => { return throwException("An unexpected server error occurred.", status, _responseText, _headers); }); } return Promise.resolve(null as any); } } export interface Account { id?: string | null; name?: string | null; provider?: LoginProvider; user_id?: string; authorized?: boolean; fields?: any | null; created?: string; updated?: string | null; } export interface CryptoViewModel { encoded?: string | null; decoded?: string | null; } export interface File { id?: string; name?: string | null; description?: string | null; image_url?: string | null; author_id?: string; version?: string | null; file_url?: string | null; raw_size?: number; download_count?: number; last_download?: string | null; created?: string; updated?: string | null; } export interface Game { id?: string; name?: string | null; description?: string | null; type?: number; organization_id?: string; icon_url?: string | null; banner_url?: string | null; capsule_image_url?: string | null; library_image_url?: string | null; parent_id?: string | null; slug?: string | null; visibility?: number; password?: string | null; primary?: number; game_port?: number | null; query_port?: number | null; rcon_port?: number | null; user_count?: number; server_count?: number; achievement_count?: number; badge_count?: number; download_count?: number; steam_app_id?: number | null; steam_server_app_id?: number | null; enable_servers?: boolean; rust_gamedig_id?: string | null; node_gamedig_id?: string | null; server_connect_url?: string | null; server_tags?: string | null; created?: string; updated?: string | null; } export interface GameServer { id?: string; name?: string | null; description?: string | null; address?: string | null; game_port?: number | null; query_port?: number; game_id?: string; game_icon_url?: string | null; version?: string | null; featured?: number; cluster_id?: string | null; website_url?: string | null; banner_url?: string | null; owner_id?: string | null; uptime?: number; status?: ServerStatus; ping?: number | null; map?: string | null; used_slots?: number | null; max_slots?: number | null; motd?: string | null; players?: string | null; last_online?: string | null; country?: string | null; steam?: number; discord_server_id?: string | null; youtube_video_url?: string | null; tags?: string | null; comment_count?: number; created?: string; updated?: string | null; } export interface GameServerCluster { id?: string; name?: string | null; description?: string | null; package_id?: string; website_url?: string | null; banner_url?: string | null; owner_id?: string; discord_server_id?: string | null; youtube_video_url?: string | null; tags?: string | null; comment_count?: number; server_count?: number; created?: string; updated?: string | null; } export interface Group { id?: string; uuid?: string; name?: string | null; tag?: string | null; description?: string | null; type?: number; privacy?: number; owner_id?: string; verified?: boolean; photo_url?: string | null; banner_url?: string | null; member_count?: number; follower_count?: number; view_count?: number; created?: string; updated?: string | null; } export interface GroupGame { group_id?: string; game_id?: string; stats?: any | null; acquired?: string; last_used?: string | null; group?: Group; } export interface GroupMember { id?: string; uuid?: string; name?: string | null; display_name?: string | null; verified?: boolean; photo_url?: string | null; last_online?: string | null; rank?: GroupRank; since?: string; } export enum GroupRank { Member = "member", Leader = "leader", Owner = "owner", } export interface HashViewModel { value?: string | null; } export interface LeaderboardItem { name?: string | null; display_name?: string | null; photo_url?: string | null; level?: number; experience?: number; points?: number; } export enum LeaderboardOrder { Level = "level", Points = "points", } export enum LoginProvider { Steam = "steam", Epic = "epic", Discord = "discord", Microsoft = "microsoft", Playstation = "playstation", Google = "google", Apple = "apple", } export interface LoginRequest { login?: string | null; password?: string | null; } export interface LoginResponse { user?: UserInfo; access_token?: string | null; refresh_token?: string | null; expires_in?: number; } export interface Profile { id?: string; uuid?: string; name?: string | null; display_name?: string | null; flags?: string; verified?: boolean; level?: number; experience?: number; public_birthday?: boolean; birthday?: string | null; points?: number; location?: string | null; photo_url?: string | null; banner_url?: string | null; last_online?: string | null; biography?: string | null; view_count?: number; created?: string; updated?: string | null; } export interface ProfileGame { id?: string; name?: string | null; capsule_image_url?: string | null; library_image_url?: string | null; slug?: string | null; time_used?: number; unlocked_achievements?: number; total_achievements?: number; stats?: any | null; acquired?: string; last_used?: string | null; } export interface ProfileGroup { id?: string; uuid?: string; name?: string | null; tag?: string | null; privacy?: number; verified?: boolean; photo_url?: string | null; member_count?: number; rank?: GroupRank; since?: string; } export interface RefreshRequest { refresh_token?: string | null; } export interface RegisterRequest { uuid?: string | null; name: string; email?: string | null; password: string; } export interface SearchRequest { type?: SearchType; query?: string | null; page?: number | null; game_id?: string | null; } export enum SearchType { User = "user", Group = "group", Server = "server", Cluster = "cluster", } export interface ServerMetrics { server_count?: number; package_count?: number; country_count?: number; } export enum ServerStatus { Unknown = "unknown", Offline = "offline", Online = "online", } export interface Subscription { id?: string; name?: string | null; description?: string | null; image_url?: string | null; readonly prices?: { [key: string]: number; } | null; created?: string; updated?: string | null; } export interface UpdateProfile { display_name?: string | null; biography?: string | null; } export interface UserInfo { id?: string; uuid?: string; name?: string | null; display_name?: string | null; email?: string | null; type?: UserType; flags?: string; permissions?: string; verified?: boolean; level?: number; experience?: number; public_birthday?: boolean; birthday?: string | null; points?: number; location?: string | null; language?: string | null; timezone?: string | null; currency?: string | null; photo_url?: string | null; banner_url?: string | null; last_online?: string | null; biography?: string | null; view_count?: number; created?: string; updated?: string | null; } export enum UserType { User = "user", Bot = "bot", Organization = "organization", } export class TribufuApiError extends Error { override message: string; status: number; response: string; headers: { [key: string]: any; }; result: any; constructor(message: string, status: number, response: string, headers: { [key: string]: any; }, result: any) { super(); this.message = message; this.status = status; this.response = response; this.headers = headers; this.result = result; } protected isTribufuApiError = true; static isTribufuApiError(obj: any): obj is TribufuApiError { return obj.isTribufuApiError === true; } } function throwException(message: string, status: number, response: string, headers: { [key: string]: any; }, result?: any): any { if (result !== null && result !== undefined) throw result; else throw new TribufuApiError(message, status, response, headers, null); }