Generate code with openapi-generator (#5)

This commit is contained in:
Guilherme Werner
2025-05-27 08:11:22 -03:00
committed by GitHub
parent 1a8ffe89bc
commit be21a2496e
67 changed files with 8992 additions and 3492 deletions

View File

@ -1,74 +0,0 @@
{
"runtime": "Default",
"defaultVariables": null,
"documentGenerator": {
"fromDocument": {
"json": "",
"url": "http://localhost:5000/openapi.json",
"output": null,
"newLineBehavior": "Auto"
}
},
"codeGenerators": {
"openApiToTypeScriptClient": {
"className": "TribufuApiGenerated",
"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": "TribufuApiError",
"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": "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"
}
}
}

View File

@ -1,102 +0,0 @@
// Copyright (c) Tribufu. All Rights Reserved.
// SPDX-License-Identifier: UNLICENSED
import { HttpHeaders } from "../http/headers";
import { JavaScriptRuntime } from "../node";
import { TRIBUFU_VERSION } from "..";
export abstract class TribufuApiBase {
protected apiKey: string | null = null;
/**
* Check if debug mode is enabled.
*
* - Debug mode is enabled if the environment variable `NODE_ENV` is set to `development`.
* - Debug mode is disabled by default.
* - Debug mode is disabled in the browser.
*
* @returns boolean
*/
public static debugEnabled(): boolean {
if (typeof process !== "undefined") {
return process.env.NODE_ENV === "development";
}
return false;
}
/**
* Detect the current JavaScript runtime.
*
* - This is used to determine if the code is running in a browser or in Node.js.
*
* @returns JavaScriptRuntime
*/
public static detectRuntime(): JavaScriptRuntime {
if (typeof window !== "undefined") {
return JavaScriptRuntime.Browser;
}
if (typeof process !== "undefined" && process?.versions?.node) {
return JavaScriptRuntime.Node;
}
return JavaScriptRuntime.Other;
}
/**
* Check if the current JavaScript runtime is a browser.
* @returns boolean
*/
public static isBrowser(): boolean {
return TribufuApiBase.detectRuntime() === JavaScriptRuntime.Browser;
}
/**
* Check if the current JavaScript runtime is Node.js.
* @returns boolean
*/
public static isNode(): boolean {
return TribufuApiBase.detectRuntime() === JavaScriptRuntime.Node;
}
/**
* Get the default headers for the Tribufu API.
* @returns HeaderMap
*/
protected static defaultHeaders(): HttpHeaders {
const headers = {};
headers["X-Tribufu-Library"] = "javascript";
headers["X-Tribufu-Version"] = TRIBUFU_VERSION;
return headers;
}
/**
* Get current headers with the api key or access token.
* @returns HeaderMap
*/
protected getHeaders(): HttpHeaders {
let headers = TribufuApiBase.defaultHeaders();
if (this.apiKey) {
headers["Authorization"] = `ApiKey ${this.apiKey}`;
return headers;
}
return headers;
}
/**
* Transform the options before sending the request.
* @param options
* @returns
*/
protected transformOptions(options: RequestInit) {
options.headers = {
...options.headers,
...this.getHeaders(),
};
return Promise.resolve(options);
}
}

File diff suppressed because it is too large Load Diff

View File

@ -1 +0,0 @@
import { TribufuApiBase } from "./base";

View File

@ -1,103 +0,0 @@
// Copyright (c) Tribufu. All Rights Reserved.
// SPDX-License-Identifier: MIT
import { TRIBUFU_API_URL } from "..";
import { TribufuApiBase } from "./base";
import { TribufuApiGenerated } from "./generated";
import { TribufuApiOptions } from "../options";
/**
* **Tribufu API**
*
* Use this class to interact with the Tribufu API.
*/
export class TribufuApi extends TribufuApiGenerated {
constructor(options?: TribufuApiOptions | null) {
const baseUrl = options?.baseUrl || TribufuApi.getBaseUrl();
const http = options?.fetch ? { fetch: options.fetch } : { fetch };
super(baseUrl, http);
this.apiKey = options?.apiKey || null;
}
/**
* Create a TribufuApi with the default options.
* @returns
*/
public static default(): TribufuApi {
return new TribufuApi();
}
/**
* Create a TribufuApi with the given api key.
*
* - A api key give you public read only access to the Tribufu API.
*
* @param apiKey
* @returns TribufuApi
*/
public static withApiKey(apiKey: string): TribufuApi {
return new TribufuApi({ apiKey });
}
/**
* Try to create a TribufuApi from environment variables.
*
* - This will only work if the environment variables are set.
*
* @param prefix A prefix for the environment variables. Default is `TRIBUFU`.
* @returns TribufuApi | null
* @example
* ```ts
* // process.env.TRIBUFU_API_KEY
* const api = TribufuApi.fromEnv();
* ```
*/
public static fromEnv(prefix?: string | null): TribufuApi | null {
if (typeof process === "undefined") {
return null;
}
const apiKey = process.env[`${prefix || "TRIBUFU"}_API_KEY`];
if (apiKey) {
return TribufuApi.withApiKey(apiKey);
}
return null;
}
/**
* Create a TribufuApi from environment variables or the default api.
*
* - This will fallback to the default api if the environment variables are not set.
*
* @param prefix A prefix for the environment variables. Default is `TRIBUFU`.
* @returns TribufuApi | null
* @example
* ```ts
* // process.env.TRIBUFU_API_KEY = null
* const api = TribufuApi.fromEnvOrDefault();
* ```
*/
public static fromEnvOrDefault(prefix: string = ""): TribufuApi {
return TribufuApi.fromEnv(prefix) || TribufuApi.default();
}
/**
* Get the base url for the Tribufu API.
*
* - The base url can be set using the environment variable `TRIBUFU_API_URL`.
* - The custom base url is only used if debug mode is enabled.
* - The default base url is `https://api.tribufu.com`.
*
* @returns string
*/
protected static getBaseUrl(): string {
if (typeof process === "undefined") {
return TRIBUFU_API_URL;
}
const baseUrl = process.env[`TRIBUFU_API_URL`] || null;
return TribufuApiBase.debugEnabled() && baseUrl ? baseUrl : TRIBUFU_API_URL;
}
}

View File

@ -1,23 +0,0 @@
// Copyright (c) Tribufu. All Rights Reserved.
// SPDX-License-Identifier: MIT
import { TribufuApi } from "./index";
/**
* **Tribufu API**
*
* Helper class to get a singleton instance of the Tribufu API.
*/
export class TribufuApiSingleton {
private static INSTANCE: TribufuApi | null = null;
private constructor() {}
public static getInstance(): TribufuApi {
if (!TribufuApiSingleton.INSTANCE) {
TribufuApiSingleton.INSTANCE = TribufuApi.fromEnvOrDefault();
}
return TribufuApiSingleton.INSTANCE;
}
}

File diff suppressed because it is too large Load Diff

3
src/apis/index.ts Normal file
View File

@ -0,0 +1,3 @@
/* tslint:disable */
/* eslint-disable */
export * from './TribufuGeneratedApi';

View File

@ -3,27 +3,28 @@
import packageJson from "../package.json";
/**
* The version of the Tribufu SDK.
*/
export const TRIBUFU_VERSION: string = packageJson.version;
/**
* The default Tribufu WEB URL.
*/
export const TRIBUFU_WEB_URL: string = "https://www.tribufu.com";
/**
* The default Tribufu API URL.
*/
export const TRIBUFU_API_URL: string = "https://api.tribufu.com";
/**
* The default Tribufu CDN URL.
*/
export const TRIBUFU_CDN_URL: string = "https://cdn.tribufu.com";
/**
* Tribufu copyright notice.
*/
export const TRIBUFU_COPYRIGHT = `© ${new Date().getFullYear()} Tribufu.`;
export const TRIBUFU_COPYRIGHT_WITH_RIGHTS = `${TRIBUFU_COPYRIGHT} All Rights Reserved.`;
export const TRIBUFU_COPYRIGHT_WITH_YEARS = `Copyright © 2016-${new Date().getFullYear()} Tribufu`;
export const TRIBUFU_API_URL: string = "https://api.tribufu.com";
export const TRIBUFU_COMMUNITY_URL: string = "https://www.tribufu.com";
export const TRIBUFU_DOCS_URL: string = "https://docs.tribufu.com";
export const TRIBUFU_GIT_URL: string = "https://git.tribufu.com";
export const TRIBUFU_MAVEN_URL: string = "https://mvn.tribufu.com";
export const TRIBUFU_R2_URL: string = "https://r2.tribufu.com";
export const TRIBUFU_S3_URL: string = "https://s3.tribufu.com";
export const TRIBUFU_STATUS_URL: string = "https://status.tribufu.com";
export const TRIBUFU_BLUESKY_URL: string = "https://bsky.app/profile/tribufu.com";
export const TRIBUFU_DISCORD_URL: string = "https://www.tribufu.com/discord";
export const TRIBUFU_GITHUB_URL: string = "https://github.com/tribufu";
export const TRIBUFU_GITLAB_URL: string = "https://gitlab.com/tribufu";
export const TRIBUFU_INSTAGRAM_URL: string = "https://www.instagram.com/tribufucom";
export const TRIBUFU_LINKEDIN_URL: string = "https://www.linkedin.com/company/11747611";
export const TRIBUFU_STEAM_URL: string = "https://steamcommunity.com/groups/tribufuservers";
export const TRIBUFU_TIKTOK_URL: string = "https://www.tiktok.com/@tribufuservers";
export const TRIBUFU_TWITCH_URL: string = "https://www.twitch.tv/tribufucom";
export const TRIBUFU_YOUTUBE_URL: string = "https://www.youtube.com/@tribufuservers";

View File

@ -1,11 +0,0 @@
// Copyright (c) Tribufu. All Rights Reserved.
// SPDX-License-Identifier: MIT
/**
* Http Headers
*
* Helper type to represent HTTP headers.
*/
export type HttpHeaders = {
[key: string]: string;
};

View File

@ -1,31 +1,201 @@
// Copyright (c) Tribufu. All Rights Reserved.
// SPDX-License-Identifier: MIT
import {
TRIBUFU_API_URL,
TRIBUFU_CDN_URL,
TRIBUFU_VERSION,
TRIBUFU_WEB_URL,
} from "./constants";
import { Configuration } from "./runtime";
import { TRIBUFU_API_URL, TRIBUFU_VERSION } from "./constants";
import { TribufuGeneratedApi } from "./apis/TribufuGeneratedApi";
import { JavaScriptRuntime } from "./node";
import { TribufuApi } from "./api";
import { TribufuApiOptions } from "./options";
import { TribufuApiSingleton } from "./api/singletion";
export * from "./constants";
export {
TRIBUFU_API_URL,
TRIBUFU_CDN_URL,
TRIBUFU_VERSION,
TRIBUFU_WEB_URL,
TribufuApi,
TribufuApiOptions,
TribufuApiSingleton,
};
/**
* **Tribufu API**
*
* Use this class to interact with the Tribufu API.
*/
export class TribufuApi extends TribufuGeneratedApi {
/**
* Create a TribufuApi with the given API key.
*
* @param apiKey The API key for authentication.
*/
constructor(apiKey: string | null = null) {
super(TribufuApi.createConfiguration(apiKey));
}
export * from "./api/base";
export * from "./api/generated";
export * from "./api/include";
export * from "./api/index";
export * from "./api/singletion";
export * from "./http/headers";
export * from "./node";
/**
* Create a default TribufuApi instance.
*
* @return TribufuApi instance with default config.
*/
public static default(): TribufuApi {
return new TribufuApi();
}
/**
* Create a TribufuApi with the given api key.
*
* - A api key give you public read only access to the Tribufu API.
*
* @param apiKey
* @returns TribufuApi
*/
public static withApiKey(apiKey: string): TribufuApi {
return new TribufuApi(apiKey);
}
/**
* Try to create a TribufuApi from environment variables.
*
* - This will only work if the environment variables are set.
*
* @param prefix A prefix for the environment variables. Default is `TRIBUFU`.
* @returns TribufuApi | null
* @example
* ```ts
* // process.env.TRIBUFU_API_KEY
* const api = TribufuApi.fromEnv();
* ```
*/
public static fromEnv(prefix?: string | null): TribufuApi | null {
if (typeof process === "undefined") {
return null;
}
const apiKey = process.env[`${prefix || "TRIBUFU"}_API_KEY`];
if (apiKey) {
return TribufuApi.withApiKey(apiKey);
}
return null;
}
/**
* Create a TribufuApi from environment variables or the default api.
*
* - This will fallback to the default api if the environment variables are not set.
*
* @param prefix A prefix for the environment variables. Default is `TRIBUFU`.
* @returns TribufuApi | null
* @example
* ```ts
* // process.env.TRIBUFU_API_KEY = null
* const api = TribufuApi.fromEnvOrDefault();
* ```
*/
public static fromEnvOrDefault(prefix: string = ""): TribufuApi {
return TribufuApi.fromEnv(prefix) || TribufuApi.default();
}
/**
* Creates a configuration for the Tribufu API client.
*/
private static createConfiguration(apiKey: string | null): Configuration {
const basePath = this.getBaseUrl();
const headers: Record<string, string> = {
"User-Agent": this.getUserAgent(),
};
if (apiKey) {
headers["Authorization"] = `ApiKey ${apiKey}`;
}
return new Configuration({
basePath,
headers,
});
}
/**
* Get the base url for the Tribufu API.
*
* - The base url can be set using the environment variable `TRIBUFU_API_URL`.
* - The custom base url is only used if debug mode is enabled.
* - The default base url is `https://api.tribufu.com`.
*
* @returns string
*/
protected static getBaseUrl(): string {
if (typeof process === "undefined") {
return TRIBUFU_API_URL;
}
const baseUrl = process.env[`TRIBUFU_API_URL`] || null;
return this.debugEnabled() && baseUrl ? baseUrl : TRIBUFU_API_URL;
}
/**
* Get the version of the Tribufu client.
*/
public static getVersion(): string {
try {
return TRIBUFU_VERSION;
} catch {
return "dev";
}
}
/**
* Get the User-Agent string for the API.
*/
private static getUserAgent(): string {
const version = this.getVersion();
const os = process.platform;
const arch = process.arch;
const nodeVersion = process.version;
return `Tribufu/${version} (Node.js ${nodeVersion}; ${os}; ${arch})`;
}
/**
* Check if debug mode is enabled.
*
* - Debug mode is enabled if the environment variable `NODE_ENV` is set to `development`.
* - Debug mode is disabled by default.
* - Debug mode is disabled in the browser.
*
* @returns boolean
*/
public static debugEnabled(): boolean {
if (typeof process !== "undefined") {
return process.env.NODE_ENV === "development";
}
return false;
}
/**
* Detect the current JavaScript runtime.
*
* - This is used to determine if the code is running in a browser or in Node.js.
*
* @returns JavaScriptRuntime
*/
public static detectRuntime(): JavaScriptRuntime {
if (typeof window !== "undefined") {
return JavaScriptRuntime.Browser;
}
if (typeof process !== "undefined" && process?.versions?.node) {
return JavaScriptRuntime.Node;
}
return JavaScriptRuntime.Other;
}
/**
* Check if the current JavaScript runtime is a browser.
* @returns boolean
*/
public static isBrowser(): boolean {
return this.detectRuntime() === JavaScriptRuntime.Browser;
}
/**
* Check if the current JavaScript runtime is Node.js.
* @returns boolean
*/
public static isNode(): boolean {
return this.detectRuntime() === JavaScriptRuntime.Node;
}
}

131
src/models/Account.ts Normal file
View File

@ -0,0 +1,131 @@
/* tslint:disable */
/* eslint-disable */
/**
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* Contact: contact@tribufu.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { mapValues } from '../runtime';
import type { LoginProvider } from './LoginProvider';
import {
LoginProviderFromJSON,
LoginProviderFromJSONTyped,
LoginProviderToJSON,
LoginProviderToJSONTyped,
} from './LoginProvider';
/**
*
* @export
* @interface Account
*/
export interface Account {
/**
*
* @type {string}
* @memberof Account
*/
id?: string | null;
/**
*
* @type {string}
* @memberof Account
*/
name?: string | null;
/**
*
* @type {LoginProvider}
* @memberof Account
*/
provider?: LoginProvider;
/**
*
* @type {string}
* @memberof Account
*/
userId?: string;
/**
*
* @type {boolean}
* @memberof Account
*/
authorized?: boolean;
/**
*
* @type {any}
* @memberof Account
*/
fields?: any | null;
/**
*
* @type {Date}
* @memberof Account
*/
created?: Date;
/**
*
* @type {Date}
* @memberof Account
*/
updated?: Date | null;
}
/**
* Check if a given object implements the Account interface.
*/
export function instanceOfAccount(value: object): value is Account {
return true;
}
export function AccountFromJSON(json: any): Account {
return AccountFromJSONTyped(json, false);
}
export function AccountFromJSONTyped(json: any, ignoreDiscriminator: boolean): Account {
if (json == null) {
return json;
}
return {
'id': json['id'] == null ? undefined : json['id'],
'name': json['name'] == null ? undefined : json['name'],
'provider': json['provider'] == null ? undefined : LoginProviderFromJSON(json['provider']),
'userId': json['user_id'] == null ? undefined : json['user_id'],
'authorized': json['authorized'] == null ? undefined : json['authorized'],
'fields': json['fields'] == null ? undefined : json['fields'],
'created': json['created'] == null ? undefined : (new Date(json['created'])),
'updated': json['updated'] == null ? undefined : (new Date(json['updated'])),
};
}
export function AccountToJSON(json: any): Account {
return AccountToJSONTyped(json, false);
}
export function AccountToJSONTyped(value?: Account | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
return {
'id': value['id'],
'name': value['name'],
'provider': LoginProviderToJSON(value['provider']),
'user_id': value['userId'],
'authorized': value['authorized'],
'fields': value['fields'],
'created': value['created'] == null ? undefined : ((value['created']).toISOString()),
'updated': value['updated'] == null ? undefined : ((value['updated'] as any).toISOString()),
};
}

227
src/models/Application.ts Normal file
View File

@ -0,0 +1,227 @@
/* tslint:disable */
/* eslint-disable */
/**
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* Contact: contact@tribufu.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { mapValues } from '../runtime';
import type { ApplicationType } from './ApplicationType';
import {
ApplicationTypeFromJSON,
ApplicationTypeFromJSONTyped,
ApplicationTypeToJSON,
ApplicationTypeToJSONTyped,
} from './ApplicationType';
/**
*
* @export
* @interface Application
*/
export interface Application {
/**
*
* @type {string}
* @memberof Application
*/
id?: string;
/**
*
* @type {string}
* @memberof Application
*/
name?: string | null;
/**
*
* @type {string}
* @memberof Application
*/
description?: string | null;
/**
*
* @type {ApplicationType}
* @memberof Application
*/
type?: ApplicationType;
/**
*
* @type {string}
* @memberof Application
*/
organizationId?: string | null;
/**
*
* @type {string}
* @memberof Application
*/
iconUrl?: string | null;
/**
*
* @type {string}
* @memberof Application
*/
bannerUrl?: string | null;
/**
*
* @type {string}
* @memberof Application
*/
capsuleImageUrl?: string | null;
/**
*
* @type {string}
* @memberof Application
*/
libraryImageUrl?: string | null;
/**
*
* @type {string}
* @memberof Application
*/
parentId?: string | null;
/**
*
* @type {string}
* @memberof Application
*/
slug?: string | null;
/**
*
* @type {number}
* @memberof Application
*/
visibility?: number;
/**
*
* @type {string}
* @memberof Application
*/
password?: string | null;
/**
*
* @type {number}
* @memberof Application
*/
primary?: number;
/**
*
* @type {number}
* @memberof Application
*/
userCount?: number;
/**
*
* @type {number}
* @memberof Application
*/
achievementCount?: number;
/**
*
* @type {number}
* @memberof Application
*/
badgeCount?: number | null;
/**
*
* @type {number}
* @memberof Application
*/
downloadCount?: number;
/**
*
* @type {Date}
* @memberof Application
*/
created?: Date;
/**
*
* @type {Date}
* @memberof Application
*/
updated?: Date | null;
}
/**
* Check if a given object implements the Application interface.
*/
export function instanceOfApplication(value: object): value is Application {
return true;
}
export function ApplicationFromJSON(json: any): Application {
return ApplicationFromJSONTyped(json, false);
}
export function ApplicationFromJSONTyped(json: any, ignoreDiscriminator: boolean): Application {
if (json == null) {
return json;
}
return {
'id': json['id'] == null ? undefined : json['id'],
'name': json['name'] == null ? undefined : json['name'],
'description': json['description'] == null ? undefined : json['description'],
'type': json['type'] == null ? undefined : ApplicationTypeFromJSON(json['type']),
'organizationId': json['organization_id'] == null ? undefined : json['organization_id'],
'iconUrl': json['icon_url'] == null ? undefined : json['icon_url'],
'bannerUrl': json['banner_url'] == null ? undefined : json['banner_url'],
'capsuleImageUrl': json['capsule_image_url'] == null ? undefined : json['capsule_image_url'],
'libraryImageUrl': json['library_image_url'] == null ? undefined : json['library_image_url'],
'parentId': json['parent_id'] == null ? undefined : json['parent_id'],
'slug': json['slug'] == null ? undefined : json['slug'],
'visibility': json['visibility'] == null ? undefined : json['visibility'],
'password': json['password'] == null ? undefined : json['password'],
'primary': json['primary'] == null ? undefined : json['primary'],
'userCount': json['user_count'] == null ? undefined : json['user_count'],
'achievementCount': json['achievement_count'] == null ? undefined : json['achievement_count'],
'badgeCount': json['badge_count'] == null ? undefined : json['badge_count'],
'downloadCount': json['download_count'] == null ? undefined : json['download_count'],
'created': json['created'] == null ? undefined : (new Date(json['created'])),
'updated': json['updated'] == null ? undefined : (new Date(json['updated'])),
};
}
export function ApplicationToJSON(json: any): Application {
return ApplicationToJSONTyped(json, false);
}
export function ApplicationToJSONTyped(value?: Application | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
return {
'id': value['id'],
'name': value['name'],
'description': value['description'],
'type': ApplicationTypeToJSON(value['type']),
'organization_id': value['organizationId'],
'icon_url': value['iconUrl'],
'banner_url': value['bannerUrl'],
'capsule_image_url': value['capsuleImageUrl'],
'library_image_url': value['libraryImageUrl'],
'parent_id': value['parentId'],
'slug': value['slug'],
'visibility': value['visibility'],
'password': value['password'],
'primary': value['primary'],
'user_count': value['userCount'],
'achievement_count': value['achievementCount'],
'badge_count': value['badgeCount'],
'download_count': value['downloadCount'],
'created': value['created'] == null ? undefined : ((value['created']).toISOString()),
'updated': value['updated'] == null ? undefined : ((value['updated'] as any).toISOString()),
};
}

View File

@ -0,0 +1,53 @@
/* tslint:disable */
/* eslint-disable */
/**
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* Contact: contact@tribufu.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/**
*
* @export
*/
export const ApplicationType = {
Application: 'application',
Game: 'game'
} as const;
export type ApplicationType = typeof ApplicationType[keyof typeof ApplicationType];
export function instanceOfApplicationType(value: any): boolean {
for (const key in ApplicationType) {
if (Object.prototype.hasOwnProperty.call(ApplicationType, key)) {
if (ApplicationType[key as keyof typeof ApplicationType] === value) {
return true;
}
}
}
return false;
}
export function ApplicationTypeFromJSON(json: any): ApplicationType {
return ApplicationTypeFromJSONTyped(json, false);
}
export function ApplicationTypeFromJSONTyped(json: any, ignoreDiscriminator: boolean): ApplicationType {
return json as ApplicationType;
}
export function ApplicationTypeToJSON(value?: ApplicationType | null): any {
return value as any;
}
export function ApplicationTypeToJSONTyped(value: any, ignoreDiscriminator: boolean): ApplicationType {
return value as ApplicationType;
}

View File

@ -0,0 +1,130 @@
/* tslint:disable */
/* eslint-disable */
/**
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* Contact: contact@tribufu.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { mapValues } from '../runtime';
import type { CodeChallengeMethod } from './CodeChallengeMethod';
import {
CodeChallengeMethodFromJSON,
CodeChallengeMethodFromJSONTyped,
CodeChallengeMethodToJSON,
CodeChallengeMethodToJSONTyped,
} from './CodeChallengeMethod';
import type { ResponseType } from './ResponseType';
import {
ResponseTypeFromJSON,
ResponseTypeFromJSONTyped,
ResponseTypeToJSON,
ResponseTypeToJSONTyped,
} from './ResponseType';
/**
*
* @export
* @interface AuthorizeRequest
*/
export interface AuthorizeRequest {
/**
*
* @type {ResponseType}
* @memberof AuthorizeRequest
*/
responseType?: ResponseType;
/**
*
* @type {string}
* @memberof AuthorizeRequest
*/
clientId?: string | null;
/**
*
* @type {string}
* @memberof AuthorizeRequest
*/
codeChallenge?: string | null;
/**
*
* @type {CodeChallengeMethod}
* @memberof AuthorizeRequest
*/
codeChallengeMethod?: CodeChallengeMethod;
/**
*
* @type {string}
* @memberof AuthorizeRequest
*/
redirectUri?: string | null;
/**
*
* @type {string}
* @memberof AuthorizeRequest
*/
scope?: string | null;
/**
*
* @type {string}
* @memberof AuthorizeRequest
*/
state?: string | null;
}
/**
* Check if a given object implements the AuthorizeRequest interface.
*/
export function instanceOfAuthorizeRequest(value: object): value is AuthorizeRequest {
return true;
}
export function AuthorizeRequestFromJSON(json: any): AuthorizeRequest {
return AuthorizeRequestFromJSONTyped(json, false);
}
export function AuthorizeRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): AuthorizeRequest {
if (json == null) {
return json;
}
return {
'responseType': json['response_type'] == null ? undefined : ResponseTypeFromJSON(json['response_type']),
'clientId': json['client_id'] == null ? undefined : json['client_id'],
'codeChallenge': json['code_challenge'] == null ? undefined : json['code_challenge'],
'codeChallengeMethod': json['code_challenge_method'] == null ? undefined : CodeChallengeMethodFromJSON(json['code_challenge_method']),
'redirectUri': json['redirect_uri'] == null ? undefined : json['redirect_uri'],
'scope': json['scope'] == null ? undefined : json['scope'],
'state': json['state'] == null ? undefined : json['state'],
};
}
export function AuthorizeRequestToJSON(json: any): AuthorizeRequest {
return AuthorizeRequestToJSONTyped(json, false);
}
export function AuthorizeRequestToJSONTyped(value?: AuthorizeRequest | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
return {
'response_type': ResponseTypeToJSON(value['responseType']),
'client_id': value['clientId'],
'code_challenge': value['codeChallenge'],
'code_challenge_method': CodeChallengeMethodToJSON(value['codeChallengeMethod']),
'redirect_uri': value['redirectUri'],
'scope': value['scope'],
'state': value['state'],
};
}

