mirror of
https://github.com/tribufu/sdk-js
synced 2025-06-16 18:44:18 +00:00
Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
4d657a4617 |
@ -1,17 +1,15 @@
|
|||||||
root = true
|
root = true
|
||||||
|
|
||||||
[*]
|
[*]
|
||||||
charset = utf-8
|
|
||||||
end_of_line = lf
|
end_of_line = lf
|
||||||
indent_size = 4
|
|
||||||
indent_style = space
|
indent_style = space
|
||||||
insert_final_newline = true
|
indent_size = 4
|
||||||
max_line_length = 120
|
charset = utf-8
|
||||||
trim_trailing_whitespace = true
|
trim_trailing_whitespace = true
|
||||||
|
insert_final_newline = true
|
||||||
|
|
||||||
[*.md]
|
[*.md]
|
||||||
indent_size = 1
|
|
||||||
trim_trailing_whitespace = false
|
trim_trailing_whitespace = false
|
||||||
|
|
||||||
[.env*]
|
[*.env*]
|
||||||
insert_final_newline = false
|
insert_final_newline = false
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "tribufu",
|
"name": "tribufu",
|
||||||
"version": "1.0.1",
|
"version": "1.0.0",
|
||||||
"description": "Tribufu JS SDK",
|
"description": "Tribufu JS SDK",
|
||||||
"repository": "https://github.com/Tribufu/TribufuJs",
|
"repository": "https://github.com/Tribufu/TribufuJs",
|
||||||
"author": "Tribufu <contact@Tribufu.com>",
|
"author": "Tribufu <contact@Tribufu.com>",
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
nswag run ./src/api/api.nswag
|
nswag run ./src/api/api.nswag
|
||||||
|
nswag run ./src/translate/translate.nswag
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
"documentGenerator": {
|
"documentGenerator": {
|
||||||
"fromDocument": {
|
"fromDocument": {
|
||||||
"json": "",
|
"json": "",
|
||||||
"url": "https://api.tribufu.com/v1/openapi.json",
|
"url": "http://localhost:5000/openapi.json",
|
||||||
"output": null,
|
"output": null,
|
||||||
"newLineBehavior": "Auto"
|
"newLineBehavior": "Auto"
|
||||||
}
|
}
|
||||||
@ -48,7 +48,7 @@
|
|||||||
"useLeafType": false,
|
"useLeafType": false,
|
||||||
"classTypes": [],
|
"classTypes": [],
|
||||||
"extendedClasses": [],
|
"extendedClasses": [],
|
||||||
"extensionCode": "include.ts",
|
"extensionCode": "../core/include.ts",
|
||||||
"generateDefaultValues": true,
|
"generateDefaultValues": true,
|
||||||
"excludedTypeNames": [],
|
"excludedTypeNames": [],
|
||||||
"excludedParameterNames": [],
|
"excludedParameterNames": [],
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
/* eslint-disable */
|
/* eslint-disable */
|
||||||
// ReSharper disable InconsistentNaming
|
// ReSharper disable InconsistentNaming
|
||||||
|
|
||||||
import { TribufuApiBase } from "./base";
|
import { TribufuApiBase } from "../core/base";
|
||||||
|
|
||||||
export class TribufuApiGenerated extends TribufuApiBase {
|
export class TribufuApiGenerated extends TribufuApiBase {
|
||||||
private http: { fetch(url: RequestInfo, init?: RequestInit): Promise<Response> };
|
private http: { fetch(url: RequestInfo, init?: RequestInit): Promise<Response> };
|
||||||
@ -62,7 +62,7 @@ export class TribufuApiGenerated extends TribufuApiBase {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Login with name or email and password.
|
* Login with name or email and password.
|
||||||
* @param body (optional)
|
* @param body (optional)
|
||||||
* @return OK
|
* @return OK
|
||||||
*/
|
*/
|
||||||
login(body?: LoginRequest | undefined): Promise<LoginResponse> {
|
login(body?: LoginRequest | undefined): Promise<LoginResponse> {
|
||||||
@ -106,7 +106,7 @@ export class TribufuApiGenerated extends TribufuApiBase {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new user.
|
* Create a new user.
|
||||||
* @param body (optional)
|
* @param body (optional)
|
||||||
* @return OK
|
* @return OK
|
||||||
*/
|
*/
|
||||||
register(body?: RegisterRequest | undefined): Promise<LoginResponse> {
|
register(body?: RegisterRequest | undefined): Promise<LoginResponse> {
|
||||||
@ -150,7 +150,7 @@ export class TribufuApiGenerated extends TribufuApiBase {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Refresh credentials.
|
* Refresh credentials.
|
||||||
* @param body (optional)
|
* @param body (optional)
|
||||||
* @return OK
|
* @return OK
|
||||||
*/
|
*/
|
||||||
refresh(body?: RefreshRequest | undefined): Promise<LoginResponse> {
|
refresh(body?: RefreshRequest | undefined): Promise<LoginResponse> {
|
||||||
@ -230,8 +230,8 @@ export class TribufuApiGenerated extends TribufuApiBase {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a list of game server clusters.
|
* Get a list of game server clusters.
|
||||||
* @param page (optional)
|
* @param page (optional)
|
||||||
* @param limit (optional)
|
* @param limit (optional)
|
||||||
* @return OK
|
* @return OK
|
||||||
*/
|
*/
|
||||||
getClusters(page?: number | undefined, limit?: number | undefined): Promise<GameServerCluster[]> {
|
getClusters(page?: number | undefined, limit?: number | undefined): Promise<GameServerCluster[]> {
|
||||||
@ -279,7 +279,7 @@ export class TribufuApiGenerated extends TribufuApiBase {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new game server cluster.
|
* Create a new game server cluster.
|
||||||
* @param body (optional)
|
* @param body (optional)
|
||||||
* @return OK
|
* @return OK
|
||||||
*/
|
*/
|
||||||
createCluster(body?: any | undefined): Promise<void> {
|
createCluster(body?: any | undefined): Promise<void> {
|
||||||
@ -362,7 +362,7 @@ export class TribufuApiGenerated extends TribufuApiBase {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Update a game server cluster.
|
* Update a game server cluster.
|
||||||
* @param body (optional)
|
* @param body (optional)
|
||||||
* @return OK
|
* @return OK
|
||||||
*/
|
*/
|
||||||
updateCluster(id: string, body?: any | undefined): Promise<void> {
|
updateCluster(id: string, body?: any | undefined): Promise<void> {
|
||||||
@ -447,7 +447,7 @@ export class TribufuApiGenerated extends TribufuApiBase {
|
|||||||
* Get a list of games.
|
* Get a list of games.
|
||||||
* @return OK
|
* @return OK
|
||||||
*/
|
*/
|
||||||
getGames(): Promise<Game[]> {
|
getGames(): Promise<Application[]> {
|
||||||
let url_ = this.baseUrl + "/v1/games";
|
let url_ = this.baseUrl + "/v1/games";
|
||||||
url_ = url_.replace(/[?&]$/, "");
|
url_ = url_.replace(/[?&]$/, "");
|
||||||
|
|
||||||
@ -465,13 +465,13 @@ export class TribufuApiGenerated extends TribufuApiBase {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
protected processGetGames(response: Response): Promise<Game[]> {
|
protected processGetGames(response: Response): Promise<Application[]> {
|
||||||
const status = response.status;
|
const status = response.status;
|
||||||
let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); };
|
let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); };
|
||||||
if (status === 200) {
|
if (status === 200) {
|
||||||
return response.text().then((_responseText) => {
|
return response.text().then((_responseText) => {
|
||||||
let result200: any = null;
|
let result200: any = null;
|
||||||
result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as Game[];
|
result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as Application[];
|
||||||
return result200;
|
return result200;
|
||||||
});
|
});
|
||||||
} else if (status !== 200 && status !== 204) {
|
} else if (status !== 200 && status !== 204) {
|
||||||
@ -479,14 +479,14 @@ export class TribufuApiGenerated extends TribufuApiBase {
|
|||||||
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return Promise.resolve<Game[]>(null as any);
|
return Promise.resolve<Application[]>(null as any);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a game by id.
|
* Get a game by id.
|
||||||
* @return OK
|
* @return OK
|
||||||
*/
|
*/
|
||||||
getGameById(id: string): Promise<Game> {
|
getGameById(id: string): Promise<Application> {
|
||||||
let url_ = this.baseUrl + "/v1/games/{id}";
|
let url_ = this.baseUrl + "/v1/games/{id}";
|
||||||
if (id === undefined || id === null)
|
if (id === undefined || id === null)
|
||||||
throw new Error("The parameter 'id' must be defined.");
|
throw new Error("The parameter 'id' must be defined.");
|
||||||
@ -507,13 +507,13 @@ export class TribufuApiGenerated extends TribufuApiBase {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
protected processGetGameById(response: Response): Promise<Game> {
|
protected processGetGameById(response: Response): Promise<Application> {
|
||||||
const status = response.status;
|
const status = response.status;
|
||||||
let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); };
|
let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); };
|
||||||
if (status === 200) {
|
if (status === 200) {
|
||||||
return response.text().then((_responseText) => {
|
return response.text().then((_responseText) => {
|
||||||
let result200: any = null;
|
let result200: any = null;
|
||||||
result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as Game;
|
result200 = _responseText === "" ? null : JSON.parse(_responseText, this.jsonParseReviver) as Application;
|
||||||
return result200;
|
return result200;
|
||||||
});
|
});
|
||||||
} else if (status !== 200 && status !== 204) {
|
} else if (status !== 200 && status !== 204) {
|
||||||
@ -521,13 +521,13 @@ export class TribufuApiGenerated extends TribufuApiBase {
|
|||||||
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
return throwException("An unexpected server error occurred.", status, _responseText, _headers);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return Promise.resolve<Game>(null as any);
|
return Promise.resolve<Application>(null as any);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a list of game servers of a game.
|
* Get a list of game servers of a game.
|
||||||
* @param page (optional)
|
* @param page (optional)
|
||||||
* @param limit (optional)
|
* @param limit (optional)
|
||||||
* @return OK
|
* @return OK
|
||||||
*/
|
*/
|
||||||
getGameServers(id: string, page?: number | undefined, limit?: number | undefined): Promise<GameServer[]> {
|
getGameServers(id: string, page?: number | undefined, limit?: number | undefined): Promise<GameServer[]> {
|
||||||
@ -578,8 +578,8 @@ export class TribufuApiGenerated extends TribufuApiBase {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a list of game server clusters of a game.
|
* Get a list of game server clusters of a game.
|
||||||
* @param page (optional)
|
* @param page (optional)
|
||||||
* @param limit (optional)
|
* @param limit (optional)
|
||||||
* @return OK
|
* @return OK
|
||||||
*/
|
*/
|
||||||
getGameClusters(id: string, page?: number | undefined, limit?: number | undefined): Promise<GameServerCluster[]> {
|
getGameClusters(id: string, page?: number | undefined, limit?: number | undefined): Promise<GameServerCluster[]> {
|
||||||
@ -630,8 +630,8 @@ export class TribufuApiGenerated extends TribufuApiBase {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a list of game items.
|
* Get a list of game items.
|
||||||
* @param page (optional)
|
* @param page (optional)
|
||||||
* @param limit (optional)
|
* @param limit (optional)
|
||||||
* @return OK
|
* @return OK
|
||||||
*/
|
*/
|
||||||
getGameItems(id: string, page?: number | undefined, limit?: number | undefined): Promise<any[]> {
|
getGameItems(id: string, page?: number | undefined, limit?: number | undefined): Promise<any[]> {
|
||||||
@ -682,8 +682,8 @@ export class TribufuApiGenerated extends TribufuApiBase {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a list of groups.
|
* Get a list of groups.
|
||||||
* @param page (optional)
|
* @param page (optional)
|
||||||
* @param limit (optional)
|
* @param limit (optional)
|
||||||
* @return OK
|
* @return OK
|
||||||
*/
|
*/
|
||||||
getGroups(page?: number | undefined, limit?: number | undefined): Promise<Group[]> {
|
getGroups(page?: number | undefined, limit?: number | undefined): Promise<Group[]> {
|
||||||
@ -731,7 +731,7 @@ export class TribufuApiGenerated extends TribufuApiBase {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new group.
|
* Create a new group.
|
||||||
* @param body (optional)
|
* @param body (optional)
|
||||||
* @return OK
|
* @return OK
|
||||||
*/
|
*/
|
||||||
createGroup(body?: any | undefined): Promise<void> {
|
createGroup(body?: any | undefined): Promise<void> {
|
||||||
@ -814,7 +814,7 @@ export class TribufuApiGenerated extends TribufuApiBase {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Update a group.
|
* Update a group.
|
||||||
* @param body (optional)
|
* @param body (optional)
|
||||||
* @return OK
|
* @return OK
|
||||||
*/
|
*/
|
||||||
updateGroup(id: string, body?: any | undefined): Promise<void> {
|
updateGroup(id: string, body?: any | undefined): Promise<void> {
|
||||||
@ -1065,7 +1065,7 @@ export class TribufuApiGenerated extends TribufuApiBase {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the top 20 leaderboard users.
|
* Get the top 20 leaderboard users.
|
||||||
* @param order (optional)
|
* @param order (optional)
|
||||||
* @return OK
|
* @return OK
|
||||||
*/
|
*/
|
||||||
getLeaderboard(order?: LeaderboardOrder | undefined): Promise<LeaderboardItem[]> {
|
getLeaderboard(order?: LeaderboardOrder | undefined): Promise<LeaderboardItem[]> {
|
||||||
@ -1109,8 +1109,8 @@ export class TribufuApiGenerated extends TribufuApiBase {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a list of packages.
|
* Get a list of packages.
|
||||||
* @param page (optional)
|
* @param page (optional)
|
||||||
* @param limit (optional)
|
* @param limit (optional)
|
||||||
* @return OK
|
* @return OK
|
||||||
*/
|
*/
|
||||||
getPackages(page?: number | undefined, limit?: number | undefined): Promise<Package[]> {
|
getPackages(page?: number | undefined, limit?: number | undefined): Promise<Package[]> {
|
||||||
@ -1200,7 +1200,7 @@ export class TribufuApiGenerated extends TribufuApiBase {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Advanced search for servers or players.
|
* Advanced search for servers or players.
|
||||||
* @param body (optional)
|
* @param body (optional)
|
||||||
* @return OK
|
* @return OK
|
||||||
*/
|
*/
|
||||||
search(body?: SearchRequest | undefined): Promise<any[]> {
|
search(body?: SearchRequest | undefined): Promise<any[]> {
|
||||||
@ -1244,8 +1244,8 @@ export class TribufuApiGenerated extends TribufuApiBase {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a list of game servers.
|
* Get a list of game servers.
|
||||||
* @param page (optional)
|
* @param page (optional)
|
||||||
* @param limit (optional)
|
* @param limit (optional)
|
||||||
* @return OK
|
* @return OK
|
||||||
*/
|
*/
|
||||||
getServers(page?: number | undefined, limit?: number | undefined): Promise<GameServer[]> {
|
getServers(page?: number | undefined, limit?: number | undefined): Promise<GameServer[]> {
|
||||||
@ -1293,7 +1293,7 @@ export class TribufuApiGenerated extends TribufuApiBase {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new game server.
|
* Create a new game server.
|
||||||
* @param body (optional)
|
* @param body (optional)
|
||||||
* @return OK
|
* @return OK
|
||||||
*/
|
*/
|
||||||
createServer(body?: any | undefined): Promise<void> {
|
createServer(body?: any | undefined): Promise<void> {
|
||||||
@ -1376,7 +1376,7 @@ export class TribufuApiGenerated extends TribufuApiBase {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Update a game server.
|
* Update a game server.
|
||||||
* @param body (optional)
|
* @param body (optional)
|
||||||
* @return OK
|
* @return OK
|
||||||
*/
|
*/
|
||||||
updateServer(id: string, body?: any | undefined): Promise<void> {
|
updateServer(id: string, body?: any | undefined): Promise<void> {
|
||||||
@ -1504,8 +1504,8 @@ export class TribufuApiGenerated extends TribufuApiBase {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a list of game servers from a country.
|
* Get a list of game servers from a country.
|
||||||
* @param page (optional)
|
* @param page (optional)
|
||||||
* @param limit (optional)
|
* @param limit (optional)
|
||||||
* @return OK
|
* @return OK
|
||||||
*/
|
*/
|
||||||
getServersByCountry(country: string, page?: number | undefined, limit?: number | undefined): Promise<GameServer[]> {
|
getServersByCountry(country: string, page?: number | undefined, limit?: number | undefined): Promise<GameServer[]> {
|
||||||
@ -1556,7 +1556,7 @@ export class TribufuApiGenerated extends TribufuApiBase {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Claim a game server.
|
* Claim a game server.
|
||||||
* @param body (optional)
|
* @param body (optional)
|
||||||
* @return OK
|
* @return OK
|
||||||
*/
|
*/
|
||||||
claimServer(id: string, body?: any | undefined): Promise<void> {
|
claimServer(id: string, body?: any | undefined): Promise<void> {
|
||||||
@ -1678,8 +1678,8 @@ export class TribufuApiGenerated extends TribufuApiBase {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a list of subscriptions.
|
* Get a list of subscriptions.
|
||||||
* @param page (optional)
|
* @param page (optional)
|
||||||
* @param limit (optional)
|
* @param limit (optional)
|
||||||
* @return OK
|
* @return OK
|
||||||
*/
|
*/
|
||||||
getSubscriptions(page?: number | undefined, limit?: number | undefined): Promise<Subscription[]> {
|
getSubscriptions(page?: number | undefined, limit?: number | undefined): Promise<Subscription[]> {
|
||||||
@ -1769,8 +1769,8 @@ export class TribufuApiGenerated extends TribufuApiBase {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a list of user profiles.
|
* Get a list of user profiles.
|
||||||
* @param page (optional)
|
* @param page (optional)
|
||||||
* @param limit (optional)
|
* @param limit (optional)
|
||||||
* @return OK
|
* @return OK
|
||||||
*/
|
*/
|
||||||
getUsers(page?: number | undefined, limit?: number | undefined): Promise<Profile[]> {
|
getUsers(page?: number | undefined, limit?: number | undefined): Promise<Profile[]> {
|
||||||
@ -2070,8 +2070,8 @@ export class TribufuApiGenerated extends TribufuApiBase {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a list of servers the user is owner of.
|
* Get a list of servers the user is owner of.
|
||||||
* @param page (optional)
|
* @param page (optional)
|
||||||
* @param limit (optional)
|
* @param limit (optional)
|
||||||
* @return OK
|
* @return OK
|
||||||
*/
|
*/
|
||||||
getUserServers(id: string, page?: number | undefined, limit?: number | undefined): Promise<GameServer[]> {
|
getUserServers(id: string, page?: number | undefined, limit?: number | undefined): Promise<GameServer[]> {
|
||||||
@ -2206,7 +2206,7 @@ export class TribufuApiGenerated extends TribufuApiBase {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Update a user profile.
|
* Update a user profile.
|
||||||
* @param body (optional)
|
* @param body (optional)
|
||||||
* @return OK
|
* @return OK
|
||||||
*/
|
*/
|
||||||
updateUserProfile(id: string, body?: UpdateProfile | undefined): Promise<Profile> {
|
updateUserProfile(id: string, body?: UpdateProfile | undefined): Promise<Profile> {
|
||||||
@ -2253,7 +2253,7 @@ export class TribufuApiGenerated extends TribufuApiBase {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the email of a user.
|
* Change the email of a user.
|
||||||
* @param body (optional)
|
* @param body (optional)
|
||||||
* @return OK
|
* @return OK
|
||||||
*/
|
*/
|
||||||
changeEmail(id: string, body?: any | undefined): Promise<void> {
|
changeEmail(id: string, body?: any | undefined): Promise<void> {
|
||||||
@ -2297,7 +2297,7 @@ export class TribufuApiGenerated extends TribufuApiBase {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Change the password of a user.
|
* Change the password of a user.
|
||||||
* @param body (optional)
|
* @param body (optional)
|
||||||
* @return OK
|
* @return OK
|
||||||
*/
|
*/
|
||||||
changePassword(id: string, body?: any | undefined): Promise<void> {
|
changePassword(id: string, body?: any | undefined): Promise<void> {
|
||||||
@ -2341,8 +2341,8 @@ export class TribufuApiGenerated extends TribufuApiBase {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate a random password.
|
* Generate a random password.
|
||||||
* @param length (optional)
|
* @param length (optional)
|
||||||
* @param symbols (optional)
|
* @param symbols (optional)
|
||||||
* @return OK
|
* @return OK
|
||||||
*/
|
*/
|
||||||
generatePassword(length?: number | undefined, symbols?: boolean | undefined): Promise<HashViewModel> {
|
generatePassword(length?: number | undefined, symbols?: boolean | undefined): Promise<HashViewModel> {
|
||||||
@ -2390,7 +2390,7 @@ export class TribufuApiGenerated extends TribufuApiBase {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate one or more flake ids.
|
* Generate one or more flake ids.
|
||||||
* @param amount (optional)
|
* @param amount (optional)
|
||||||
* @return OK
|
* @return OK
|
||||||
*/
|
*/
|
||||||
generateFlakeId(amount?: number | undefined): Promise<string[]> {
|
generateFlakeId(amount?: number | undefined): Promise<string[]> {
|
||||||
@ -2434,8 +2434,8 @@ export class TribufuApiGenerated extends TribufuApiBase {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Generate one or more uuids with a specific version.
|
* Generate one or more uuids with a specific version.
|
||||||
* @param version (optional)
|
* @param version (optional)
|
||||||
* @param amount (optional)
|
* @param amount (optional)
|
||||||
* @return OK
|
* @return OK
|
||||||
*/
|
*/
|
||||||
generateUuid(version?: number | undefined, amount?: number | undefined): Promise<string[]> {
|
generateUuid(version?: number | undefined, amount?: number | undefined): Promise<string[]> {
|
||||||
@ -2483,7 +2483,7 @@ export class TribufuApiGenerated extends TribufuApiBase {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert a string to base64 or vice versa.
|
* Convert a string to base64 or vice versa.
|
||||||
* @param body (optional)
|
* @param body (optional)
|
||||||
* @return OK
|
* @return OK
|
||||||
*/
|
*/
|
||||||
convertBase64(body?: CryptoViewModel | undefined): Promise<CryptoViewModel> {
|
convertBase64(body?: CryptoViewModel | undefined): Promise<CryptoViewModel> {
|
||||||
@ -2527,7 +2527,7 @@ export class TribufuApiGenerated extends TribufuApiBase {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Hash a string using md5.
|
* Hash a string using md5.
|
||||||
* @param body (optional)
|
* @param body (optional)
|
||||||
* @return OK
|
* @return OK
|
||||||
*/
|
*/
|
||||||
hashMd5(body?: HashViewModel | undefined): Promise<HashViewModel> {
|
hashMd5(body?: HashViewModel | undefined): Promise<HashViewModel> {
|
||||||
@ -2571,7 +2571,7 @@ export class TribufuApiGenerated extends TribufuApiBase {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Hash a string using sha256.
|
* Hash a string using sha256.
|
||||||
* @param body (optional)
|
* @param body (optional)
|
||||||
* @return OK
|
* @return OK
|
||||||
*/
|
*/
|
||||||
hashSha256(body?: HashViewModel | undefined): Promise<HashViewModel> {
|
hashSha256(body?: HashViewModel | undefined): Promise<HashViewModel> {
|
||||||
@ -2615,7 +2615,7 @@ export class TribufuApiGenerated extends TribufuApiBase {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Hash a string using bcrypt.
|
* Hash a string using bcrypt.
|
||||||
* @param body (optional)
|
* @param body (optional)
|
||||||
* @return OK
|
* @return OK
|
||||||
*/
|
*/
|
||||||
hashBcrypt(body?: HashViewModel | undefined): Promise<HashViewModel> {
|
hashBcrypt(body?: HashViewModel | undefined): Promise<HashViewModel> {
|
||||||
@ -2659,7 +2659,7 @@ export class TribufuApiGenerated extends TribufuApiBase {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Hash a string using argon2.
|
* Hash a string using argon2.
|
||||||
* @param body (optional)
|
* @param body (optional)
|
||||||
* @return OK
|
* @return OK
|
||||||
*/
|
*/
|
||||||
hashArgon2(body?: HashViewModel | undefined): Promise<HashViewModel> {
|
hashArgon2(body?: HashViewModel | undefined): Promise<HashViewModel> {
|
||||||
@ -2713,28 +2713,7 @@ export interface Account {
|
|||||||
updated: string | null;
|
updated: string | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
export enum ApplicationType {
|
export interface Application {
|
||||||
Application = "application",
|
|
||||||
Game = "game",
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface CryptoViewModel {
|
|
||||||
encoded: string | null;
|
|
||||||
decoded: string | null;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface Game {
|
|
||||||
game_port: number | null;
|
|
||||||
query_port: number | null;
|
|
||||||
rcon_port: number | null;
|
|
||||||
server_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;
|
|
||||||
id: string;
|
id: string;
|
||||||
name: string | null;
|
name: string | null;
|
||||||
description: string | null;
|
description: string | null;
|
||||||
@ -2757,6 +2736,16 @@ export interface Game {
|
|||||||
updated: string | null;
|
updated: string | null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export enum ApplicationType {
|
||||||
|
Application = "application",
|
||||||
|
Game = "game",
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface CryptoViewModel {
|
||||||
|
encoded: string | null;
|
||||||
|
decoded: string | null;
|
||||||
|
}
|
||||||
|
|
||||||
export interface GameServer {
|
export interface GameServer {
|
||||||
id: string;
|
id: string;
|
||||||
name: string | null;
|
name: string | null;
|
||||||
@ -3072,4 +3061,4 @@ function throwException(message: string, status: number, response: string, heade
|
|||||||
throw result;
|
throw result;
|
||||||
else
|
else
|
||||||
throw new TribufuApiError(message, status, response, headers, null);
|
throw new TribufuApiError(message, status, response, headers, null);
|
||||||
}
|
}
|
||||||
|
@ -1 +0,0 @@
|
|||||||
import { TribufuApiBase } from "./base";
|
|
@ -2,7 +2,7 @@
|
|||||||
// SPDX-License-Identifier: MIT
|
// SPDX-License-Identifier: MIT
|
||||||
|
|
||||||
import { TRIBUFU_API_URL } from "..";
|
import { TRIBUFU_API_URL } from "..";
|
||||||
import { TribufuApiBase } from "./base";
|
import { TribufuApiBase } from "../core/base";
|
||||||
import { TribufuApiGenerated } from "./generated";
|
import { TribufuApiGenerated } from "./generated";
|
||||||
import { TribufuApiOptions } from "../options";
|
import { TribufuApiOptions } from "../options";
|
||||||
|
|
||||||
@ -98,6 +98,8 @@ export class TribufuApi extends TribufuApiGenerated {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const baseUrl = process.env[`TRIBUFU_API_URL`] || null;
|
const baseUrl = process.env[`TRIBUFU_API_URL`] || null;
|
||||||
return TribufuApiBase.debugEnabled() && baseUrl ? baseUrl : TRIBUFU_API_URL;
|
return TribufuApiBase.debugEnabled() && baseUrl
|
||||||
|
? baseUrl
|
||||||
|
: TRIBUFU_API_URL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -92,10 +92,12 @@ export abstract class TribufuApiBase {
|
|||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
protected transformOptions(options: RequestInit) {
|
protected transformOptions(options: RequestInit) {
|
||||||
options.headers = {
|
if (this.apiKey) {
|
||||||
...options.headers,
|
options.headers = {
|
||||||
...this.getHeaders(),
|
...options.headers,
|
||||||
};
|
...this.getHeaders(),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
return Promise.resolve(options);
|
return Promise.resolve(options);
|
||||||
}
|
}
|
1
src/core/include.ts
Normal file
1
src/core/include.ts
Normal file
@ -0,0 +1 @@
|
|||||||
|
import { TribufuApiBase } from "../core/base";
|
@ -22,9 +22,9 @@ export {
|
|||||||
TribufuApiSingleton,
|
TribufuApiSingleton,
|
||||||
};
|
};
|
||||||
|
|
||||||
export * from "./api/base";
|
export * from "./api/api.base";
|
||||||
export * from "./api/generated";
|
export * from "./api/api.generated";
|
||||||
export * from "./api/include";
|
export * from "./api/api.include";
|
||||||
export * from "./api/index";
|
export * from "./api/index";
|
||||||
export * from "./api/singletion";
|
export * from "./api/singletion";
|
||||||
export * from "./http/headers";
|
export * from "./http/headers";
|
||||||
|
84
src/translate/generated.ts
Normal file
84
src/translate/generated.ts
Normal file
@ -0,0 +1,84 @@
|
|||||||
|
//----------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// Generated using the NSwag toolchain v14.1.0.0 (NJsonSchema v11.0.2.0 (Newtonsoft.Json v13.0.0.0)) (http://NSwag.org)
|
||||||
|
// </auto-generated>
|
||||||
|
//----------------------
|
||||||
|
|
||||||
|
/* tslint:disable */
|
||||||
|
/* eslint-disable */
|
||||||
|
// ReSharper disable InconsistentNaming
|
||||||
|
|
||||||
|
import { TribufuApiBase } from "../core/base";
|
||||||
|
|
||||||
|
export class TribufuTranslateGenerated extends TribufuApiBase {
|
||||||
|
private http: { fetch(url: RequestInfo, init?: RequestInit): Promise<Response> };
|
||||||
|
private baseUrl: string;
|
||||||
|
protected jsonParseReviver: ((key: string, value: any) => any) | undefined = undefined;
|
||||||
|
|
||||||
|
constructor(baseUrl?: string, http?: { fetch(url: RequestInfo, init?: RequestInit): Promise<Response> }) {
|
||||||
|
super();
|
||||||
|
this.http = http ? http : window as any;
|
||||||
|
this.baseUrl = baseUrl ?? "";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Translate a given text.
|
||||||
|
*/
|
||||||
|
translate(): Promise<void> {
|
||||||
|
let url_ = this.baseUrl + "/translate";
|
||||||
|
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.processTranslate(_response);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
protected processTranslate(response: Response): Promise<void> {
|
||||||
|
const status = response.status;
|
||||||
|
let _headers: any = {}; if (response.headers && response.headers.forEach) { response.headers.forEach((v: any, k: any) => _headers[k] = v); };
|
||||||
|
{
|
||||||
|
return response.text().then((_responseText) => {
|
||||||
|
return;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class TribufuTranslateError 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 isTribufuTranslateError = true;
|
||||||
|
|
||||||
|
static isTribufuTranslateError(obj: any): obj is TribufuTranslateError {
|
||||||
|
return obj.isTribufuTranslateError === 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 TribufuTranslateError(message, status, response, headers, null);
|
||||||
|
}
|
74
src/translate/translate.nswag
Normal file
74
src/translate/translate.nswag
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
{
|
||||||
|
"runtime": "Default",
|
||||||
|
"defaultVariables": null,
|
||||||
|
"documentGenerator": {
|
||||||
|
"fromDocument": {
|
||||||
|
"json": "",
|
||||||
|
"url": "http://localhost:5578/openapi.json",
|
||||||
|
"output": null,
|
||||||
|
"newLineBehavior": "Auto"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"codeGenerators": {
|
||||||
|
"openApiToTypeScriptClient": {
|
||||||
|
"className": "TribufuTranslateGenerated",
|
||||||
|
"moduleName": "",
|
||||||
|
"namespace": "",
|
||||||
|
"typeScriptVersion": 4.3,
|
||||||
|
"template": "Fetch",
|
||||||
|
"promiseType": "Promise",
|
||||||
|
"httpClass": "HttpClient",
|
||||||
|
"withCredentials": false,
|
||||||
|
"useSingletonProvider": false,
|
||||||
|
"injectionTokenType": "OpaqueToken",
|
||||||
|
"rxJsVersion": 6,
|
||||||
|
"dateTimeType": "String",
|
||||||
|
"nullValue": "Null",
|
||||||
|
"generateClientClasses": true,
|
||||||
|
"generateClientInterfaces": false,
|
||||||
|
"generateOptionalParameters": true,
|
||||||
|
"exportTypes": true,
|
||||||
|
"wrapDtoExceptions": false,
|
||||||
|
"exceptionClass": "TribufuTranslateError",
|
||||||
|
"clientBaseClass": "TribufuApiBase",
|
||||||
|
"wrapResponses": false,
|
||||||
|
"wrapResponseMethods": [],
|
||||||
|
"generateResponseClasses": true,
|
||||||
|
"responseClass": "SwaggerResponse",
|
||||||
|
"protectedMethods": [],
|
||||||
|
"configurationClass": null,
|
||||||
|
"useTransformOptionsMethod": true,
|
||||||
|
"useTransformResultMethod": false,
|
||||||
|
"generateDtoTypes": true,
|
||||||
|
"operationGenerationMode": "SingleClientFromOperationId",
|
||||||
|
"markOptionalProperties": false,
|
||||||
|
"generateCloneMethod": false,
|
||||||
|
"typeStyle": "Interface",
|
||||||
|
"enumStyle": "Enum",
|
||||||
|
"useLeafType": false,
|
||||||
|
"classTypes": [],
|
||||||
|
"extendedClasses": [],
|
||||||
|
"extensionCode": "../core/include.ts",
|
||||||
|
"generateDefaultValues": true,
|
||||||
|
"excludedTypeNames": [],
|
||||||
|
"excludedParameterNames": [],
|
||||||
|
"handleReferences": false,
|
||||||
|
"generateTypeCheckFunctions": false,
|
||||||
|
"generateConstructorInterface": true,
|
||||||
|
"convertConstructorInterfaceData": false,
|
||||||
|
"importRequiredTypes": true,
|
||||||
|
"useGetBaseUrlMethod": false,
|
||||||
|
"baseUrlTokenName": "API_BASE_URL",
|
||||||
|
"queryNullValue": "",
|
||||||
|
"useAbortSignal": false,
|
||||||
|
"inlineNamedDictionaries": false,
|
||||||
|
"inlineNamedAny": false,
|
||||||
|
"includeHttpContext": false,
|
||||||
|
"templateDirectory": null,
|
||||||
|
"serviceHost": null,
|
||||||
|
"serviceSchemes": null,
|
||||||
|
"output": "generated.ts",
|
||||||
|
"newLineBehavior": "LF"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Reference in New Issue
Block a user