/* 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, Region, } from '../models'; import { ApiErrorFromJSON, ApiErrorToJSON, RegionFromJSON, RegionToJSON, } from '../models'; export interface DownloadLogForProcessRequest { appId: string; processId: string; } export interface GetLogsForAppRequest { appId: string; follow?: boolean; tailLines?: number; region?: Region; } export interface GetLogsForDeploymentRequest { appId: string; deploymentId: number; follow?: boolean; tailLines?: number; } export interface GetLogsForProcessRequest { appId: string; processId: string; follow?: boolean; tailLines?: number; } /** * LogV1Api - interface * * @export * @interface LogV1ApiInterface */ export interface LogV1ApiInterface { /** * Download entire log file for a stopped process. * @param {string} appId * @param {string} processId * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof LogV1ApiInterface */ downloadLogForProcessRaw(requestParameters: DownloadLogForProcessRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Download entire log file for a stopped process. */ downloadLogForProcess(appId: string, processId: string, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; /** * Returns a stream of logs for an [application](https://hathora.dev/docs/concepts/hathora-entities#application) using `appId`. * @param {string} appId * @param {boolean} [follow] * @param {number} [tailLines] * @param {Region} [region] * @param {*} [options] Override http request option. * @deprecated * @throws {RequiredError} * @memberof LogV1ApiInterface */ getLogsForAppRaw(requestParameters: GetLogsForAppRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Returns a stream of logs for an [application](https://hathora.dev/docs/concepts/hathora-entities#application) using `appId`. */ getLogsForApp(appId: string, follow?: boolean, tailLines?: number, region?: Region, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; /** * Returns a stream of logs for a [deployment](https://hathora.dev/docs/concepts/hathora-entities#deployment) using `appId` and `deploymentId`. * @param {string} appId * @param {number} deploymentId * @param {boolean} [follow] * @param {number} [tailLines] * @param {*} [options] Override http request option. * @deprecated * @throws {RequiredError} * @memberof LogV1ApiInterface */ getLogsForDeploymentRaw(requestParameters: GetLogsForDeploymentRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Returns a stream of logs for a [deployment](https://hathora.dev/docs/concepts/hathora-entities#deployment) using `appId` and `deploymentId`. */ getLogsForDeployment(appId: string, deploymentId: number, follow?: boolean, tailLines?: number, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; /** * Returns a stream of logs for a [process](https://hathora.dev/docs/concepts/hathora-entities#process) using `appId` and `processId`. * @param {string} appId * @param {string} processId * @param {boolean} [follow] * @param {number} [tailLines] * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof LogV1ApiInterface */ getLogsForProcessRaw(requestParameters: GetLogsForProcessRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise>; /** * Returns a stream of logs for a [process](https://hathora.dev/docs/concepts/hathora-entities#process) using `appId` and `processId`. */ getLogsForProcess(appId: string, processId: string, follow?: boolean, tailLines?: number, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise; } /** * */ export class LogV1Api extends runtime.BaseAPI implements LogV1ApiInterface { /** * Download entire log file for a stopped process. */ async downloadLogForProcessRaw(requestParameters: DownloadLogForProcessRequest, 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 downloadLogForProcess.'); } if (requestParameters.processId === null || requestParameters.processId === undefined) { throw new runtime.RequiredError('processId','Required parameter requestParameters.processId was null or undefined when calling downloadLogForProcess.'); } 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: `/logs/v1/{appId}/process/{processId}/download`.replace(`{${"appId"}}`, encodeURIComponent(String(requestParameters.appId))).replace(`{${"processId"}}`, encodeURIComponent(String(requestParameters.processId))), method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.BlobApiResponse(response); } /** * Download entire log file for a stopped process. */ async downloadLogForProcess(appId: string, processId: string, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.downloadLogForProcessRaw({ appId: appId, processId: processId }, initOverrides); return await response.value(); } /** * Returns a stream of logs for an [application](https://hathora.dev/docs/concepts/hathora-entities#application) using `appId`. */ async getLogsForAppRaw(requestParameters: GetLogsForAppRequest, 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 getLogsForApp.'); } const queryParameters: any = {}; if (requestParameters.follow !== undefined) { queryParameters['follow'] = requestParameters.follow; } if (requestParameters.tailLines !== undefined) { queryParameters['tailLines'] = requestParameters.tailLines; } if (requestParameters.region !== undefined) { queryParameters['region'] = requestParameters.region; } 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: `/logs/v1/{appId}/all`.replace(`{${"appId"}}`, encodeURIComponent(String(requestParameters.appId))), method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.BlobApiResponse(response); } /** * Returns a stream of logs for an [application](https://hathora.dev/docs/concepts/hathora-entities#application) using `appId`. */ async getLogsForApp(appId: string, follow?: boolean, tailLines?: number, region?: Region, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.getLogsForAppRaw({ appId: appId, follow: follow, tailLines: tailLines, region: region }, initOverrides); return await response.value(); } /** * Returns a stream of logs for a [deployment](https://hathora.dev/docs/concepts/hathora-entities#deployment) using `appId` and `deploymentId`. */ async getLogsForDeploymentRaw(requestParameters: GetLogsForDeploymentRequest, 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 getLogsForDeployment.'); } if (requestParameters.deploymentId === null || requestParameters.deploymentId === undefined) { throw new runtime.RequiredError('deploymentId','Required parameter requestParameters.deploymentId was null or undefined when calling getLogsForDeployment.'); } const queryParameters: any = {}; if (requestParameters.follow !== undefined) { queryParameters['follow'] = requestParameters.follow; } if (requestParameters.tailLines !== undefined) { queryParameters['tailLines'] = requestParameters.tailLines; } 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: `/logs/v1/{appId}/deployment/{deploymentId}`.replace(`{${"appId"}}`, encodeURIComponent(String(requestParameters.appId))).replace(`{${"deploymentId"}}`, encodeURIComponent(String(requestParameters.deploymentId))), method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.BlobApiResponse(response); } /** * Returns a stream of logs for a [deployment](https://hathora.dev/docs/concepts/hathora-entities#deployment) using `appId` and `deploymentId`. */ async getLogsForDeployment(appId: string, deploymentId: number, follow?: boolean, tailLines?: number, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.getLogsForDeploymentRaw({ appId: appId, deploymentId: deploymentId, follow: follow, tailLines: tailLines }, initOverrides); return await response.value(); } /** * Returns a stream of logs for a [process](https://hathora.dev/docs/concepts/hathora-entities#process) using `appId` and `processId`. */ async getLogsForProcessRaw(requestParameters: GetLogsForProcessRequest, 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 getLogsForProcess.'); } if (requestParameters.processId === null || requestParameters.processId === undefined) { throw new runtime.RequiredError('processId','Required parameter requestParameters.processId was null or undefined when calling getLogsForProcess.'); } const queryParameters: any = {}; if (requestParameters.follow !== undefined) { queryParameters['follow'] = requestParameters.follow; } if (requestParameters.tailLines !== undefined) { queryParameters['tailLines'] = requestParameters.tailLines; } 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: `/logs/v1/{appId}/process/{processId}`.replace(`{${"appId"}}`, encodeURIComponent(String(requestParameters.appId))).replace(`{${"processId"}}`, encodeURIComponent(String(requestParameters.processId))), method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.BlobApiResponse(response); } /** * Returns a stream of logs for a [process](https://hathora.dev/docs/concepts/hathora-entities#process) using `appId` and `processId`. */ async getLogsForProcess(appId: string, processId: string, follow?: boolean, tailLines?: number, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise { const response = await this.getLogsForProcessRaw({ appId: appId, processId: processId, follow: follow, tailLines: tailLines }, initOverrides); return await response.value(); } }