View File

@ -0,0 +1,53 @@
/* tslint:disable */
/* eslint-disable */
/**
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* Contact: contact@tribufu.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/**
*
* @export
*/
export const CodeChallengeMethod = {
Plain: 'plain',
S256: 'S256'
} as const;
export type CodeChallengeMethod = typeof CodeChallengeMethod[keyof typeof CodeChallengeMethod];
export function instanceOfCodeChallengeMethod(value: any): boolean {
for (const key in CodeChallengeMethod) {
if (Object.prototype.hasOwnProperty.call(CodeChallengeMethod, key)) {
if (CodeChallengeMethod[key as keyof typeof CodeChallengeMethod] === value) {
return true;
}
}
}
return false;
}
export function CodeChallengeMethodFromJSON(json: any): CodeChallengeMethod {
return CodeChallengeMethodFromJSONTyped(json, false);
}
export function CodeChallengeMethodFromJSONTyped(json: any, ignoreDiscriminator: boolean): CodeChallengeMethod {
return json as CodeChallengeMethod;
}
export function CodeChallengeMethodToJSON(value?: CodeChallengeMethod | null): any {
return value as any;
}
export function CodeChallengeMethodToJSONTyped(value: any, ignoreDiscriminator: boolean): CodeChallengeMethod {
return value as CodeChallengeMethod;
}

View File

@ -0,0 +1,73 @@
/* tslint:disable */
/* eslint-disable */
/**
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* Contact: contact@tribufu.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { mapValues } from '../runtime';
/**
*
* @export
* @interface CryptoViewModel
*/
export interface CryptoViewModel {
/**
*
* @type {string}
* @memberof CryptoViewModel
*/
encoded?: string | null;
/**
*
* @type {string}
* @memberof CryptoViewModel
*/
decoded?: string | null;
}
/**
* Check if a given object implements the CryptoViewModel interface.
*/
export function instanceOfCryptoViewModel(value: object): value is CryptoViewModel {
return true;
}
export function CryptoViewModelFromJSON(json: any): CryptoViewModel {
return CryptoViewModelFromJSONTyped(json, false);
}
export function CryptoViewModelFromJSONTyped(json: any, ignoreDiscriminator: boolean): CryptoViewModel {
if (json == null) {
return json;
}
return {
'encoded': json['encoded'] == null ? undefined : json['encoded'],
'decoded': json['decoded'] == null ? undefined : json['decoded'],
};
}
export function CryptoViewModelToJSON(json: any): CryptoViewModel {
return CryptoViewModelToJSONTyped(json, false);
}
export function CryptoViewModelToJSONTyped(value?: CryptoViewModel | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
return {
'encoded': value['encoded'],
'decoded': value['decoded'],
};
}

315
src/models/Game.ts Normal file
View File

