UNPKG

@space-cow-media/spellbook-client

Version:

An Open Api generated client for the Commander Spellbook backend REST API.

120 lines (96 loc) 3.99 kB
/* tslint:disable */ /* eslint-disable */ /** * Commander Spellbook API * API for Commander Spellbook, the combo database engine for Magic: The Gathering * * The version of the OpenAPI document: 4.8.19 * * * 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'; export interface RootFormattedRetrieveRequest { format: RootFormattedRetrieveFormatEnum; } /** * */ export class DefaultApi extends runtime.BaseAPI { /** */ async rootFormattedRetrieveRaw(requestParameters: RootFormattedRetrieveRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<{ [key: string]: any; }>> { if (requestParameters['format'] == null) { throw new runtime.RequiredError( 'format', 'Required parameter "format" was null or undefined when calling rootFormattedRetrieve().' ); } const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); } if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("jwtAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/{format}`; urlPath = urlPath.replace(`{${"format"}}`, encodeURIComponent(String(requestParameters['format']))); const response = await this.request({ path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse<any>(response); } /** */ async rootFormattedRetrieve(requestParameters: RootFormattedRetrieveRequest, initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<{ [key: string]: any; }> { const response = await this.rootFormattedRetrieveRaw(requestParameters, initOverrides); return await response.value(); } /** */ async rootRetrieveRaw(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<runtime.ApiResponse<{ [key: string]: any; }>> { const queryParameters: any = {}; const headerParameters: runtime.HTTPHeaders = {}; if (this.configuration && (this.configuration.username !== undefined || this.configuration.password !== undefined)) { headerParameters["Authorization"] = "Basic " + btoa(this.configuration.username + ":" + this.configuration.password); } if (this.configuration && this.configuration.accessToken) { const token = this.configuration.accessToken; const tokenString = await token("jwtAuth", []); if (tokenString) { headerParameters["Authorization"] = `Bearer ${tokenString}`; } } let urlPath = `/`; const response = await this.request({ path: urlPath, method: 'GET', headers: headerParameters, query: queryParameters, }, initOverrides); return new runtime.JSONApiResponse<any>(response); } /** */ async rootRetrieve(initOverrides?: RequestInit | runtime.InitOverrideFunction): Promise<{ [key: string]: any; }> { const response = await this.rootRetrieveRaw(initOverrides); return await response.value(); } } /** * @export * @enum {string} */ export enum RootFormattedRetrieveFormatEnum { Json = '.json' }