@space-cow-media/spellbook-client
Version:
An Open Api generated client for the Commander Spellbook backend REST API.
127 lines • 5.37 kB
JavaScript
/* 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: 5.4.10
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit the class manually.
*/
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
import * as runtime from '../runtime.js';
/**
*
*/
export class DefaultApi extends runtime.BaseAPI {
/**
* Creates request options for rootFormattedRetrieve without sending the request
*/
rootFormattedRetrieveRequestOpts(requestParameters) {
return __awaiter(this, void 0, void 0, function* () {
if (requestParameters['format'] == null) {
throw new runtime.RequiredError('format', 'Required parameter "format" was null or undefined when calling rootFormattedRetrieve().');
}
const queryParameters = {};
const headerParameters = {};
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 = yield token("jwtAuth", []);
if (tokenString) {
headerParameters["Authorization"] = `Bearer ${tokenString}`;
}
}
let urlPath = `/{format}`;
urlPath = urlPath.replace('{format}', encodeURIComponent(String(requestParameters['format'])));
return {
path: urlPath,
method: 'GET',
headers: headerParameters,
query: queryParameters,
};
});
}
/**
*/
rootFormattedRetrieveRaw(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
const requestOptions = yield this.rootFormattedRetrieveRequestOpts(requestParameters);
const response = yield this.request(requestOptions, initOverrides);
return new runtime.JSONApiResponse(response);
});
}
/**
*/
rootFormattedRetrieve(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield this.rootFormattedRetrieveRaw(requestParameters, initOverrides);
return yield response.value();
});
}
/**
* Creates request options for rootRetrieve without sending the request
*/
rootRetrieveRequestOpts() {
return __awaiter(this, void 0, void 0, function* () {
const queryParameters = {};
const headerParameters = {};
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 = yield token("jwtAuth", []);
if (tokenString) {
headerParameters["Authorization"] = `Bearer ${tokenString}`;
}
}
let urlPath = `/`;
return {
path: urlPath,
method: 'GET',
headers: headerParameters,
query: queryParameters,
};
});
}
/**
*/
rootRetrieveRaw(initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
const requestOptions = yield this.rootRetrieveRequestOpts();
const response = yield this.request(requestOptions, initOverrides);
return new runtime.JSONApiResponse(response);
});
}
/**
*/
rootRetrieve(initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield this.rootRetrieveRaw(initOverrides);
return yield response.value();
});
}
}
/**
* @export
* @enum {string}
*/
export var RootFormattedRetrieveFormatEnum;
(function (RootFormattedRetrieveFormatEnum) {
RootFormattedRetrieveFormatEnum["Json"] = ".json";
})(RootFormattedRetrieveFormatEnum || (RootFormattedRetrieveFormatEnum = {}));
//# sourceMappingURL=DefaultApi.js.map