@ -0,0 +1,315 @@
/* tslint:disable */
/* eslint-disable */
/**
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* Contact: contact@tribufu.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { mapValues } from '../runtime';
import type { ApplicationType } from './ApplicationType';
import {
ApplicationTypeFromJSON,
ApplicationTypeFromJSONTyped,
ApplicationTypeToJSON,
ApplicationTypeToJSONTyped,
} from './ApplicationType';
/**
*
* @export
* @interface Game
*/
export interface Game {
/**
*
* @type {number}
* @memberof Game
*/
gamePort?: number | null;
/**
*
* @type {number}
* @memberof Game
*/
queryPort?: number | null;
/**
*
* @type {number}
* @memberof Game
*/
rconPort?: number | null;
/**
*
* @type {number}
* @memberof Game
*/
serverCount?: number;
/**
*
* @type {number}
* @memberof Game
*/
steamAppId?: number | null;
/**
*
* @type {number}
* @memberof Game
*/
steamServerAppId?: number | null;
/**
*
* @type {boolean}
* @memberof Game
*/
enableServers?: boolean;
/**
*
* @type {string}
* @memberof Game
*/
rustGamedigId?: string | null;
/**
*
* @type {string}
* @memberof Game
*/
nodeGamedigId?: string | null;
/**
*
* @type {string}
* @memberof Game
*/
serverConnectUrl?: string | null;
/**
*
* @type {string}
* @memberof Game
*/
serverTags?: string | null;
/**
*
* @type {string}
* @memberof Game
*/
id?: string;
/**
*
* @type {string}
* @memberof Game
*/
name?: string | null;
/**
*
* @type {string}
* @memberof Game
*/
description?: string | null;
/**
*
* @type {ApplicationType}
* @memberof Game
*/
type?: ApplicationType;
/**
*
* @type {string}
* @memberof Game
*/
organizationId?: string | null;
/**
*
* @type {string}
* @memberof Game
*/
iconUrl?: string | null;
/**
*
* @type {string}
* @memberof Game
*/
bannerUrl?: string | null;
/**
*
* @type {string}
* @memberof Game
*/
capsuleImageUrl?: string | null;
/**
*
* @type {string}
* @memberof Game
*/
libraryImageUrl?: string | null;
/**
*
* @type {string}
* @memberof Game
*/
parentId?: string | null;
/**
*
* @type {string}
* @memberof Game
*/
slug?: string | null;
/**
*
* @type {number}
* @memberof Game
*/
visibility?: number;
/**
*
* @type {string}
* @memberof Game
*/
password?: string | null;
/**
*
* @type {number}
* @memberof Game
*/
primary?: number;
/**
*
* @type {number}
* @memberof Game
*/
userCount?: number;
/**
*
* @type {number}
* @memberof Game
*/
achievementCount?: number;
/**
*
* @type {number}
* @memberof Game
*/
badgeCount?: number | null;
/**
*
* @type {number}
* @memberof Game
*/
downloadCount?: number;
/**
*
* @type {Date}
* @memberof Game
*/
created?: Date;
/**
*
* @type {Date}
* @memberof Game
*/
updated?: Date | null;
}
/**
* Check if a given object implements the Game interface.
*/
export function instanceOfGame(value: object): value is Game {
return true;
}
export function GameFromJSON(json: any): Game {
return GameFromJSONTyped(json, false);
}
export function GameFromJSONTyped(json: any, ignoreDiscriminator: boolean): Game {
if (json == null) {
return json;
}
return {
'gamePort': json['game_port'] == null ? undefined : json['game_port'],
'queryPort': json['query_port'] == null ? undefined : json['query_port'],
'rconPort': json['rcon_port'] == null ? undefined : json['rcon_port'],
'serverCount': json['server_count'] == null ? undefined : json['server_count'],
'steamAppId': json['steam_app_id'] == null ? undefined : json['steam_app_id'],
'steamServerAppId': json['steam_server_app_id'] == null ? undefined : json['steam_server_app_id'],
'enableServers': json['enable_servers'] == null ? undefined : json['enable_servers'],
'rustGamedigId': json['rust_gamedig_id'] == null ? undefined : json['rust_gamedig_id'],
'nodeGamedigId': json['node_gamedig_id'] == null ? undefined : json['node_gamedig_id'],
'serverConnectUrl': json['server_connect_url'] == null ? undefined : json['server_connect_url'],
'serverTags': json['server_tags'] == null ? undefined : json['server_tags'],
'id': json['id'] == null ? undefined : json['id'],
'name': json['name'] == null ? undefined : json['name'],
'description': json['description'] == null ? undefined : json['description'],
'type': json['type'] == null ? undefined : ApplicationTypeFromJSON(json['type']),
'organizationId': json['organization_id'] == null ? undefined : json['organization_id'],
'iconUrl': json['icon_url'] == null ? undefined : json['icon_url'],
'bannerUrl': json['banner_url'] == null ? undefined : json['banner_url'],
'capsuleImageUrl': json['capsule_image_url'] == null ? undefined : json['capsule_image_url'],
'libraryImageUrl': json['library_image_url'] == null ? undefined : json['library_image_url'],
'parentId': json['parent_id'] == null ? undefined : json['parent_id'],
'slug': json['slug'] == null ? undefined : json['slug'],
'visibility': json['visibility'] == null ? undefined : json['visibility'],
'password': json['password'] == null ? undefined : json['password'],
'primary': json['primary'] == null ? undefined : json['primary'],
'userCount': json['user_count'] == null ? undefined : json['user_count'],
'achievementCount': json['achievement_count'] == null ? undefined : json['achievement_count'],
'badgeCount': json['badge_count'] == null ? undefined : json['badge_count'],
'downloadCount': json['download_count'] == null ? undefined : json['download_count'],
'created': json['created'] == null ? undefined : (new Date(json['created'])),
'updated': json['updated'] == null ? undefined : (new Date(json['updated'])),
};
}
export function GameToJSON(json: any): Game {
return GameToJSONTyped(json, false);
}
export function GameToJSONTyped(value?: Game | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
return {
'game_port': value['gamePort'],
'query_port': value['queryPort'],
'rcon_port': value['rconPort'],
'server_count': value['serverCount'],
'steam_app_id': value['steamAppId'],
'steam_server_app_id': value['steamServerAppId'],
'enable_servers': value['enableServers'],
'rust_gamedig_id': value['rustGamedigId'],
'node_gamedig_id': value['nodeGamedigId'],
'server_connect_url': value['serverConnectUrl'],
'server_tags': value['serverTags'],
'id': value['id'],
'name': value['name'],
'description': value['description'],
'type': ApplicationTypeToJSON(value['type']),
'organization_id': value['organizationId'],
'icon_url': value['iconUrl'],
'banner_url': value['bannerUrl'],
'capsule_image_url': value['capsuleImageUrl'],
'library_image_url': value['libraryImageUrl'],
'parent_id': value['parentId'],
'slug': value['slug'],
'visibility': value['visibility'],
'password': value['password'],
'primary': value['primary'],
'user_count': value['userCount'],
'achievement_count': value['achievementCount'],
'badge_count': value['badgeCount'],
'download_count': value['downloadCount'],
'created': value['created'] == null ? undefined : ((value['created']).toISOString()),
'updated': value['updated'] == null ? undefined : ((value['updated'] as any).toISOString()),
};
}

315
src/models/GameServer.ts Normal file
View File

@ -0,0 +1,315 @@
/* tslint:disable */
/* eslint-disable */
/**
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* Contact: contact@tribufu.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { mapValues } from '../runtime';
import type { ServerStatus } from './ServerStatus';
import {
ServerStatusFromJSON,
ServerStatusFromJSONTyped,
ServerStatusToJSON,
ServerStatusToJSONTyped,
} from './ServerStatus';
/**
*
* @export
* @interface GameServer
*/
export interface GameServer {
/**
*
* @type {string}
* @memberof GameServer
*/
id?: string;
/**
*
* @type {string}
* @memberof GameServer
*/
name?: string | null;
/**
*
* @type {string}
* @memberof GameServer
*/
description?: string | null;
/**
*
* @type {string}
* @memberof GameServer
*/
address?: string | null;
/**
*
* @type {number}
* @memberof GameServer
*/
gamePort?: number | null;
/**
*
* @type {number}
* @memberof GameServer
*/
queryPort?: number;
/**
*
* @type {string}
* @memberof GameServer
*/
gameId?: string;
/**
*
* @type {string}
* @memberof GameServer
*/
gameIconUrl?: string | null;
/**
*
* @type {string}
* @memberof GameServer
*/
version?: string | null;
/**
*
* @type {boolean}
* @memberof GameServer
*/
featured?: boolean;
/**
*
* @type {string}
* @memberof GameServer
*/
clusterId?: string | null;
/**
*
* @type {string}
* @memberof GameServer
*/
websiteUrl?: string | null;
/**
*
* @type {string}
* @memberof GameServer
*/
bannerUrl?: string | null;
/**
*
* @type {string}
* @memberof GameServer
*/
ownerId?: string | null;
/**
*
* @type {number}
* @memberof GameServer
*/
uptime?: number;
/**
*
* @type {ServerStatus}
* @memberof GameServer
*/
status?: ServerStatus;
/**
*
* @type {number}
* @memberof GameServer
*/
ping?: number | null;
/**
*
* @type {string}
* @memberof GameServer
*/
map?: string | null;
/**
*
* @type {number}
* @memberof GameServer
*/
usedSlots?: number | null;
/**
*
* @type {number}
* @memberof GameServer
*/
maxSlots?: number | null;
/**
*
* @type {string}
* @memberof GameServer
*/
motd?: string | null;
/**
*
* @type {string}
* @memberof GameServer
*/
players?: string | null;
/**
*
* @type {Date}
* @memberof GameServer
*/
lastOnline?: Date | null;
/**
*
* @type {string}
* @memberof GameServer
*/
country?: string | null;
/**
*
* @type {boolean}
* @memberof GameServer
*/
steam?: boolean;
/**
*
* @type {string}
* @memberof GameServer
*/
discordServerId?: string | null;
/**
*
* @type {string}
* @memberof GameServer
*/
youtubeVideoUrl?: string | null;
/**
*
* @type {string}
* @memberof GameServer
*/
tags?: string | null;
/**
*
* @type {number}
* @memberof GameServer
*/
commentCount?: number;
/**
*
* @type {Date}
* @memberof GameServer
*/
created?: Date;
/**
*
* @type {Date}
* @memberof GameServer
*/
updated?: Date | null;
}
/**
* Check if a given object implements the GameServer interface.
*/
export function instanceOfGameServer(value: object): value is GameServer {
return true;
}
export function GameServerFromJSON(json: any): GameServer {
return GameServerFromJSONTyped(json, false);
}
export function GameServerFromJSONTyped(json: any, ignoreDiscriminator: boolean): GameServer {
if (json == null) {
return json;
}
return {
'id': json['id'] == null ? undefined : json['id'],
'name': json['name'] == null ? undefined : json['name'],
'description': json['description'] == null ? undefined : json['description'],
'address': json['address'] == null ? undefined : json['address'],
'gamePort': json['game_port'] == null ? undefined : json['game_port'],
'queryPort': json['query_port'] == null ? undefined : json['query_port'],
'gameId': json['game_id'] == null ? undefined : json['game_id'],
'gameIconUrl': json['game_icon_url'] == null ? undefined : json['game_icon_url'],
'version': json['version'] == null ? undefined : json['version'],
'featured': json['featured'] == null ? undefined : json['featured'],
'clusterId': json['cluster_id'] == null ? undefined : json['cluster_id'],
'websiteUrl': json['website_url'] == null ? undefined : json['website_url'],
'bannerUrl': json['banner_url'] == null ? undefined : json['banner_url'],
'ownerId': json['owner_id'] == null ? undefined : json['owner_id'],
'uptime': json['uptime'] == null ? undefined : json['uptime'],
'status': json['status'] == null ? undefined : ServerStatusFromJSON(json['status']),
'ping': json['ping'] == null ? undefined : json['ping'],
'map': json['map'] == null ? undefined : json['map'],
'usedSlots': json['used_slots'] == null ? undefined : json['used_slots'],
'maxSlots': json['max_slots'] == null ? undefined : json['max_slots'],
'motd': json['motd'] == null ? undefined : json['motd'],
'players': json['players'] == null ? undefined : json['players'],
'lastOnline': json['last_online'] == null ? undefined : (new Date(json['last_online'])),
'country': json['country'] == null ? undefined : json['country'],
'steam': json['steam'] == null ? undefined : json['steam'],
'discordServerId': json['discord_server_id'] == null ? undefined : json['discord_server_id'],
'youtubeVideoUrl': json['youtube_video_url'] == null ? undefined : json['youtube_video_url'],
'tags': json['tags'] == null ? undefined : json['tags'],
'commentCount': json['comment_count'] == null ? undefined : json['comment_count'],
'created': json['created'] == null ? undefined : (new Date(json['created'])),
'updated': json['updated'] == null ? undefined : (new Date(json['updated'])),
};
}
export function GameServerToJSON(json: any): GameServer {
return GameServerToJSONTyped(json, false);
}
export function GameServerToJSONTyped(value?: GameServer | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
return {
'id': value['id'],
'name': value['name'],
'description': value['description'],
'address': value['address'],
'game_port': value['gamePort'],
'query_port': value['queryPort'],
'game_id': value['gameId'],
'game_icon_url': value['gameIconUrl'],
'version': value['version'],
'featured': value['featured'],
'cluster_id': value['clusterId'],
'website_url': value['websiteUrl'],
'banner_url': value['bannerUrl'],
'owner_id': value['ownerId'],
'uptime': value['uptime'],
'status': ServerStatusToJSON(value['status']),
'ping': value['ping'],
'map': value['map'],
'used_slots': value['usedSlots'],
'max_slots': value['maxSlots'],
'motd': value['motd'],
'players': value['players'],
'last_online': value['lastOnline'] == null ? undefined : ((value['lastOnline'] as any).toISOString()),
'country': value['country'],
'steam': value['steam'],
'discord_server_id': value['discordServerId'],
'youtube_video_url': value['youtubeVideoUrl'],
'tags': value['tags'],
'comment_count': value['commentCount'],
'created': value['created'] == null ? undefined : ((value['created']).toISOString()),
'updated': value['updated'] == null ? undefined : ((value['updated'] as any).toISOString()),
};
}

View File

@ -0,0 +1,169 @@
/* tslint:disable */
/* eslint-disable */
/**
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* Contact: contact@tribufu.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { mapValues } from '../runtime';
/**
*
* @export
* @interface GameServerCluster
*/
export interface GameServerCluster {
/**
*
* @type {string}
* @memberof GameServerCluster
*/
id?: string;
/**
*
* @type {string}
* @memberof GameServerCluster
*/
name?: string | null;
/**
*
* @type {string}
* @memberof GameServerCluster
*/
description?: string | null;
/**
*
* @type {string}
* @memberof GameServerCluster
*/
gameId?: string;
/**
*
* @type {string}
* @memberof GameServerCluster
*/
websiteUrl?: string | null;
/**
*
* @type {string}
* @memberof GameServerCluster
*/
bannerUrl?: string | null;
/**
*
* @type {string}
* @memberof GameServerCluster
*/
ownerId?: string;
/**
*
* @type {string}
* @memberof GameServerCluster
*/
discordServerId?: string | null;
/**
*
* @type {string}
* @memberof GameServerCluster
*/
youtubeVideoUrl?: string | null;
/**
*
* @type {string}
* @memberof GameServerCluster
*/
tags?: string | null;
/**
*
* @type {number}
* @memberof GameServerCluster
*/
commentCount?: number;
/**
*
* @type {number}
* @memberof GameServerCluster
*/
serverCount?: number;
/**
*
* @type {Date}
* @memberof GameServerCluster
*/
created?: Date;
/**
*
* @type {Date}
* @memberof GameServerCluster
*/
updated?: Date | null;
}
/**
* Check if a given object implements the GameServerCluster interface.
*/
export function instanceOfGameServerCluster(value: object): value is GameServerCluster {
return true;
}
export function GameServerClusterFromJSON(json: any): GameServerCluster {
return GameServerClusterFromJSONTyped(json, false);
}
export function GameServerClusterFromJSONTyped(json: any, ignoreDiscriminator: boolean): GameServerCluster {
if (json == null) {
return json;
}
return {
'id': json['id'] == null ? undefined : json['id'],
'name': json['name'] == null ? undefined : json['name'],
'description': json['description'] == null ? undefined : json['description'],
'gameId': json['game_id'] == null ? undefined : json['game_id'],
'websiteUrl': json['website_url'] == null ? undefined : json['website_url'],
'bannerUrl': json['banner_url'] == null ? undefined : json['banner_url'],
'ownerId': json['owner_id'] == null ? undefined : json['owner_id'],
'discordServerId': json['discord_server_id'] == null ? undefined : json['discord_server_id'],
'youtubeVideoUrl': json['youtube_video_url'] == null ? undefined : json['youtube_video_url'],
'tags': json['tags'] == null ? undefined : json['tags'],
'commentCount': json['comment_count'] == null ? undefined : json['comment_count'],
'serverCount': json['server_count'] == null ? undefined : json['server_count'],
'created': json['created'] == null ? undefined : (new Date(json['created'])),
'updated': json['updated'] == null ? undefined : (new Date(json['updated'])),
};
}
export function GameServerClusterToJSON(json: any): GameServerCluster {
return GameServerClusterToJSONTyped(json, false);
}
export function GameServerClusterToJSONTyped(value?: GameServerCluster | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
return {
'id': value['id'],
'name': value['name'],
'description': value['description'],
'game_id': value['gameId'],
'website_url': value['websiteUrl'],
'banner_url': value['bannerUrl'],
'owner_id': value['ownerId'],
'discord_server_id': value['discordServerId'],
'youtube_video_url': value['youtubeVideoUrl'],
'tags': value['tags'],
'comment_count': value['commentCount'],
'server_count': value['serverCount'],
'created': value['created'] == null ? undefined : ((value['created']).toISOString()),
'updated': value['updated'] == null ? undefined : ((value['updated'] as any).toISOString()),
};
}

55
src/models/GrantType.ts Normal file
View File

@ -0,0 +1,55 @@
/* tslint:disable */
/* eslint-disable */
/**
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* Contact: contact@tribufu.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/**
*
* @export
*/
export const GrantType = {
AuthorizationCode: 'authorization_code',
ClientCredentials: 'client_credentials',
Password: 'password',
RefreshToken: 'refresh_token'
} as const;
export type GrantType = typeof GrantType[keyof typeof GrantType];
export function instanceOfGrantType(value: any): boolean {
for (const key in GrantType) {
if (Object.prototype.hasOwnProperty.call(GrantType, key)) {
if (GrantType[key as keyof typeof GrantType] === value) {
return true;
}
}
}
return false;
}
export function GrantTypeFromJSON(json: any): GrantType {
return GrantTypeFromJSONTyped(json, false);
}
export function GrantTypeFromJSONTyped(json: any, ignoreDiscriminator: boolean): GrantType {
return json as GrantType;
}
export function GrantTypeToJSON(value?: GrantType | null): any {
return value as any;
}
export function GrantTypeToJSONTyped(value: any, ignoreDiscriminator: boolean): GrantType {
return value as GrantType;
}

