/* tslint:disable */ /* eslint-disable */ /** * Hathora Cloud API * Welcome to the Hathora Cloud API documentation! Learn how to use the Hathora Cloud APIs to build and scale your game servers globally. * * The version of the OpenAPI document: 0.0.1 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import * as runtime from '../runtime'; import type { ApiError, Deployment, DeploymentConfig, } from '../models'; import { ApiErrorFromJSON, ApiErrorToJSON, DeploymentFromJSON, DeploymentToJSON, DeploymentConfigFromJSON, DeploymentConfigToJSON, } from '../models'; export interface CreateDeploymentDeprecatedRequest { appId: string; buildId: number; deploymentConfig: DeploymentConfig; } export interface GetDeploymentInfoDeprecatedRequest { appId: string; deploymentId: number; } export interface GetDeploymentsDeprecatedRequest { appId: string; } export interface GetLatestDeploymentDeprecatedRequest { appId: string; } /** * DeploymentV1Api - interface * * @export * @interface DeploymentV1ApiInterface */ export interface DeploymentV1ApiInterface { /** * Create a new [deployment](https://hathora.dev/docs/concepts/hathora-entities#deployment). Creating a new deployment means all new rooms created will use the latest deployment configuration, but existing games in progress will not be affected. * @param {string} appId * @param {number} buildId * @param {DeploymentConfig} deploymentConfig * @param {*} [options] Override http request option. * @deprecated * @throws {RequiredError} * @memberof DeploymentV1ApiInterface */ createDeploymentDeprecatedRaw(requestParameters: CreateDeploymentDeprecatedRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Create a new [deployment](https://hathora.dev/docs/concepts/hathora-entities#deployment). Creating a new deployment means all new rooms created will use the latest deployment configuration, but existing games in progress will not be affected. */ createDeploymentDeprecated(appId: string, buildId: number, deploymentConfig: DeploymentConfig, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; /** * Get details for a [deployment](https://hathora.dev/docs/concepts/hathora-entities#deployment). * @param {string} appId * @param {number} deploymentId * @param {*} [options] Override http request option. * @deprecated * @throws {RequiredError} * @memberof DeploymentV1ApiInterface */ getDeploymentInfoDeprecatedRaw(requestParameters: GetDeploymentInfoDeprecatedRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Get details for a [deployment](https://hathora.dev/docs/concepts/hathora-entities#deployment). */ getDeploymentInfoDeprecated(appId: string, deploymentId: number, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; /** * Returns an array of [deployments](https://hathora.dev/docs/concepts/hathora-entities#deployment) for an [application](https://hathora.dev/docs/concepts/hathora-entities#application). * @param {string} appId * @param {*} [options] Override http request option. * @deprecated * @throws {RequiredError} * @memberof DeploymentV1ApiInterface */ getDeploymentsDeprecatedRaw(requestParameters: GetDeploymentsDeprecatedRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>>; /** * Returns an array of [deployments](https://hathora.dev/docs/concepts/hathora-entities#deployment) for an [application](https://hathora.dev/docs/concepts/hathora-entities#application). */ getDeploymentsDeprecated(appId: string, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Get the latest [deployment](https://hathora.dev/docs/concepts/hathora-entities#deployment) for an [application](https://hathora.dev/docs/concepts/hathora-entities#application). * @param {string} appId * @param {*} [options] Override http request option. * @deprecated * @throws {RequiredError} * @memberof DeploymentV1ApiInterface */ getLatestDeploymentDeprecatedRaw(requestParameters: GetLatestDeploymentDeprecatedRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Get the latest [deployment](https://hathora.dev/docs/concepts/hathora-entities#deployment) for an [application](https://hathora.dev/docs/concepts/hathora-entities#application). */ getLatestDeploymentDeprecated(appId: string, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; } /** * */ export class DeploymentV1Api extends runtime.BaseAPI implements DeploymentV1ApiInterface { /** * Create a new [deployment](https://hathora.dev/docs/concepts/hathora-entities#deployment). Creating a new deployment means all new rooms created will use the latest deployment configuration, but existing games in progress will not be affected. */ async createDeploymentDeprecatedRaw(requestParameters: CreateDeploymentDeprecatedRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters.appId === null || requestParameters.appId === undefined) { throw new runtime.RequiredError('appId','Required parameter requestParameters.appId was null or undefined when calling createDeploymentDeprecated.'); } if (requestParameters.buildId === null || requestParameters.buildId === undefined) { throw new runtime.RequiredError('buildId','Required parameter requestParameters.buildId was null or undefined when calling createDeploymentDeprecated.'); } if (requestParameters.deploymentConfig === null || requestParameters.deploymentConfig === undefined) { throw new runtime.RequiredError('deploymentConfig','Required parameter requestParameters.deploymentConfig was null or undefined when calling createDeploymentDeprecated.'); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; headerParameters['Content-Type'] = 'application/json'; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("hathoraDevToken", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/deployments/v1/{appId}/create/{buildId}`.replace(`{${"appId"}}`, encodeURIComponent(String(requestParameters.appId))).replace(`{${"buildId"}}`, encodeURIComponent(String(requestParameters.buildId))), method: 'POST', headers: headerParameters, query: queryParameters, body: DeploymentConfigToJSON(requestParameters.deploymentConfig), }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => DeploymentFromJSON(jsonValue)); } /** * Create a new [deployment](https://hathora.dev/docs/concepts/hathora-entities#deployment). Creating a new deployment means all new rooms created will use the latest deployment configuration, but existing games in progress will not be affected. */ async createDeploymentDeprecated(appId: string, buildId: number, deploymentConfig: DeploymentConfig, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.createDeploymentDeprecatedRaw({ appId: appId, buildId: buildId, deploymentConfig: deploymentConfig }, initOverrides); return await response.value(); } /** * Get details for a [deployment](https://hathora.dev/docs/concepts/hathora-entities#deployment). */ async getDeploymentInfoDeprecatedRaw(requestParameters: GetDeploymentInfoDeprecatedRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters.appId === null || requestParameters.appId === undefined) { throw new runtime.RequiredError('appId','Required parameter requestParameters.appId was null or undefined when calling getDeploymentInfoDeprecated.'); } if (requestParameters.deploymentId === null || requestParameters.deploymentId === undefined) { throw new runtime.RequiredError('deploymentId','Required parameter requestParameters.deploymentId was null or undefined when calling getDeploymentInfoDeprecated.'); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("hathoraDevToken", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/deployments/v1/{appId}/info/{deploymentId}`.replace(`{${"appId"}}`, encodeURIComponent(String(requestParameters.appId))).replace(`{${"deploymentId"}}`, encodeURIComponent(String(requestParameters.deploymentId))), method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => DeploymentFromJSON(jsonValue)); } /** * Get details for a [deployment](https://hathora.dev/docs/concepts/hathora-entities#deployment). */ async getDeploymentInfoDeprecated(appId: string, deploymentId: number, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.getDeploymentInfoDeprecatedRaw({ appId: appId, deploymentId: deploymentId }, initOverrides); return await response.value(); } /** * Returns an array of [deployments](https://hathora.dev/docs/concepts/hathora-entities#deployment) for an [application](https://hathora.dev/docs/concepts/hathora-entities#application). */ async getDeploymentsDeprecatedRaw(requestParameters: GetDeploymentsDeprecatedRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>> { if (requestParameters.appId === null || requestParameters.appId === undefined) { throw new runtime.RequiredError('appId','Required parameter requestParameters.appId was null or undefined when calling getDeploymentsDeprecated.'); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("hathoraDevToken", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/deployments/v1/{appId}/list`.replace(`{${"appId"}}`, encodeURIComponent(String(requestParameters.appId))), method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => jsonValue.map(DeploymentFromJSON)); } /** * Returns an array of [deployments](https://hathora.dev/docs/concepts/hathora-entities#deployment) for an [application](https://hathora.dev/docs/concepts/hathora-entities#application). */ async getDeploymentsDeprecated(appId: string, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { const response = await this.getDeploymentsDeprecatedRaw({ appId: appId }, initOverrides); return await response.value(); } /** * Get the latest [deployment](https://hathora.dev/docs/concepts/hathora-entities#deployment) for an [application](https://hathora.dev/docs/concepts/hathora-entities#application). */ async getLatestDeploymentDeprecatedRaw(requestParameters: GetLatestDeploymentDeprecatedRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise> { if (requestParameters.appId === null || requestParameters.appId === undefined) { throw new runtime.RequiredError('appId','Required parameter requestParameters.appId was null or undefined when calling getLatestDeploymentDeprecated.'); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("hathoraDevToken", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } const response = await this.request({ path: `/deployments/v1/{appId}/latest`.replace(`{${"appId"}}`, encodeURIComponent(String(requestParameters.appId))), method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse(response, (jsonValue) => DeploymentFromJSON(jsonValue)); } /** * Get the latest [deployment](https://hathora.dev/docs/concepts/hathora-entities#deployment) for an [application](https://hathora.dev/docs/concepts/hathora-entities#application). */ async getLatestDeploymentDeprecated(appId: string, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.getLatestDeploymentDeprecatedRaw({ appId: appId }, initOverrides); return await response.value(); } }