185
src/models/Group.ts Normal file
View File

@ -0,0 +1,185 @@
/* tslint:disable */
/* eslint-disable */
/**
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* Contact: contact@tribufu.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { mapValues } from '../runtime';
/**
*
* @export
* @interface Group
*/
export interface Group {
/**
*
* @type {string}
* @memberof Group
*/
id?: string;
/**
*
* @type {string}
* @memberof Group
*/
uuid?: string;
/**
*
* @type {string}
* @memberof Group
*/
name?: string | null;
/**
*
* @type {string}
* @memberof Group
*/
tag?: string | null;
/**
*
* @type {string}
* @memberof Group
*/
description?: string | null;
/**
*
* @type {number}
* @memberof Group
*/
type?: number;
/**
*
* @type {number}
* @memberof Group
*/
privacy?: number;
/**
*
* @type {string}
* @memberof Group
*/
ownerId?: string;
/**
*
* @type {boolean}
* @memberof Group
*/
verified?: boolean;
/**
*
* @type {string}
* @memberof Group
*/
photoUrl?: string | null;
/**
*
* @type {string}
* @memberof Group
*/
bannerUrl?: string | null;
/**
*
* @type {number}
* @memberof Group
*/
memberCount?: number;
/**
*
* @type {number}
* @memberof Group
*/
followerCount?: number;
/**
*
* @type {number}
* @memberof Group
*/
viewCount?: number;
/**
*
* @type {Date}
* @memberof Group
*/
created?: Date;
/**
*
* @type {Date}
* @memberof Group
*/
updated?: Date | null;
}
/**
* Check if a given object implements the Group interface.
*/
export function instanceOfGroup(value: object): value is Group {
return true;
}
export function GroupFromJSON(json: any): Group {
return GroupFromJSONTyped(json, false);
}
export function GroupFromJSONTyped(json: any, ignoreDiscriminator: boolean): Group {
if (json == null) {
return json;
}
return {
'id': json['id'] == null ? undefined : json['id'],
'uuid': json['uuid'] == null ? undefined : json['uuid'],
'name': json['name'] == null ? undefined : json['name'],
'tag': json['tag'] == null ? undefined : json['tag'],
'description': json['description'] == null ? undefined : json['description'],
'type': json['type'] == null ? undefined : json['type'],
'privacy': json['privacy'] == null ? undefined : json['privacy'],
'ownerId': json['owner_id'] == null ? undefined : json['owner_id'],
'verified': json['verified'] == null ? undefined : json['verified'],
'photoUrl': json['photo_url'] == null ? undefined : json['photo_url'],
'bannerUrl': json['banner_url'] == null ? undefined : json['banner_url'],
'memberCount': json['member_count'] == null ? undefined : json['member_count'],
'followerCount': json['follower_count'] == null ? undefined : json['follower_count'],
'viewCount': json['view_count'] == null ? undefined : json['view_count'],
'created': json['created'] == null ? undefined : (new Date(json['created'])),
'updated': json['updated'] == null ? undefined : (new Date(json['updated'])),
};
}
export function GroupToJSON(json: any): Group {
return GroupToJSONTyped(json, false);
}
export function GroupToJSONTyped(value?: Group | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
return {
'id': value['id'],
'uuid': value['uuid'],
'name': value['name'],
'tag': value['tag'],
'description': value['description'],
'type': value['type'],
'privacy': value['privacy'],
'owner_id': value['ownerId'],
'verified': value['verified'],
'photo_url': value['photoUrl'],
'banner_url': value['bannerUrl'],
'member_count': value['memberCount'],
'follower_count': value['followerCount'],
'view_count': value['viewCount'],
'created': value['created'] == null ? undefined : ((value['created']).toISOString()),
'updated': value['updated'] == null ? undefined : ((value['updated'] as any).toISOString()),
};
}

128
src/models/GroupGame.ts Normal file
View File

@ -0,0 +1,128 @@
/* tslint:disable */
/* eslint-disable */
/**
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* Contact: contact@tribufu.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { mapValues } from '../runtime';
import type { Group } from './Group';
import {
GroupFromJSON,
GroupFromJSONTyped,
GroupToJSON,
GroupToJSONTyped,
} from './Group';
import type { Application } from './Application';
import {
ApplicationFromJSON,
ApplicationFromJSONTyped,
ApplicationToJSON,
ApplicationToJSONTyped,
} from './Application';
/**
*
* @export
* @interface GroupGame
*/
export interface GroupGame {
/**
*
* @type {string}
* @memberof GroupGame
*/
groupId?: string;
/**
*
* @type {Group}
* @memberof GroupGame
*/
group?: Group;
/**
*
* @type {string}
* @memberof GroupGame
*/
applicationId?: string;
/**
*
* @type {Application}
* @memberof GroupGame
*/
application?: Application;
/**
*
* @type {any}
* @memberof GroupGame
*/
stats?: any | null;
/**
*
* @type {Date}
* @memberof GroupGame
*/
acquired?: Date;
/**
*
* @type {Date}
* @memberof GroupGame
*/
lastUsed?: Date | null;
}
/**
* Check if a given object implements the GroupGame interface.
*/
export function instanceOfGroupGame(value: object): value is GroupGame {
return true;
}
export function GroupGameFromJSON(json: any): GroupGame {
return GroupGameFromJSONTyped(json, false);
}
export function GroupGameFromJSONTyped(json: any, ignoreDiscriminator: boolean): GroupGame {
if (json == null) {
return json;
}
return {
'groupId': json['group_id'] == null ? undefined : json['group_id'],
'group': json['group'] == null ? undefined : GroupFromJSON(json['group']),
'applicationId': json['application_id'] == null ? undefined : json['application_id'],
'application': json['application'] == null ? undefined : ApplicationFromJSON(json['application']),
'stats': json['stats'] == null ? undefined : json['stats'],
'acquired': json['acquired'] == null ? undefined : (new Date(json['acquired'])),
'lastUsed': json['last_used'] == null ? undefined : (new Date(json['last_used'])),
};
}
export function GroupGameToJSON(json: any): GroupGame {
return GroupGameToJSONTyped(json, false);
}
export function GroupGameToJSONTyped(value?: GroupGame | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
return {
'group_id': value['groupId'],
'group': GroupToJSON(value['group']),
'application_id': value['applicationId'],
'application': ApplicationToJSON(value['application']),
'stats': value['stats'],
'acquired': value['acquired'] == null ? undefined : ((value['acquired']).toISOString()),
'last_used': value['lastUsed'] == null ? undefined : ((value['lastUsed'] as any).toISOString()),
};
}

139
src/models/GroupMember.ts Normal file
View File

@ -0,0 +1,139 @@
/* tslint:disable */
/* eslint-disable */
/**
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* Contact: contact@tribufu.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { mapValues } from '../runtime';
import type { GroupRank } from './GroupRank';
import {
GroupRankFromJSON,
GroupRankFromJSONTyped,
GroupRankToJSON,
GroupRankToJSONTyped,
} from './GroupRank';
/**
*
* @export
* @interface GroupMember
*/
export interface GroupMember {
/**
*
* @type {string}
* @memberof GroupMember
*/
id?: string;
/**
*
* @type {string}
* @memberof GroupMember
*/
uuid?: string;
/**
*
* @type {string}
* @memberof GroupMember
*/
name?: string | null;
/**
*
* @type {string}
* @memberof GroupMember
*/
displayName?: string | null;
/**
*
* @type {boolean}
* @memberof GroupMember
*/
verified?: boolean;
/**
*
* @type {string}
* @memberof GroupMember
*/
photoUrl?: string | null;
/**
*
* @type {Date}
* @memberof GroupMember
*/
lastOnline?: Date | null;
/**
*
* @type {GroupRank}
* @memberof GroupMember
*/
rank?: GroupRank;
/**
*
* @type {Date}
* @memberof GroupMember
*/
since?: Date;
}
/**
* Check if a given object implements the GroupMember interface.
*/
export function instanceOfGroupMember(value: object): value is GroupMember {
return true;
}
export function GroupMemberFromJSON(json: any): GroupMember {
return GroupMemberFromJSONTyped(json, false);
}
export function GroupMemberFromJSONTyped(json: any, ignoreDiscriminator: boolean): GroupMember {
if (json == null) {
return json;
}
return {
'id': json['id'] == null ? undefined : json['id'],
'uuid': json['uuid'] == null ? undefined : json['uuid'],
'name': json['name'] == null ? undefined : json['name'],
'displayName': json['display_name'] == null ? undefined : json['display_name'],
'verified': json['verified'] == null ? undefined : json['verified'],
'photoUrl': json['photo_url'] == null ? undefined : json['photo_url'],
'lastOnline': json['last_online'] == null ? undefined : (new Date(json['last_online'])),
'rank': json['rank'] == null ? undefined : GroupRankFromJSON(json['rank']),
'since': json['since'] == null ? undefined : (new Date(json['since'])),
};
}
export function GroupMemberToJSON(json: any): GroupMember {
return GroupMemberToJSONTyped(json, false);
}
export function GroupMemberToJSONTyped(value?: GroupMember | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
return {
'id': value['id'],
'uuid': value['uuid'],
'name': value['name'],
'display_name': value['displayName'],
'verified': value['verified'],
'photo_url': value['photoUrl'],
'last_online': value['lastOnline'] == null ? undefined : ((value['lastOnline'] as any).toISOString()),
'rank': GroupRankToJSON(value['rank']),
'since': value['since'] == null ? undefined : ((value['since']).toISOString()),
};
}

54
src/models/GroupRank.ts Normal file
View File

@ -0,0 +1,54 @@
/* tslint:disable */
/* eslint-disable */
/**
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* Contact: contact@tribufu.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/**
*
* @export
*/
export const GroupRank = {
Member: 'member',
Leader: 'leader',
Owner: 'owner'
} as const;
export type GroupRank = typeof GroupRank[keyof typeof GroupRank];
export function instanceOfGroupRank(value: any): boolean {
for (const key in GroupRank) {
if (Object.prototype.hasOwnProperty.call(GroupRank, key)) {
if (GroupRank[key as keyof typeof GroupRank] === value) {
return true;
}
}
}
return false;
}
export function GroupRankFromJSON(json: any): GroupRank {
return GroupRankFromJSONTyped(json, false);
}
export function GroupRankFromJSONTyped(json: any, ignoreDiscriminator: boolean): GroupRank {
return json as GroupRank;
}
export function GroupRankToJSON(value?: GroupRank | null): any {
return value as any;
}
export function GroupRankToJSONTyped(value: any, ignoreDiscriminator: boolean): GroupRank {
return value as GroupRank;
}

View File

@ -0,0 +1,65 @@
/* tslint:disable */
/* eslint-disable */
/**
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* Contact: contact@tribufu.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { mapValues } from '../runtime';
/**
*
* @export
* @interface HashViewModel
*/
export interface HashViewModel {
/**
*
* @type {string}
* @memberof HashViewModel
*/
value?: string | null;
}
/**
* Check if a given object implements the HashViewModel interface.
*/
export function instanceOfHashViewModel(value: object): value is HashViewModel {
return true;
}
export function HashViewModelFromJSON(json: any): HashViewModel {
return HashViewModelFromJSONTyped(json, false);
}
export function HashViewModelFromJSONTyped(json: any, ignoreDiscriminator: boolean): HashViewModel {
if (json == null) {
return json;
}
return {
'value': json['value'] == null ? undefined : json['value'],
};
}
export function HashViewModelToJSON(json: any): HashViewModel {
return HashViewModelToJSONTyped(json, false);
}
export function HashViewModelToJSONTyped(value?: HashViewModel | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
return {
'value': value['value'],
};
}

View File

@ -0,0 +1,83 @@
/* tslint:disable */
/* eslint-disable */
/**
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* Contact: contact@tribufu.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { mapValues } from '../runtime';
import type { TokenHintType } from './TokenHintType';
import {
TokenHintTypeFromJSON,
TokenHintTypeFromJSONTyped,
TokenHintTypeToJSON,
TokenHintTypeToJSONTyped,
} from './TokenHintType';
/**
*
* @export
* @interface IntrospectRequest
*/
export interface IntrospectRequest {
/**
*
* @type {string}
* @memberof IntrospectRequest
*/
token?: string | null;
/**
*
* @type {TokenHintType}
* @memberof IntrospectRequest
*/
tokenTypeHint?: TokenHintType;
}
/**
* Check if a given object implements the IntrospectRequest interface.
*/
export function instanceOfIntrospectRequest(value: object): value is IntrospectRequest {
return true;
}
export function IntrospectRequestFromJSON(json: any): IntrospectRequest {
return IntrospectRequestFromJSONTyped(json, false);
}
export function IntrospectRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): IntrospectRequest {
if (json == null) {
return json;
}
return {
'token': json['token'] == null ? undefined : json['token'],
'tokenTypeHint': json['token_type_hint'] == null ? undefined : TokenHintTypeFromJSON(json['token_type_hint']),
};
}
export function IntrospectRequestToJSON(json: any): IntrospectRequest {
return IntrospectRequestToJSONTyped(json, false);
}
export function IntrospectRequestToJSONTyped(value?: IntrospectRequest | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
return {
'token': value['token'],
'token_type_hint': TokenHintTypeToJSON(value['tokenTypeHint']),
};
}

201
src/models/IpAddress.ts Normal file
View File

@ -0,0 +1,201 @@
/* tslint:disable */
/* eslint-disable */
/**
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* Contact: contact@tribufu.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { mapValues } from '../runtime';
/**
*
* @export
* @interface IpAddress
*/
export interface IpAddress {
/**
*
* @type {string}
* @memberof IpAddress
*/
address?: string | null;
/**
*
* @type {number}
* @memberof IpAddress
*/
version?: number;
/**
*
* @type {string}
* @memberof IpAddress
*/
network?: string | null;
/**
*
* @type {boolean}
* @memberof IpAddress
*/
reserved?: boolean;
/**
*
* @type {string}
* @memberof IpAddress
*/
asn?: string | null;
/**
*
* @type {string}
* @memberof IpAddress
*/
isp?: string | null;
/**
*
* @type {string}
* @memberof IpAddress
*/
continent?: string | null;
/**
*
* @type {string}
* @memberof IpAddress
*/
country?: string | null;
/**
*
* @type {string}
* @memberof IpAddress
*/
region?: string | null;
/**
*
* @type {string}
* @memberof IpAddress
*/
city?: string | null;
/**
*
* @type {string}
* @memberof IpAddress
*/
postalCode?: string | null;
/**
*
* @type {string}
* @memberof IpAddress
*/
callingCode?: string | null;
/**
*
* @type {string}
* @memberof IpAddress
*/
tld?: string | null;
/**
*
* @type {string}
* @memberof IpAddress
*/
language?: string | null;
/**
*
* @type {string}
* @memberof IpAddress
*/
timezone?: string | null;
/**
*
* @type {string}
* @memberof IpAddress
*/
currency?: string | null;
/**
*
* @type {number}
* @memberof IpAddress
*/
latitude?: number | null;
/**
*
* @type {number}
* @memberof IpAddress
*/
longitude?: number | null;
}
/**
* Check if a given object implements the IpAddress interface.
*/
export function instanceOfIpAddress(value: object): value is IpAddress {
return true;
}
export function IpAddressFromJSON(json: any): IpAddress {
return IpAddressFromJSONTyped(json, false);
}
export function IpAddressFromJSONTyped(json: any, ignoreDiscriminator: boolean): IpAddress {
if (json == null) {
return json;
}
return {
'address': json['address'] == null ? undefined : json['address'],
'version': json['version'] == null ? undefined : json['version'],
'network': json['network'] == null ? undefined : json['network'],
'reserved': json['reserved'] == null ? undefined : json['reserved'],
'asn': json['asn'] == null ? undefined : json['asn'],
'isp': json['isp'] == null ? undefined : json['isp'],
'continent': json['continent'] == null ? undefined : json['continent'],
'country': json['country'] == null ? undefined : json['country'],
'region': json['region'] == null ? undefined : json['region'],
'city': json['city'] == null ? undefined : json['city'],
'postalCode': json['postal_code'] == null ? undefined : json['postal_code'],
'callingCode': json['calling_code'] == null ? undefined : json['calling_code'],
'tld': json['tld'] == null ? undefined : json['tld'],
'language': json['language'] == null ? undefined : json['language'],
'timezone': json['timezone'] == null ? undefined : json['timezone'],
'currency': json['currency'] == null ? undefined : json['currency'],
'latitude': json['latitude'] == null ? undefined : json['latitude'],
'longitude': json['longitude'] == null ? undefined : json['longitude'],
};
}
export function IpAddressToJSON(json: any): IpAddress {
return IpAddressToJSONTyped(json, false);
}
export function IpAddressToJSONTyped(value?: IpAddress | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
return {
'address': value['address'],
'version': value['version'],
'network': value['network'],
'reserved': value['reserved'],
'asn': value['asn'],
'isp': value['isp'],
'continent': value['continent'],
'country': value['country'],
'region': value['region'],
'city': value['city'],
'postal_code': value['postalCode'],
'calling_code': value['callingCode'],
'tld': value['tld'],
'language': value['language'],
'timezone': value['timezone'],
'currency': value['currency'],
'latitude': value['latitude'],
'longitude': value['longitude'],
};
}

View File

@ -0,0 +1,105 @@
/* tslint:disable */
/* eslint-disable */
/**
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* Contact: contact@tribufu.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { mapValues } from '../runtime';
/**
*
* @export
* @interface LeaderboardItem
*/
export interface LeaderboardItem {
/**
*
* @type {string}
* @memberof LeaderboardItem
*/
name?: string | null;
/**
*
* @type {string}
* @memberof LeaderboardItem
*/
displayName?: string | null;
/**
*
* @type {string}
* @memberof LeaderboardItem
*/
photoUrl?: string | null;
/**
*
* @type {number}
* @memberof LeaderboardItem
*/
level?: number;
/**
*
* @type {number}
* @memberof LeaderboardItem
*/
experience?: number;
/**
*
* @type {number}
* @memberof LeaderboardItem
*/
points?: number;
}
/**
* Check if a given object implements the LeaderboardItem interface.
*/
export function instanceOfLeaderboardItem(value: object): value is LeaderboardItem {
return true;
}
export function LeaderboardItemFromJSON(json: any): LeaderboardItem {
return LeaderboardItemFromJSONTyped(json, false);
}
export function LeaderboardItemFromJSONTyped(json: any, ignoreDiscriminator: boolean): LeaderboardItem {
if (json == null) {
return json;
}
return {
'name': json['name'] == null ? undefined : json['name'],
'displayName': json['display_name'] == null ? undefined : json['display_name'],
'photoUrl': json['photo_url'] == null ? undefined : json['photo_url'],
'level': json['level'] == null ? undefined : json['level'],
'experience': json['experience'] == null ? undefined : json['experience'],
'points': json['points'] == null ? undefined : json['points'],
};
}
export function LeaderboardItemToJSON(json: any): LeaderboardItem {
return LeaderboardItemToJSONTyped(json, false);
}
export function LeaderboardItemToJSONTyped(value?: LeaderboardItem | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
return {
'name': value['name'],
'display_name': value['displayName'],
'photo_url': value['photoUrl'],
'level': value['level'],
'experience': value['experience'],
'points': value['points'],
};
}

View File

@ -0,0 +1,53 @@
/* tslint:disable */
/* eslint-disable */
/**
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* Contact: contact@tribufu.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/**
*
* @export
*/
export const LeaderboardOrder = {
Level: 'level',
Points: 'points'
} as const;
export type LeaderboardOrder = typeof LeaderboardOrder[keyof typeof LeaderboardOrder];
export function instanceOfLeaderboardOrder(value: any): boolean {
for (const key in LeaderboardOrder) {
if (Object.prototype.hasOwnProperty.call(LeaderboardOrder, key)) {
if (LeaderboardOrder[key as keyof typeof LeaderboardOrder] === value) {
return true;
}
}
}
return false;
}
export function LeaderboardOrderFromJSON(json: any): LeaderboardOrder {
return LeaderboardOrderFromJSONTyped(json, false);
}
export function LeaderboardOrderFromJSONTyped(json: any, ignoreDiscriminator: boolean): LeaderboardOrder {
return json as LeaderboardOrder;
}
export function LeaderboardOrderToJSON(value?: LeaderboardOrder | null): any {
return value as any;
}
export function LeaderboardOrderToJSONTyped(value: any, ignoreDiscriminator: boolean): LeaderboardOrder {
return value as LeaderboardOrder;
}

View File

@ -0,0 +1,58 @@
/* tslint:disable */
/* eslint-disable */
/**
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* Contact: contact@tribufu.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/**
*
* @export
*/
export const LoginProvider = {
Steam: 'steam',
Epic: 'epic',
Discord: 'discord',
Microsoft: 'microsoft',
Playstation: 'playstation',
Google: 'google',
Apple: 'apple'
} as const;
export type LoginProvider = typeof LoginProvider[keyof typeof LoginProvider];
export function instanceOfLoginProvider(value: any): boolean {
for (const key in LoginProvider) {
if (Object.prototype.hasOwnProperty.call(LoginProvider, key)) {
if (LoginProvider[key as keyof typeof LoginProvider] === value) {
return true;
}
}
}
return false;
}
export function LoginProviderFromJSON(json: any): LoginProvider {
return LoginProviderFromJSONTyped(json, false);
}
export function LoginProviderFromJSONTyped(json: any, ignoreDiscriminator: boolean): LoginProvider {
return json as LoginProvider;
}
export function LoginProviderToJSON(value?: LoginProvider | null): any {
return value as any;
}
export function LoginProviderToJSONTyped(value: any, ignoreDiscriminator: boolean): LoginProvider {
return value as LoginProvider;
}

View File

@ -0,0 +1,73 @@
/* tslint:disable */
/* eslint-disable */
/**
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* Contact: contact@tribufu.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { mapValues } from '../runtime';
/**
*
* @export
* @interface LoginRequest
*/
export interface LoginRequest {
/**
*
* @type {string}
* @memberof LoginRequest
*/
login?: string | null;
/**
*
* @type {string}
* @memberof LoginRequest
*/
password?: string | null;
}
/**
* Check if a given object implements the LoginRequest interface.
*/
export function instanceOfLoginRequest(value: object): value is LoginRequest {
return true;
}
export function LoginRequestFromJSON(json: any): LoginRequest {
return LoginRequestFromJSONTyped(json, false);
}
export function LoginRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): LoginRequest {
if (json == null) {
return json;
}
return {
'login': json['login'] == null ? undefined : json['login'],
'password': json['password'] == null ? undefined : json['password'],
};
}
export function LoginRequestToJSON(json: any): LoginRequest {
return LoginRequestToJSONTyped(json, false);
}
export function LoginRequestToJSONTyped(value?: LoginRequest | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
return {
'login': value['login'],
'password': value['password'],
};
}

View File

@ -0,0 +1,97 @@
/* tslint:disable */
/* eslint-disable */
/**
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* Contact: contact@tribufu.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { mapValues } from '../runtime';
import type { UserInfo } from './UserInfo';
import {
UserInfoFromJSON,
UserInfoFromJSONTyped,
UserInfoToJSON,
UserInfoToJSONTyped,
} from './UserInfo';
/**
*
* @export
* @interface LoginResponse
*/
export interface LoginResponse {
/**
*
* @type {UserInfo}
* @memberof LoginResponse
*/
user?: UserInfo;
/**
*
* @type {string}
* @memberof LoginResponse
*/
accessToken?: string | null;
/**
*
* @type {string}
* @memberof LoginResponse
*/
refreshToken?: string | null;
/**
*
* @type {number}
* @memberof LoginResponse
*/
expiresIn?: number;
}
/**
* Check if a given object implements the LoginResponse interface.
*/
export function instanceOfLoginResponse(value: object): value is LoginResponse {
return true;
}
export function LoginResponseFromJSON(json: any): LoginResponse {
return LoginResponseFromJSONTyped(json, false);
}
export function LoginResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): LoginResponse {
if (json == null) {
return json;
}
return {
'user': json['user'] == null ? undefined : UserInfoFromJSON(json['user']),
'accessToken': json['access_token'] == null ? undefined : json['access_token'],
'refreshToken': json['refresh_token'] == null ? undefined : json['refresh_token'],
'expiresIn': json['expires_in'] == null ? undefined : json['expires_in'],
};
}
export function LoginResponseToJSON(json: any): LoginResponse {
return LoginResponseToJSONTyped(json, false);
}
export function LoginResponseToJSONTyped(value?: LoginResponse | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
return {
'user': UserInfoToJSON(value['user']),
'access_token': value['accessToken'],
'refresh_token': value['refreshToken'],
'expires_in': value['expiresIn'],
};
}

153
src/models/Package.ts Normal file
View File

@ -0,0 +1,153 @@
/* tslint:disable */
/* eslint-disable */
/**
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* Contact: contact@tribufu.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { mapValues } from '../runtime';
/**
*
* @export
* @interface Package
*/
export interface Package {
/**
*
* @type {string}
* @memberof Package
*/
id?: string;
/**
*
* @type {string}
* @memberof Package
*/
name?: string | null;
/**
*
* @type {string}
* @memberof Package
*/
description?: string | null;
/**
*
* @type {string}
* @memberof Package
*/
imageUrl?: string | null;
/**
*
* @type {string}
* @memberof Package
*/
authorId?: string;
/**
*
* @type {string}
* @memberof Package
*/
version?: string | null;
/**
*
* @type {string}
* @memberof Package
*/
fileUrl?: string | null;
/**
*
* @type {number}
* @memberof Package
*/
rawSize?: number;
/**
*
* @type {number}
* @memberof Package
*/
downloadCount?: number;
/**
*
* @type {Date}
* @memberof Package
*/
lastDownload?: Date | null;
/**
*
* @type {Date}
* @memberof Package
*/
created?: Date;
/**
*
* @type {Date}
* @memberof Package
*/
updated?: Date | null;
}
/**
* Check if a given object implements the Package interface.
*/
export function instanceOfPackage(value: object): value is Package {
return true;
}
export function PackageFromJSON(json: any): Package {
return PackageFromJSONTyped(json, false);
}
export function PackageFromJSONTyped(json: any, ignoreDiscriminator: boolean): Package {
if (json == null) {
return json;
}
return {
'id': json['id'] == null ? undefined : json['id'],
'name': json['name'] == null ? undefined : json['name'],
'description': json['description'] == null ? undefined : json['description'],
'imageUrl': json['image_url'] == null ? undefined : json['image_url'],
'authorId': json['author_id'] == null ? undefined : json['author_id'],
'version': json['version'] == null ? undefined : json['version'],
'fileUrl': json['file_url'] == null ? undefined : json['file_url'],
'rawSize': json['raw_size'] == null ? undefined : json['raw_size'],
'downloadCount': json['download_count'] == null ? undefined : json['download_count'],
'lastDownload': json['last_download'] == null ? undefined : (new Date(json['last_download'])),
'created': json['created'] == null ? undefined : (new Date(json['created'])),
'updated': json['updated'] == null ? undefined : (new Date(json['updated'])),
};
}
export function PackageToJSON(json: any): Package {
return PackageToJSONTyped(json, false);
}
export function PackageToJSONTyped(value?: Package | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
return {
'id': value['id'],
'name': value['name'],
'description': value['description'],
'image_url': value['imageUrl'],
'author_id': value['authorId'],
'version': value['version'],
'file_url': value['fileUrl'],
'raw_size': value['rawSize'],
'download_count': value['downloadCount'],
'last_download': value['lastDownload'] == null ? undefined : ((value['lastDownload'] as any).toISOString()),
'created': value['created'] == null ? undefined : ((value['created']).toISOString()),
'updated': value['updated'] == null ? undefined : ((value['updated'] as any).toISOString()),
};
}

201
src/models/Profile.ts Normal file
View File

@ -0,0 +1,201 @@
/* tslint:disable */
/* eslint-disable */
/**
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* Contact: contact@tribufu.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { mapValues } from '../runtime';
/**
*
* @export
* @interface Profile
*/
export interface Profile {
/**
*
* @type {string}
* @memberof Profile
*/
id?: string;
/**
*
* @type {string}
* @memberof Profile
*/
uuid?: string;
/**
*
* @type {string}
* @memberof Profile
*/
name?: string | null;
/**
*
* @type {string}
* @memberof Profile
*/
displayName?: string | null;
/**
*
* @type {boolean}
* @memberof Profile
*/
verified?: boolean;
/**
*
* @type {number}
* @memberof Profile
*/
level?: number;
/**
*
* @type {number}
* @memberof Profile
*/
experience?: number;
/**
*
* @type {boolean}
* @memberof Profile
*/
publicBirthday?: boolean;
/**
*
* @type {Date}
* @memberof Profile
*/
birthday?: Date | null;
/**
*
* @type {number}
* @memberof Profile
*/
points?: number;
/**
*
* @type {string}
* @memberof Profile
*/
location?: string | null;
/**
*
* @type {string}
* @memberof Profile
*/
photoUrl?: string | null;
/**
*
* @type {string}
* @memberof Profile
*/
bannerUrl?: string | null;
/**
*
* @type {Date}
* @memberof Profile
*/
lastOnline?: Date | null;
/**
*
* @type {string}
* @memberof Profile
*/
biography?: string | null;
/**
*
* @type {number}
* @memberof Profile
*/
viewCount?: number;
/**
*
* @type {Date}
* @memberof Profile
*/
created?: Date;
/**
*
* @type {Date}
* @memberof Profile
*/
updated?: Date | null;
}
/**
* Check if a given object implements the Profile interface.
*/
export function instanceOfProfile(value: object): value is Profile {
return true;
}
export function ProfileFromJSON(json: any): Profile {
return ProfileFromJSONTyped(json, false);
}
export function ProfileFromJSONTyped(json: any, ignoreDiscriminator: boolean): Profile {
if (json == null) {
return json;
}
return {
'id': json['id'] == null ? undefined : json['id'],
'uuid': json['uuid'] == null ? undefined : json['uuid'],
'name': json['name'] == null ? undefined : json['name'],
'displayName': json['display_name'] == null ? undefined : json['display_name'],
'verified': json['verified'] == null ? undefined : json['verified'],
'level': json['level'] == null ? undefined : json['level'],
'experience': json['experience'] == null ? undefined : json['experience'],
'publicBirthday': json['public_birthday'] == null ? undefined : json['public_birthday'],
'birthday': json['birthday'] == null ? undefined : (new Date(json['birthday'])),
'points': json['points'] == null ? undefined : json['points'],
'location': json['location'] == null ? undefined : json['location'],
'photoUrl': json['photo_url'] == null ? undefined : json['photo_url'],
'bannerUrl': json['banner_url'] == null ? undefined : json['banner_url'],
'lastOnline': json['last_online'] == null ? undefined : (new Date(json['last_online'])),
'biography': json['biography'] == null ? undefined : json['biography'],
'viewCount': json['view_count'] == null ? undefined : json['view_count'],
'created': json['created'] == null ? undefined : (new Date(json['created'])),
'updated': json['updated'] == null ? undefined : (new Date(json['updated'])),
};
}
export function ProfileToJSON(json: any): Profile {
return ProfileToJSONTyped(json, false);
}
export function ProfileToJSONTyped(value?: Profile | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
return {
'id': value['id'],
'uuid': value['uuid'],
'name': value['name'],
'display_name': value['displayName'],
'verified': value['verified'],
'level': value['level'],
'experience': value['experience'],
'public_birthday': value['publicBirthday'],
'birthday': value['birthday'] == null ? undefined : ((value['birthday'] as any).toISOString().substring(0,10)),
'points': value['points'],
'location': value['location'],
'photo_url': value['photoUrl'],
'banner_url': value['bannerUrl'],
'last_online': value['lastOnline'] == null ? undefined : ((value['lastOnline'] as any).toISOString()),
'biography': value['biography'],
'view_count': value['viewCount'],
'created': value['created'] == null ? undefined : ((value['created']).toISOString()),
'updated': value['updated'] == null ? undefined : ((value['updated'] as any).toISOString()),
};
}

145
src/models/ProfileGame.ts Normal file
View File

@ -0,0 +1,145 @@
/* tslint:disable */
/* eslint-disable */
/**
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* Contact: contact@tribufu.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { mapValues } from '../runtime';
/**
*
* @export
* @interface ProfileGame
*/
export interface ProfileGame {
/**
*
* @type {string}
* @memberof ProfileGame
*/
id?: string;
/**
*
* @type {string}
* @memberof ProfileGame
*/
name?: string | null;
/**
*
* @type {string}
* @memberof ProfileGame
*/
capsuleImageUrl?: string | null;
/**
*
* @type {string}
* @memberof ProfileGame
*/
libraryImageUrl?: string | null;
/**
*
* @type {string}
* @memberof ProfileGame
*/
slug?: string | null;
/**
*
* @type {number}
* @memberof ProfileGame
*/
timeUsed?: number;
/**
*
* @type {number}
* @memberof ProfileGame
*/
unlockedAchievements?: number;
/**
*
* @type {number}
* @memberof ProfileGame
*/
totalAchievements?: number;
/**
*
* @type {any}
* @memberof ProfileGame
*/
stats?: any | null;
/**
*
* @type {Date}
* @memberof ProfileGame
*/
acquired?: Date;
/**
*
* @type {Date}
* @memberof ProfileGame
*/
lastUsed?: Date | null;
}
/**
* Check if a given object implements the ProfileGame interface.
*/
export function instanceOfProfileGame(value: object): value is ProfileGame {
return true;
}
export function ProfileGameFromJSON(json: any): ProfileGame {
return ProfileGameFromJSONTyped(json, false);
}
export function ProfileGameFromJSONTyped(json: any, ignoreDiscriminator: boolean): ProfileGame {
if (json == null) {
return json;
}
return {
'id': json['id'] == null ? undefined : json['id'],
'name': json['name'] == null ? undefined : json['name'],
'capsuleImageUrl': json['capsule_image_url'] == null ? undefined : json['capsule_image_url'],
'libraryImageUrl': json['library_image_url'] == null ? undefined : json['library_image_url'],
'slug': json['slug'] == null ? undefined : json['slug'],
'timeUsed': json['time_used'] == null ? undefined : json['time_used'],
'unlockedAchievements': json['unlocked_achievements'] == null ? undefined : json['unlocked_achievements'],
'totalAchievements': json['total_achievements'] == null ? undefined : json['total_achievements'],
'stats': json['stats'] == null ? undefined : json['stats'],
'acquired': json['acquired'] == null ? undefined : (new Date(json['acquired'])),
'lastUsed': json['last_used'] == null ? undefined : (new Date(json['last_used'])),
};
}
export function ProfileGameToJSON(json: any): ProfileGame {
return ProfileGameToJSONTyped(json, false);
}
export function ProfileGameToJSONTyped(value?: ProfileGame | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
return {
'id': value['id'],
'name': value['name'],
'capsule_image_url': value['capsuleImageUrl'],
'library_image_url': value['libraryImageUrl'],
'slug': value['slug'],
'time_used': value['timeUsed'],
'unlocked_achievements': value['unlockedAchievements'],
'total_achievements': value['totalAchievements'],
'stats': value['stats'],
'acquired': value['acquired'] == null ? undefined : ((value['acquired']).toISOString()),
'last_used': value['lastUsed'] == null ? undefined : ((value['lastUsed'] as any).toISOString()),
};
}

147
src/models/ProfileGroup.ts Normal file
View File

@ -0,0 +1,147 @@
/* tslint:disable */
/* eslint-disable */
/**
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* Contact: contact@tribufu.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { mapValues } from '../runtime';
import type { GroupRank } from './GroupRank';
import {
GroupRankFromJSON,
GroupRankFromJSONTyped,
GroupRankToJSON,
GroupRankToJSONTyped,
} from './GroupRank';
/**
*
* @export
* @interface ProfileGroup
*/
export interface ProfileGroup {
/**
*
* @type {string}
* @memberof ProfileGroup
*/
id?: string;
/**
*
* @type {string}
* @memberof ProfileGroup
*/
uuid?: string;
/**
*
* @type {string}
* @memberof ProfileGroup
*/
name?: string | null;
/**
*
* @type {string}
* @memberof ProfileGroup
*/
tag?: string | null;
/**
*
* @type {number}
* @memberof ProfileGroup
*/
privacy?: number;
/**
*
* @type {boolean}
* @memberof ProfileGroup
*/
verified?: boolean;
/**
*
* @type {string}
* @memberof ProfileGroup
*/
photoUrl?: string | null;
/**
*
* @type {number}
* @memberof ProfileGroup
*/
memberCount?: number;
/**
*
* @type {GroupRank}
* @memberof ProfileGroup
*/
rank?: GroupRank;
/**
*
* @type {Date}
* @memberof ProfileGroup
*/
since?: Date;
}
/**
* Check if a given object implements the ProfileGroup interface.
*/
export function instanceOfProfileGroup(value: object): value is ProfileGroup {
return true;
}
export function ProfileGroupFromJSON(json: any): ProfileGroup {
return ProfileGroupFromJSONTyped(json, false);
}
export function ProfileGroupFromJSONTyped(json: any, ignoreDiscriminator: boolean): ProfileGroup {
if (json == null) {
return json;
}
return {
'id': json['id'] == null ? undefined : json['id'],
'uuid': json['uuid'] == null ? undefined : json['uuid'],
'name': json['name'] == null ? undefined : json['name'],
'tag': json['tag'] == null ? undefined : json['tag'],
'privacy': json['privacy'] == null ? undefined : json['privacy'],
'verified': json['verified'] == null ? undefined : json['verified'],
'photoUrl': json['photo_url'] == null ? undefined : json['photo_url'],
'memberCount': json['member_count'] == null ? undefined : json['member_count'],
'rank': json['rank'] == null ? undefined : GroupRankFromJSON(json['rank']),
'since': json['since'] == null ? undefined : (new Date(json['since'])),
};
}
export function ProfileGroupToJSON(json: any): ProfileGroup {
return ProfileGroupToJSONTyped(json, false);
}
export function ProfileGroupToJSONTyped(value?: ProfileGroup | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
return {
'id': value['id'],
'uuid': value['uuid'],
'name': value['name'],
'tag': value['tag'],
'privacy': value['privacy'],
'verified': value['verified'],
'photo_url': value['photoUrl'],
'member_count': value['memberCount'],
'rank': GroupRankToJSON(value['rank']),
'since': value['since'] == null ? undefined : ((value['since']).toISOString()),
};
}

View File

@ -0,0 +1,65 @@
/* tslint:disable */
/* eslint-disable */
/**
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* Contact: contact@tribufu.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { mapValues } from '../runtime';
/**
*
* @export
* @interface RefreshRequest
*/
export interface RefreshRequest {
/**
*
* @type {string}
* @memberof RefreshRequest
*/
refreshToken?: string | null;
}
/**
* Check if a given object implements the RefreshRequest interface.
*/
export function instanceOfRefreshRequest(value: object): value is RefreshRequest {
return true;
}
export function RefreshRequestFromJSON(json: any): RefreshRequest {
return RefreshRequestFromJSONTyped(json, false);
}
export function RefreshRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): RefreshRequest {
if (json == null) {
return json;
}
return {
'refreshToken': json['refresh_token'] == null ? undefined : json['refresh_token'],
};
}
export function RefreshRequestToJSON(json: any): RefreshRequest {
return RefreshRequestToJSONTyped(json, false);
}
export function RefreshRequestToJSONTyped(value?: RefreshRequest | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
return {
'refresh_token': value['refreshToken'],
};
}

View File

@ -0,0 +1,91 @@
/* tslint:disable */
/* eslint-disable */
/**
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* Contact: contact@tribufu.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { mapValues } from '../runtime';
/**
*
* @export
* @interface RegisterRequest
*/
export interface RegisterRequest {
/**
*
* @type {string}
* @memberof RegisterRequest
*/
uuid?: string | null;
/**
*
* @type {string}
* @memberof RegisterRequest
*/
name: string;
/**
*
* @type {string}
* @memberof RegisterRequest
*/
email?: string | null;
/**
*
* @type {string}
* @memberof RegisterRequest
*/
password: string;
}
/**
* Check if a given object implements the RegisterRequest interface.
*/
export function instanceOfRegisterRequest(value: object): value is RegisterRequest {
if (!('name' in value) || value['name'] === undefined) return false;
if (!('password' in value) || value['password'] === undefined) return false;
return true;
}
export function RegisterRequestFromJSON(json: any): RegisterRequest {
return RegisterRequestFromJSONTyped(json, false);
}
export function RegisterRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): RegisterRequest {
if (json == null) {
return json;
}
return {
'uuid': json['uuid'] == null ? undefined : json['uuid'],
'name': json['name'],
'email': json['email'] == null ? undefined : json['email'],
'password': json['password'],
};
}
export function RegisterRequestToJSON(json: any): RegisterRequest {
return RegisterRequestToJSONTyped(json, false);
}
export function RegisterRequestToJSONTyped(value?: RegisterRequest | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
return {
'uuid': value['uuid'],
'name': value['name'],
'email': value['email'],
'password': value['password'],
};
}

View File

@ -0,0 +1,53 @@
/* tslint:disable */
/* eslint-disable */
/**
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* Contact: contact@tribufu.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/**
*
* @export
*/
export const ResponseType = {
Code: 'code',
Token: 'token'
} as const;
export type ResponseType = typeof ResponseType[keyof typeof ResponseType];
export function instanceOfResponseType(value: any): boolean {
for (const key in ResponseType) {
if (Object.prototype.hasOwnProperty.call(ResponseType, key)) {
if (ResponseType[key as keyof typeof ResponseType] === value) {
return true;
}
}
}
return false;
}
export function ResponseTypeFromJSON(json: any): ResponseType {
return ResponseTypeFromJSONTyped(json, false);
}
export function ResponseTypeFromJSONTyped(json: any, ignoreDiscriminator: boolean): ResponseType {
return json as ResponseType;
}
export function ResponseTypeToJSON(value?: ResponseType | null): any {
return value as any;
}
export function ResponseTypeToJSONTyped(value: any, ignoreDiscriminator: boolean): ResponseType {
return value as ResponseType;
}

View File

@ -0,0 +1,83 @@
/* tslint:disable */
/* eslint-disable */
/**
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* Contact: contact@tribufu.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { mapValues } from '../runtime';
import type { TokenHintType } from './TokenHintType';
import {
TokenHintTypeFromJSON,
TokenHintTypeFromJSONTyped,
TokenHintTypeToJSON,
TokenHintTypeToJSONTyped,
} from './TokenHintType';
/**
*
* @export
* @interface RevokeRequest
*/
export interface RevokeRequest {
/**
*
* @type {string}
* @memberof RevokeRequest
*/
token?: string | null;
/**
*
* @type {TokenHintType}
* @memberof RevokeRequest
*/
tokenTypeHint?: TokenHintType;
}
/**
* Check if a given object implements the RevokeRequest interface.
*/
export function instanceOfRevokeRequest(value: object): value is RevokeRequest {
return true;
}
export function RevokeRequestFromJSON(json: any): RevokeRequest {
return RevokeRequestFromJSONTyped(json, false);
}
export function RevokeRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): RevokeRequest {
if (json == null) {
return json;
}
return {
'token': json['token'] == null ? undefined : json['token'],
'tokenTypeHint': json['token_type_hint'] == null ? undefined : TokenHintTypeFromJSON(json['token_type_hint']),
};
}
export function RevokeRequestToJSON(json: any): RevokeRequest {
return RevokeRequestToJSONTyped(json, false);
}
export function RevokeRequestToJSONTyped(value?: RevokeRequest | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
return {
'token': value['token'],
'token_type_hint': TokenHintTypeToJSON(value['tokenTypeHint']),
};
}

View File

@ -0,0 +1,99 @@
/* tslint:disable */
/* eslint-disable */
/**
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* Contact: contact@tribufu.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { mapValues } from '../runtime';
import type { SearchType } from './SearchType';
import {
SearchTypeFromJSON,
SearchTypeFromJSONTyped,
SearchTypeToJSON,
SearchTypeToJSONTyped,
} from './SearchType';
/**
*
* @export
* @interface SearchRequest
*/
export interface SearchRequest {
/**
*
* @type {SearchType}
* @memberof SearchRequest
*/
type?: SearchType;
/**
*
* @type {string}
* @memberof SearchRequest
*/
query?: string | null;
/**
*
* @type {number}
* @memberof SearchRequest
*/
page?: number | null;
/**
*
* @type {string}
* @memberof SearchRequest
*/
gameId?: string | null;
}
/**
* Check if a given object implements the SearchRequest interface.
*/
export function instanceOfSearchRequest(value: object): value is SearchRequest {
return true;
}
export function SearchRequestFromJSON(json: any): SearchRequest {
return SearchRequestFromJSONTyped(json, false);
}
export function SearchRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): SearchRequest {
if (json == null) {
return json;
}
return {
'type': json['type'] == null ? undefined : SearchTypeFromJSON(json['type']),
'query': json['query'] == null ? undefined : json['query'],
'page': json['page'] == null ? undefined : json['page'],
'gameId': json['game_id'] == null ? undefined : json['game_id'],
};
}
export function SearchRequestToJSON(json: any): SearchRequest {
return SearchRequestToJSONTyped(json, false);
}
export function SearchRequestToJSONTyped(value?: SearchRequest | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
return {
'type': SearchTypeToJSON(value['type']),
'query': value['query'],
'page': value['page'],
'game_id': value['gameId'],
};
}

55
src/models/SearchType.ts Normal file
View File

@ -0,0 +1,55 @@
/* tslint:disable */
/* eslint-disable */
/**
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* Contact: contact@tribufu.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/**
*
* @export
*/
export const SearchType = {
User: 'user',
Group: 'group',
Server: 'server',
Cluster: 'cluster'
} as const;
export type SearchType = typeof SearchType[keyof typeof SearchType];
export function instanceOfSearchType(value: any): boolean {
for (const key in SearchType) {
if (Object.prototype.hasOwnProperty.call(SearchType, key)) {
if (SearchType[key as keyof typeof SearchType] === value) {
return true;
}
}
}
return false;
}
export function SearchTypeFromJSON(json: any): SearchType {
return SearchTypeFromJSONTyped(json, false);
}
export function SearchTypeFromJSONTyped(json: any, ignoreDiscriminator: boolean): SearchType {
return json as SearchType;
}
export function SearchTypeToJSON(value?: SearchType | null): any {
return value as any;
}
export function SearchTypeToJSONTyped(value: any, ignoreDiscriminator: boolean): SearchType {
return value as SearchType;
}

View File

@ -0,0 +1,81 @@
/* tslint:disable */
/* eslint-disable */
/**
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* Contact: contact@tribufu.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { mapValues } from '../runtime';
/**
*
* @export
* @interface ServerMetrics
*/
export interface ServerMetrics {
/**
*
* @type {number}
* @memberof ServerMetrics
*/
serverCount?: number;
/**
*
* @type {number}
* @memberof ServerMetrics
*/
packageCount?: number;
/**
*
* @type {number}
* @memberof ServerMetrics
*/
countryCount?: number;
}
/**
* Check if a given object implements the ServerMetrics interface.
*/
export function instanceOfServerMetrics(value: object): value is ServerMetrics {
return true;
}
export function ServerMetricsFromJSON(json: any): ServerMetrics {
return ServerMetricsFromJSONTyped(json, false);
}
export function ServerMetricsFromJSONTyped(json: any, ignoreDiscriminator: boolean): ServerMetrics {
if (json == null) {
return json;
}
return {
'serverCount': json['server_count'] == null ? undefined : json['server_count'],
'packageCount': json['package_count'] == null ? undefined : json['package_count'],
'countryCount': json['country_count'] == null ? undefined : json['country_count'],
};
}
export function ServerMetricsToJSON(json: any): ServerMetrics {
return ServerMetricsToJSONTyped(json, false);
}
export function ServerMetricsToJSONTyped(value?: ServerMetrics | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
return {
'server_count': value['serverCount'],
'package_count': value['packageCount'],
'country_count': value['countryCount'],
};
}

View File

@ -0,0 +1,54 @@
/* tslint:disable */
/* eslint-disable */
/**
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* Contact: contact@tribufu.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/**
*
* @export
*/
export const ServerStatus = {
Unknown: 'unknown',
Offline: 'offline',
Online: 'online'
} as const;
export type ServerStatus = typeof ServerStatus[keyof typeof ServerStatus];
export function instanceOfServerStatus(value: any): boolean {
for (const key in ServerStatus) {
if (Object.prototype.hasOwnProperty.call(ServerStatus, key)) {
if (ServerStatus[key as keyof typeof ServerStatus] === value) {
return true;
}
}
}
return false;
}
export function ServerStatusFromJSON(json: any): ServerStatus {
return ServerStatusFromJSONTyped(json, false);
}
export function ServerStatusFromJSONTyped(json: any, ignoreDiscriminator: boolean): ServerStatus {
return json as ServerStatus;
}
export function ServerStatusToJSON(value?: ServerStatus | null): any {
return value as any;
}
export function ServerStatusToJSONTyped(value: any, ignoreDiscriminator: boolean): ServerStatus {
return value as ServerStatus;
}

112
src/models/Subscription.ts Normal file
View File

@ -0,0 +1,112 @@
/* tslint:disable */
/* eslint-disable */
/**
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* Contact: contact@tribufu.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { mapValues } from '../runtime';
/**
*
* @export
* @interface Subscription
*/
export interface Subscription {
/**
*
* @type {string}
* @memberof Subscription
*/
id?: string;
/**
*
* @type {string}
* @memberof Subscription
*/
name?: string | null;
/**
*
* @type {string}
* @memberof Subscription
*/
description?: string | null;
/**
*
* @type {string}
* @memberof Subscription
*/
imageUrl?: string | null;
/**
*
* @type {{ [key: string]: number; }}
* @memberof Subscription
*/
readonly prices?: { [key: string]: number; } | null;
/**
*
* @type {Date}
* @memberof Subscription
*/
created?: Date;
/**
*
* @type {Date}
* @memberof Subscription
*/
updated?: Date | null;
}
/**
* Check if a given object implements the Subscription interface.
*/
export function instanceOfSubscription(value: object): value is Subscription {
return true;
}
export function SubscriptionFromJSON(json: any): Subscription {
return SubscriptionFromJSONTyped(json, false);
}
export function SubscriptionFromJSONTyped(json: any, ignoreDiscriminator: boolean): Subscription {
if (json == null) {
return json;
}
return {
'id': json['id'] == null ? undefined : json['id'],
'name': json['name'] == null ? undefined : json['name'],
'description': json['description'] == null ? undefined : json['description'],
'imageUrl': json['image_url'] == null ? undefined : json['image_url'],
'prices': json['prices'] == null ? undefined : json['prices'],
'created': json['created'] == null ? undefined : (new Date(json['created'])),
'updated': json['updated'] == null ? undefined : (new Date(json['updated'])),
};
}
export function SubscriptionToJSON(json: any): Subscription {
return SubscriptionToJSONTyped(json, false);
}
export function SubscriptionToJSONTyped(value?: Omit<Subscription, 'prices'> | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
return {
'id': value['id'],
'name': value['name'],
'description': value['description'],
'image_url': value['imageUrl'],
'created': value['created'] == null ? undefined : ((value['created']).toISOString()),
'updated': value['updated'] == null ? undefined : ((value['updated'] as any).toISOString()),
};
}

View File

@ -0,0 +1,53 @@
/* tslint:disable */
/* eslint-disable */
/**
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* Contact: contact@tribufu.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/**
*
* @export
*/
export const TokenHintType = {
AccessToken: 'access_token',
RefreshToken: 'refresh_token'
} as const;
export type TokenHintType = typeof TokenHintType[keyof typeof TokenHintType];
export function instanceOfTokenHintType(value: any): boolean {
for (const key in TokenHintType) {
if (Object.prototype.hasOwnProperty.call(TokenHintType, key)) {
if (TokenHintType[key as keyof typeof TokenHintType] === value) {
return true;
}
}
}
return false;
}
export function TokenHintTypeFromJSON(json: any): TokenHintType {
return TokenHintTypeFromJSONTyped(json, false);
}
export function TokenHintTypeFromJSONTyped(json: any, ignoreDiscriminator: boolean): TokenHintType {
return json as TokenHintType;
}
export function TokenHintTypeToJSON(value?: TokenHintType | null): any {
return value as any;
}
export function TokenHintTypeToJSONTyped(value: any, ignoreDiscriminator: boolean): TokenHintType {
return value as TokenHintType;
}

131
src/models/TokenRequest.ts Normal file
View File

@ -0,0 +1,131 @@
/* tslint:disable */
/* eslint-disable */
/**
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* Contact: contact@tribufu.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { mapValues } from '../runtime';
import type { GrantType } from './GrantType';
import {
GrantTypeFromJSON,
GrantTypeFromJSONTyped,
GrantTypeToJSON,
GrantTypeToJSONTyped,
} from './GrantType';
/**
*
* @export
* @interface TokenRequest
*/
export interface TokenRequest {
/**
*
* @type {GrantType}
* @memberof TokenRequest
*/
grantType?: GrantType;
/**
*
* @type {string}
* @memberof TokenRequest
*/
code?: string | null;
/**
*
* @type {string}
* @memberof TokenRequest
*/
username?: string | null;
/**
*
* @type {string}
* @memberof TokenRequest
*/
password?: string | null;
/**
*
* @type {string}
* @memberof TokenRequest
*/
refreshToken?: string | null;
/**
*
* @type {string}
* @memberof TokenRequest
*/
clientId?: string | null;
/**
*
* @type {string}
* @memberof TokenRequest
*/
redirectUri?: string | null;
/**
*
* @type {string}
* @memberof TokenRequest
*/
codeVerifier?: string | null;
}
/**
* Check if a given object implements the TokenRequest interface.
*/
export function instanceOfTokenRequest(value: object): value is TokenRequest {
return true;
}
export function TokenRequestFromJSON(json: any): TokenRequest {
return TokenRequestFromJSONTyped(json, false);
}
export function TokenRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): TokenRequest {
if (json == null) {
return json;
}
return {
'grantType': json['grant_type'] == null ? undefined : GrantTypeFromJSON(json['grant_type']),
'code': json['code'] == null ? undefined : json['code'],
'username': json['username'] == null ? undefined : json['username'],
'password': json['password'] == null ? undefined : json['password'],
'refreshToken': json['refresh_token'] == null ? undefined : json['refresh_token'],
'clientId': json['client_id'] == null ? undefined : json['client_id'],
'redirectUri': json['redirect_uri'] == null ? undefined : json['redirect_uri'],
'codeVerifier': json['code_verifier'] == null ? undefined : json['code_verifier'],
};
}
export function TokenRequestToJSON(json: any): TokenRequest {
return TokenRequestToJSONTyped(json, false);
}
export function TokenRequestToJSONTyped(value?: TokenRequest | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
return {
'grant_type': GrantTypeToJSON(value['grantType']),
'code': value['code'],
'username': value['username'],
'password': value['password'],
'refresh_token': value['refreshToken'],
'client_id': value['clientId'],
'redirect_uri': value['redirectUri'],
'code_verifier': value['codeVerifier'],
};
}

115
src/models/TokenResponse.ts Normal file
View File

@ -0,0 +1,115 @@
/* tslint:disable */
/* eslint-disable */
/**
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* Contact: contact@tribufu.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { mapValues } from '../runtime';
import type { TokenType } from './TokenType';
import {
TokenTypeFromJSON,
TokenTypeFromJSONTyped,
TokenTypeToJSON,
TokenTypeToJSONTyped,
} from './TokenType';
/**
*
* @export
* @interface TokenResponse
*/
export interface TokenResponse {
/**
*
* @type {TokenType}
* @memberof TokenResponse
*/
tokenType?: TokenType;
/**
*
* @type {string}
* @memberof TokenResponse
*/
accessToken?: string | null;
/**
*
* @type {string}
* @memberof TokenResponse
*/
refreshToken?: string | null;
/**
*
* @type {string}
* @memberof TokenResponse
*/
scope?: string | null;
/**
*
* @type {string}
* @memberof TokenResponse
*/
state?: string | null;
/**
*
* @type {number}
* @memberof TokenResponse
*/
expiresIn?: number;
}
/**
* Check if a given object implements the TokenResponse interface.
*/
export function instanceOfTokenResponse(value: object): value is TokenResponse {
return true;
}
export function TokenResponseFromJSON(json: any): TokenResponse {
return TokenResponseFromJSONTyped(json, false);
}
export function TokenResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): TokenResponse {
if (json == null) {
return json;
}
return {
'tokenType': json['token_type'] == null ? undefined : TokenTypeFromJSON(json['token_type']),
'accessToken': json['access_token'] == null ? undefined : json['access_token'],
'refreshToken': json['refresh_token'] == null ? undefined : json['refresh_token'],
'scope': json['scope'] == null ? undefined : json['scope'],
'state': json['state'] == null ? undefined : json['state'],
'expiresIn': json['expires_in'] == null ? undefined : json['expires_in'],
};
}
export function TokenResponseToJSON(json: any): TokenResponse {
return TokenResponseToJSONTyped(json, false);
}
export function TokenResponseToJSONTyped(value?: TokenResponse | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
return {
'token_type': TokenTypeToJSON(value['tokenType']),
'access_token': value['accessToken'],
'refresh_token': value['refreshToken'],
'scope': value['scope'],
'state': value['state'],
'expires_in': value['expiresIn'],
};
}

52
src/models/TokenType.ts Normal file
View File

@ -0,0 +1,52 @@
/* tslint:disable */
/* eslint-disable */
/**
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* Contact: contact@tribufu.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/**
*
* @export
*/
export const TokenType = {
Bearer: 'bearer'
} as const;
export type TokenType = typeof TokenType[keyof typeof TokenType];
export function instanceOfTokenType(value: any): boolean {
for (const key in TokenType) {
if (Object.prototype.hasOwnProperty.call(TokenType, key)) {
if (TokenType[key as keyof typeof TokenType] === value) {
return true;
}
}
}
return false;
}
export function TokenTypeFromJSON(json: any): TokenType {
return TokenTypeFromJSONTyped(json, false);
}
export function TokenTypeFromJSONTyped(json: any, ignoreDiscriminator: boolean): TokenType {
return json as TokenType;
}
export function TokenTypeToJSON(value?: TokenType | null): any {
return value as any;
}
export function TokenTypeToJSONTyped(value: any, ignoreDiscriminator: boolean): TokenType {
return value as TokenType;
}

View File

@ -0,0 +1,73 @@
/* tslint:disable */
/* eslint-disable */
/**
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* Contact: contact@tribufu.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { mapValues } from '../runtime';
/**
*
* @export
* @interface UpdateProfile
*/
export interface UpdateProfile {
/**
*
* @type {string}
* @memberof UpdateProfile
*/
displayName?: string | null;
/**
*
* @type {string}
* @memberof UpdateProfile
*/
biography?: string | null;
}
/**
* Check if a given object implements the UpdateProfile interface.
*/
export function instanceOfUpdateProfile(value: object): value is UpdateProfile {
return true;
}
export function UpdateProfileFromJSON(json: any): UpdateProfile {
return UpdateProfileFromJSONTyped(json, false);
}
export function UpdateProfileFromJSONTyped(json: any, ignoreDiscriminator: boolean): UpdateProfile {
if (json == null) {
return json;
}
return {
'displayName': json['display_name'] == null ? undefined : json['display_name'],
'biography': json['biography'] == null ? undefined : json['biography'],
};
}
export function UpdateProfileToJSON(json: any): UpdateProfile {
return UpdateProfileToJSONTyped(json, false);
}
export function UpdateProfileToJSONTyped(value?: UpdateProfile | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
return {
'display_name': value['displayName'],
'biography': value['biography'],
};
}

267
src/models/UserInfo.ts Normal file
View File

@ -0,0 +1,267 @@
/* tslint:disable */
/* eslint-disable */
/**
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* Contact: contact@tribufu.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
import { mapValues } from '../runtime';
import type { UserType } from './UserType';
import {
UserTypeFromJSON,
UserTypeFromJSONTyped,
UserTypeToJSON,
UserTypeToJSONTyped,
} from './UserType';
/**
*
* @export
* @interface UserInfo
*/
export interface UserInfo {
/**
*
* @type {string}
* @memberof UserInfo
*/
id?: string;
/**
*
* @type {string}
* @memberof UserInfo
*/
uuid?: string;
/**
*
* @type {string}
* @memberof UserInfo
*/
name?: string | null;
/**
*
* @type {string}
* @memberof UserInfo
*/
displayName?: string | null;
/**
*
* @type {string}
* @memberof UserInfo
*/
email?: string | null;
/**
*
* @type {UserType}
* @memberof UserInfo
*/
type?: UserType;
/**
*
* @type {string}
* @memberof UserInfo
*/
flags?: string;
/**
*
* @type {string}
* @memberof UserInfo
*/
permissions?: string;
/**
*
* @type {boolean}
* @memberof UserInfo
*/
verified?: boolean;
/**
*
* @type {number}
* @memberof UserInfo
*/
level?: number;
/**
*
* @type {number}
* @memberof UserInfo
*/
experience?: number;
/**
*
* @type {boolean}
* @memberof UserInfo
*/
publicBirthday?: boolean;
/**
*
* @type {Date}
* @memberof UserInfo
*/
birthday?: Date | null;
/**
*
* @type {number}
* @memberof UserInfo
*/
points?: number;
/**
*
* @type {string}
* @memberof UserInfo
*/
location?: string | null;
/**
*
* @type {string}
* @memberof UserInfo
*/
language?: string | null;
/**
*
* @type {string}
* @memberof UserInfo
*/
timezone?: string | null;
/**
*
* @type {string}
* @memberof UserInfo
*/
currency?: string | null;
/**
*
* @type {string}
* @memberof UserInfo
*/
photoUrl?: string | null;
/**
*
* @type {string}
* @memberof UserInfo
*/
bannerUrl?: string | null;
/**
*
* @type {Date}
* @memberof UserInfo
*/
lastOnline?: Date | null;
/**
*
* @type {string}
* @memberof UserInfo
*/
biography?: string | null;
/**
*
* @type {number}
* @memberof UserInfo
*/
viewCount?: number;
/**
*
* @type {Date}
* @memberof UserInfo
*/
created?: Date;
/**
*
* @type {Date}
* @memberof UserInfo
*/
updated?: Date | null;
}
/**
* Check if a given object implements the UserInfo interface.
*/
export function instanceOfUserInfo(value: object): value is UserInfo {
return true;
}
export function UserInfoFromJSON(json: any): UserInfo {
return UserInfoFromJSONTyped(json, false);
}
export function UserInfoFromJSONTyped(json: any, ignoreDiscriminator: boolean): UserInfo {
if (json == null) {
return json;
}
return {
'id': json['id'] == null ? undefined : json['id'],
'uuid': json['uuid'] == null ? undefined : json['uuid'],
'name': json['name'] == null ? undefined : json['name'],
'displayName': json['display_name'] == null ? undefined : json['display_name'],
'email': json['email'] == null ? undefined : json['email'],
'type': json['type'] == null ? undefined : UserTypeFromJSON(json['type']),
'flags': json['flags'] == null ? undefined : json['flags'],
'permissions': json['permissions'] == null ? undefined : json['permissions'],
'verified': json['verified'] == null ? undefined : json['verified'],
'level': json['level'] == null ? undefined : json['level'],
'experience': json['experience'] == null ? undefined : json['experience'],
'publicBirthday': json['public_birthday'] == null ? undefined : json['public_birthday'],
'birthday': json['birthday'] == null ? undefined : (new Date(json['birthday'])),
'points': json['points'] == null ? undefined : json['points'],
'location': json['location'] == null ? undefined : json['location'],
'language': json['language'] == null ? undefined : json['language'],
'timezone': json['timezone'] == null ? undefined : json['timezone'],
'currency': json['currency'] == null ? undefined : json['currency'],
'photoUrl': json['photo_url'] == null ? undefined : json['photo_url'],
'bannerUrl': json['banner_url'] == null ? undefined : json['banner_url'],
'lastOnline': json['last_online'] == null ? undefined : (new Date(json['last_online'])),
'biography': json['biography'] == null ? undefined : json['biography'],
'viewCount': json['view_count'] == null ? undefined : json['view_count'],
'created': json['created'] == null ? undefined : (new Date(json['created'])),
'updated': json['updated'] == null ? undefined : (new Date(json['updated'])),
};
}
export function UserInfoToJSON(json: any): UserInfo {
return UserInfoToJSONTyped(json, false);
}
export function UserInfoToJSONTyped(value?: UserInfo | null, ignoreDiscriminator: boolean = false): any {
if (value == null) {
return value;
}
return {
'id': value['id'],
'uuid': value['uuid'],
'name': value['name'],
'display_name': value['displayName'],
'email': value['email'],
'type': UserTypeToJSON(value['type']),
'flags': value['flags'],
'permissions': value['permissions'],
'verified': value['verified'],
'level': value['level'],
'experience': value['experience'],
'public_birthday': value['publicBirthday'],
'birthday': value['birthday'] == null ? undefined : ((value['birthday'] as any).toISOString().substring(0,10)),
'points': value['points'],
'location': value['location'],
'language': value['language'],
'timezone': value['timezone'],
'currency': value['currency'],
'photo_url': value['photoUrl'],
'banner_url': value['bannerUrl'],
'last_online': value['lastOnline'] == null ? undefined : ((value['lastOnline'] as any).toISOString()),
'biography': value['biography'],
'view_count': value['viewCount'],
'created': value['created'] == null ? undefined : ((value['created']).toISOString()),
'updated': value['updated'] == null ? undefined : ((value['updated'] as any).toISOString()),
};
}

53
src/models/UserType.ts Normal file
View File

@ -0,0 +1,53 @@
/* tslint:disable */
/* eslint-disable */
/**
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* Contact: contact@tribufu.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
/**
*
* @export
*/
export const UserType = {
User: 'user',
Bot: 'bot'
} as const;
export type UserType = typeof UserType[keyof typeof UserType];
export function instanceOfUserType(value: any): boolean {
for (const key in UserType) {
if (Object.prototype.hasOwnProperty.call(UserType, key)) {
if (UserType[key as keyof typeof UserType] === value) {
return true;
}
}
}
return false;
}
export function UserTypeFromJSON(json: any): UserType {
return UserTypeFromJSONTyped(json, false);
}
export function UserTypeFromJSONTyped(json: any, ignoreDiscriminator: boolean): UserType {
return json as UserType;
}
export function UserTypeToJSON(value?: UserType | null): any {
return value as any;
}
export function UserTypeToJSONTyped(value: any, ignoreDiscriminator: boolean): UserType {
return value as UserType;
}

44
src/models/index.ts Normal file
View File

@ -0,0 +1,44 @@
/* tslint:disable */
/* eslint-disable */
export * from './Account';
export * from './Application';
export * from './ApplicationType';
export * from './AuthorizeRequest';
export * from './CodeChallengeMethod';
export * from './CryptoViewModel';
export * from './Game';
export * from './GameServer';
export * from './GameServerCluster';
export * from './GrantType';
export * from './Group';
export * from './GroupGame';
export * from './GroupMember';
export * from './GroupRank';
export * from './HashViewModel';
export * from './IntrospectRequest';
export * from './IpAddress';
export * from './LeaderboardItem';
export * from './LeaderboardOrder';
export * from './LoginProvider';
export * from './LoginRequest';
export * from './LoginResponse';
export * from './Package';
export * from './Profile';
export * from './ProfileGame';
export * from './ProfileGroup';
export * from './RefreshRequest';
export * from './RegisterRequest';
export * from './ResponseType';
export * from './RevokeRequest';
export * from './SearchRequest';
export * from './SearchType';
export * from './ServerMetrics';
export * from './ServerStatus';
export * from './Subscription';
export * from './TokenHintType';
export * from './TokenRequest';
export * from './TokenResponse';
export * from './TokenType';
export * from './UpdateProfile';
export * from './UserInfo';
export * from './UserType';

View File

@ -1,8 +0,0 @@
// Copyright (c) Tribufu. All Rights Reserved.
// SPDX-License-Identifier: MIT
export interface TribufuApiOptions {
baseUrl?: string;
apiKey?: string;
fetch?: (url: RequestInfo, init?: RequestInit) => Promise<Response>;
}

431
src/runtime.ts Normal file
View File

@ -0,0 +1,431 @@
/* tslint:disable */
/* eslint-disable */
/**
* Tribufu API
* REST API to access Tribufu services.
*
* The version of the OpenAPI document: 1.1.0
* Contact: contact@tribufu.com
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
export const BASE_PATH = "http://localhost".replace(/\/+$/, "");
export interface ConfigurationParameters {
basePath?: string; // override base path
fetchApi?: FetchAPI; // override for fetch implementation
middleware?: Middleware[]; // middleware to apply before/after fetch requests
queryParamsStringify?: (params: HTTPQuery) => string; // stringify function for query strings
username?: string; // parameter for basic security
password?: string; // parameter for basic security
apiKey?: string | Promise<string> | ((name: string) => string | Promise<string>); // parameter for apiKey security
accessToken?: string | Promise<string> | ((name?: string, scopes?: string[]) => string | Promise<string>); // parameter for oauth2 security
headers?: HTTPHeaders; //header params we want to use on every request
credentials?: RequestCredentials; //value for the credentials param we want to use on each request
}
export class Configuration {
constructor(private configuration: ConfigurationParameters = {}) {}
set config(configuration: Configuration) {
this.configuration = configuration;
}
get basePath(): string {
return this.configuration.basePath != null ? this.configuration.basePath : BASE_PATH;
}
get fetchApi(): FetchAPI | undefined {
return this.configuration.fetchApi;
}
get middleware(): Middleware[] {
return this.configuration.middleware || [];
}
get queryParamsStringify(): (params: HTTPQuery) => string {
return this.configuration.queryParamsStringify || querystring;
}
get username(): string | undefined {
return this.configuration.username;
}
get password(): string | undefined {
return this.configuration.password;
}
get apiKey(): ((name: string) => string | Promise<string>) | undefined {
const apiKey = this.configuration.apiKey;
if (apiKey) {
return typeof apiKey === 'function' ? apiKey : () => apiKey;
}
return undefined;
}
get accessToken(): ((name?: string, scopes?: string[]) => string | Promise<string>) | undefined {
const accessToken = this.configuration.accessToken;
if (accessToken) {
return typeof accessToken === 'function' ? accessToken : async () => accessToken;
}
return undefined;
}
get headers(): HTTPHeaders | undefined {
return this.configuration.headers;
}
get credentials(): RequestCredentials | undefined {
return this.configuration.credentials;
}
}
export const DefaultConfig = new Configuration();
/**
* This is the base class for all generated API classes.
*/
export class BaseAPI {
private static readonly jsonRegex = new RegExp('^(:?application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(:?;.*)?$', 'i');
private middleware: Middleware[];
constructor(protected configuration = DefaultConfig) {
this.middleware = configuration.middleware;
}
withMiddleware<T extends BaseAPI>(this: T, ...middlewares: Middleware[]) {
const next = this.clone<T>();
next.middleware = next.middleware.concat(...middlewares);
return next;
}
withPreMiddleware<T extends BaseAPI>(this: T, ...preMiddlewares: Array<Middleware['pre']>) {
const middlewares = preMiddlewares.map((pre) => ({ pre }));
return this.withMiddleware<T>(...middlewares);
}
withPostMiddleware<T extends BaseAPI>(this: T, ...postMiddlewares: Array<Middleware['post']>) {
const middlewares = postMiddlewares.map((post) => ({ post }));
return this.withMiddleware<T>(...middlewares);
}
/**
* Check if the given MIME is a JSON MIME.
* JSON MIME examples:
* application/json
* application/json; charset=UTF8
* APPLICATION/JSON
* application/vnd.company+json
* @param mime - MIME (Multipurpose Internet Mail Extensions)
* @return True if the given MIME is JSON, false otherwise.
*/
protected isJsonMime(mime: string | null | undefined): boolean {
if (!mime) {
return false;
}
return BaseAPI.jsonRegex.test(mime);
}
protected async request(context: RequestOpts, initOverrides?: RequestInit | InitOverrideFunction): Promise<Response> {
const { url, init } = await this.createFetchParams(context, initOverrides);
const response = await this.fetchApi(url, init);
if (response && (response.status >= 200 && response.status < 300)) {
return response;
}
throw new ResponseError(response, 'Response returned an error code');
}
private async createFetchParams(context: RequestOpts, initOverrides?: RequestInit | InitOverrideFunction) {
let url = this.configuration.basePath + context.path;
if (context.query !== undefined && Object.keys(context.query).length !== 0) {
// only add the querystring to the URL if there are query parameters.
// this is done to avoid urls ending with a "?" character which buggy webservers
// do not handle correctly sometimes.
url += '?' + this.configuration.queryParamsStringify(context.query);
}
const headers = Object.assign({}, this.configuration.headers, context.headers);
Object.keys(headers).forEach(key => headers[key] === undefined ? delete headers[key] : {});
const initOverrideFn =
typeof initOverrides === "function"
? initOverrides
: async () => initOverrides;
const initParams = {
method: context.method,
headers,
body: context.body,
credentials: this.configuration.credentials,
};
const overriddenInit: RequestInit = {
...initParams,
...(await initOverrideFn({
init: initParams,
context,
}))
};
let body: any;
if (isFormData(overriddenInit.body)
|| (overriddenInit.body instanceof URLSearchParams)
|| isBlob(overriddenInit.body)) {
body = overriddenInit.body;
} else if (this.isJsonMime(headers['Content-Type'])) {
body = JSON.stringify(overriddenInit.body);
} else {
body = overriddenInit.body;
}
const init: RequestInit = {
...overriddenInit,
body
};
return { url, init };
}
private fetchApi = async (url: string, init: RequestInit) => {
let fetchParams = { url, init };
for (const middleware of this.middleware) {
if (middleware.pre) {
fetchParams = await middleware.pre({
fetch: this.fetchApi,
...fetchParams,
}) || fetchParams;
}
}
let response: Response | undefined = undefined;
try {
response = await (this.configuration.fetchApi || fetch)(fetchParams.url, fetchParams.init);
} catch (e) {
for (const middleware of this.middleware) {
if (middleware.onError) {
response = await middleware.onError({
fetch: this.fetchApi,
url: fetchParams.url,
init: fetchParams.init,
error: e,
response: response ? response.clone() : undefined,
}) || response;
}
}
if (response === undefined) {
if (e instanceof Error) {
throw new FetchError(e, 'The request failed and the interceptors did not return an alternative response');
} else {
throw e;
}
}
}
for (const middleware of this.middleware) {
if (middleware.post) {
response = await middleware.post({
fetch: this.fetchApi,
url: fetchParams.url,
init: fetchParams.init,
response: response.clone(),
}) || response;
}
}
return response;
}
/**
* Create a shallow clone of `this` by constructing a new instance
* and then shallow cloning data members.
*/
private clone<T extends BaseAPI>(this: T): T {
const constructor = this.constructor as any;
const next = new constructor(this.configuration);
next.middleware = this.middleware.slice();
return next;
}
};
function isBlob(value: any): value is Blob {
return typeof Blob !== 'undefined' && value instanceof Blob;
}
function isFormData(value: any): value is FormData {
return typeof FormData !== "undefined" && value instanceof FormData;
}
export class ResponseError extends Error {
override name: "ResponseError" = "ResponseError";
constructor(public response: Response, msg?: string) {
super(msg);
}
}
export class FetchError extends Error {
override name: "FetchError" = "FetchError";
constructor(public cause: Error, msg?: string) {
super(msg);
}
}
export class RequiredError extends Error {
override name: "RequiredError" = "RequiredError";
constructor(public field: string, msg?: string) {
super(msg);
}
}
export const COLLECTION_FORMATS = {
csv: ",",
ssv: " ",
tsv: "\t",
pipes: "|",
};
export type FetchAPI = WindowOrWorkerGlobalScope['fetch'];
export type Json = any;
export type HTTPMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'OPTIONS' | 'HEAD';
export type HTTPHeaders = { [key: string]: string };
export type HTTPQuery = { [key: string]: string | number | null | boolean | Array<string | number | null | boolean> | Set<string | number | null | boolean> | HTTPQuery };
export type HTTPBody = Json | FormData | URLSearchParams;
export type HTTPRequestInit = { headers?: HTTPHeaders; method: HTTPMethod; credentials?: RequestCredentials; body?: HTTPBody };
export type ModelPropertyNaming = 'camelCase' | 'snake_case' | 'PascalCase' | 'original';
export type InitOverrideFunction = (requestContext: { init: HTTPRequestInit, context: RequestOpts }) => Promise<RequestInit>
export interface FetchParams {
url: string;
init: RequestInit;
}
export interface RequestOpts {
path: string;
method: HTTPMethod;
headers: HTTPHeaders;
query?: HTTPQuery;
body?: HTTPBody;
}
export function querystring(params: HTTPQuery, prefix: string = ''): string {
return Object.keys(params)
.map(key => querystringSingleKey(key, params[key], prefix))
.filter(part => part.length > 0)
.join('&');
}
function querystringSingleKey(key: string, value: string | number | null | undefined | boolean | Array<string | number | null | boolean> | Set<string | number | null | boolean> | HTTPQuery, keyPrefix: string = ''): string {
const fullKey = keyPrefix + (keyPrefix.length ? `[${key}]` : key);
if (value instanceof Array) {
const multiValue = value.map(singleValue => encodeURIComponent(String(singleValue)))
.join(`&${encodeURIComponent(fullKey)}=`);
return `${encodeURIComponent(fullKey)}=${multiValue}`;
}
if (value instanceof Set) {
const valueAsArray = Array.from(value);
return querystringSingleKey(key, valueAsArray, keyPrefix);
}
if (value instanceof Date) {
return `${encodeURIComponent(fullKey)}=${encodeURIComponent(value.toISOString())}`;
}
if (value instanceof Object) {
return querystring(value as HTTPQuery, fullKey);
}
return `${encodeURIComponent(fullKey)}=${encodeURIComponent(String(value))}`;
}
export function exists(json: any, key: string) {
const value = json[key];
return value !== null && value !== undefined;
}
export function mapValues(data: any, fn: (item: any) => any) {
return Object.keys(data).reduce(
(acc, key) => ({ ...acc, [key]: fn(data[key]) }),
{}
);
}
export function canConsumeForm(consumes: Consume[]): boolean {
for (const consume of consumes) {
if ('multipart/form-data' === consume.contentType) {
return true;
}
}
return false;
}
export interface Consume {
contentType: string;
}
export interface RequestContext {
fetch: FetchAPI;
url: string;
init: RequestInit;
}
export interface ResponseContext {
fetch: FetchAPI;
url: string;
init: RequestInit;
response: Response;
}
export interface ErrorContext {
fetch: FetchAPI;
url: string;
init: RequestInit;
error: unknown;
response?: Response;
}
export interface Middleware {
pre?(context: RequestContext): Promise<FetchParams | void>;
post?(context: ResponseContext): Promise<Response | void>;
onError?(context: ErrorContext): Promise<Response | void>;
}
export interface ApiResponse<T> {
raw: Response;
value(): Promise<T>;
}
export interface ResponseTransformer<T> {
(json: any): T;
}
export class JSONApiResponse<T> {
constructor(public raw: Response, private transformer: ResponseTransformer<T> = (jsonValue: any) => jsonValue) {}
async value(): Promise<T> {
return this.transformer(await this.raw.json());
}
}
export class VoidApiResponse {
constructor(public raw: Response) {}
async value(): Promise<void> {
return undefined;
}
}
export class BlobApiResponse {
constructor(public raw: Response) {}
async value(): Promise<Blob> {
return await this.raw.blob();
};
}
export class TextApiResponse {
constructor(public raw: Response) {}
async value(): Promise<string> {
return await this.raw.text();
};
}

35
src/singletion.ts Normal file
View File

@ -0,0 +1,35 @@
// Copyright (c) Tribufu. All Rights Reserved.
// SPDX-License-Identifier: MIT
import { TribufuApi } from "./";
/**
* **Tribufu API**
*
* Helper class to get a singleton instance of the Tribufu API.
*/
export class TribufuApiSingleton {
private static instance: TribufuApi | null = null;
private constructor() {}
/**
* Get the singleton instance of {@link TribufuApi}.
*
* @return Singleton instance
*/
public static getInstance(): TribufuApi {
if (!this.instance) {
this.instance = TribufuApi.fromEnvOrDefault();
}
return this.instance;
}
/**
* Reset the singleton instance of {@link TribufuApi}.
*/
public static resetInstance() {
this.instance = null;
}
}