@space-cow-media/spellbook-client
Version:
An Open Api generated client for the Commander Spellbook backend REST API.
435 lines • 22 kB
JavaScript
"use strict";
/* 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.
*/
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
var desc = Object.getOwnPropertyDescriptor(m, k);
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
desc = { enumerable: true, get: function() { return m[k]; } };
}
Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
var ownKeys = function(o) {
ownKeys = Object.getOwnPropertyNames || function (o) {
var ar = [];
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
return ar;
};
return ownKeys(o);
};
return function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
__setModuleDefault(result, mod);
return result;
};
})();
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());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.VariantSuggestionsApi = void 0;
const runtime = __importStar(require("../runtime"));
const index_1 = require("../models/index");
/**
*
*/
class VariantSuggestionsApi extends runtime.BaseAPI {
/**
*/
variantSuggestionsCreateRaw(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
if (requestParameters['variantSuggestionRequest'] == null) {
throw new runtime.RequiredError('variantSuggestionRequest', 'Required parameter "variantSuggestionRequest" was null or undefined when calling variantSuggestionsCreate().');
}
const queryParameters = {};
const headerParameters = {};
headerParameters['Content-Type'] = 'application/json';
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 = `/variant-suggestions/`;
const response = yield this.request({
path: urlPath,
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: (0, index_1.VariantSuggestionRequestToJSON)(requestParameters['variantSuggestionRequest']),
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.VariantSuggestionFromJSON)(jsonValue));
});
}
/**
*/
variantSuggestionsCreate(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield this.variantSuggestionsCreateRaw(requestParameters, initOverrides);
return yield response.value();
});
}
/**
*/
variantSuggestionsDestroyRaw(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
if (requestParameters['id'] == null) {
throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling variantSuggestionsDestroy().');
}
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 = `/variant-suggestions/{id}/`;
urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
const response = yield this.request({
path: urlPath,
method: 'DELETE',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.VoidApiResponse(response);
});
}
/**
*/
variantSuggestionsDestroy(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
yield this.variantSuggestionsDestroyRaw(requestParameters, initOverrides);
});
}
/**
*/
variantSuggestionsListRaw(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
const queryParameters = {};
if (requestParameters['limit'] != null) {
queryParameters['limit'] = requestParameters['limit'];
}
if (requestParameters['offset'] != null) {
queryParameters['offset'] = requestParameters['offset'];
}
if (requestParameters['suggestedBy'] != null) {
queryParameters['suggestedBy'] = requestParameters['suggestedBy'];
}
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 = `/variant-suggestions/`;
const response = yield this.request({
path: urlPath,
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.PaginatedVariantSuggestionListFromJSON)(jsonValue));
});
}
/**
*/
variantSuggestionsList() {
return __awaiter(this, arguments, void 0, function* (requestParameters = {}, initOverrides) {
const response = yield this.variantSuggestionsListRaw(requestParameters, initOverrides);
return yield response.value();
});
}
/**
*/
variantSuggestionsPartialUpdateRaw(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
if (requestParameters['id'] == null) {
throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling variantSuggestionsPartialUpdate().');
}
const queryParameters = {};
const headerParameters = {};
headerParameters['Content-Type'] = 'application/json';
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 = `/variant-suggestions/{id}/`;
urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
const response = yield this.request({
path: urlPath,
method: 'PATCH',
headers: headerParameters,
query: queryParameters,
body: (0, index_1.PatchedVariantSuggestionRequestToJSON)(requestParameters['patchedVariantSuggestionRequest']),
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.VariantSuggestionFromJSON)(jsonValue));
});
}
/**
*/
variantSuggestionsPartialUpdate(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield this.variantSuggestionsPartialUpdateRaw(requestParameters, initOverrides);
return yield response.value();
});
}
/**
*/
variantSuggestionsRetrieveRaw(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
if (requestParameters['id'] == null) {
throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling variantSuggestionsRetrieve().');
}
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 = `/variant-suggestions/{id}/`;
urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
const response = yield this.request({
path: urlPath,
method: 'GET',
headers: headerParameters,
query: queryParameters,
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.VariantSuggestionFromJSON)(jsonValue));
});
}
/**
*/
variantSuggestionsRetrieve(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield this.variantSuggestionsRetrieveRaw(requestParameters, initOverrides);
return yield response.value();
});
}
/**
*/
variantSuggestionsUpdateRaw(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
if (requestParameters['id'] == null) {
throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling variantSuggestionsUpdate().');
}
if (requestParameters['variantSuggestionRequest'] == null) {
throw new runtime.RequiredError('variantSuggestionRequest', 'Required parameter "variantSuggestionRequest" was null or undefined when calling variantSuggestionsUpdate().');
}
const queryParameters = {};
const headerParameters = {};
headerParameters['Content-Type'] = 'application/json';
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 = `/variant-suggestions/{id}/`;
urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
const response = yield this.request({
path: urlPath,
method: 'PUT',
headers: headerParameters,
query: queryParameters,
body: (0, index_1.VariantSuggestionRequestToJSON)(requestParameters['variantSuggestionRequest']),
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.VariantSuggestionFromJSON)(jsonValue));
});
}
/**
*/
variantSuggestionsUpdate(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield this.variantSuggestionsUpdateRaw(requestParameters, initOverrides);
return yield response.value();
});
}
/**
* Validate the variant suggestion data.
*/
variantSuggestionsValidateCreateRaw(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
if (requestParameters['variantSuggestionRequest'] == null) {
throw new runtime.RequiredError('variantSuggestionRequest', 'Required parameter "variantSuggestionRequest" was null or undefined when calling variantSuggestionsValidateCreate().');
}
const queryParameters = {};
const headerParameters = {};
headerParameters['Content-Type'] = 'application/json';
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 = `/variant-suggestions/validate/`;
const response = yield this.request({
path: urlPath,
method: 'POST',
headers: headerParameters,
query: queryParameters,
body: (0, index_1.VariantSuggestionRequestToJSON)(requestParameters['variantSuggestionRequest']),
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.VariantSuggestionFromJSON)(jsonValue));
});
}
/**
* Validate the variant suggestion data.
*/
variantSuggestionsValidateCreate(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield this.variantSuggestionsValidateCreateRaw(requestParameters, initOverrides);
return yield response.value();
});
}
/**
* Validate the variant suggestion update data.
*/
variantSuggestionsValidatePartialUpdateRaw(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
if (requestParameters['id'] == null) {
throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling variantSuggestionsValidatePartialUpdate().');
}
const queryParameters = {};
const headerParameters = {};
headerParameters['Content-Type'] = 'application/json';
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 = `/variant-suggestions/{id}/validate/`;
urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
const response = yield this.request({
path: urlPath,
method: 'PATCH',
headers: headerParameters,
query: queryParameters,
body: (0, index_1.PatchedVariantSuggestionRequestToJSON)(requestParameters['patchedVariantSuggestionRequest']),
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.VariantSuggestionFromJSON)(jsonValue));
});
}
/**
* Validate the variant suggestion update data.
*/
variantSuggestionsValidatePartialUpdate(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield this.variantSuggestionsValidatePartialUpdateRaw(requestParameters, initOverrides);
return yield response.value();
});
}
/**
* Validate the variant suggestion update data.
*/
variantSuggestionsValidateUpdateRaw(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
if (requestParameters['id'] == null) {
throw new runtime.RequiredError('id', 'Required parameter "id" was null or undefined when calling variantSuggestionsValidateUpdate().');
}
if (requestParameters['variantSuggestionRequest'] == null) {
throw new runtime.RequiredError('variantSuggestionRequest', 'Required parameter "variantSuggestionRequest" was null or undefined when calling variantSuggestionsValidateUpdate().');
}
const queryParameters = {};
const headerParameters = {};
headerParameters['Content-Type'] = 'application/json';
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 = `/variant-suggestions/{id}/validate/`;
urlPath = urlPath.replace(`{${"id"}}`, encodeURIComponent(String(requestParameters['id'])));
const response = yield this.request({
path: urlPath,
method: 'PUT',
headers: headerParameters,
query: queryParameters,
body: (0, index_1.VariantSuggestionRequestToJSON)(requestParameters['variantSuggestionRequest']),
}, initOverrides);
return new runtime.JSONApiResponse(response, (jsonValue) => (0, index_1.VariantSuggestionFromJSON)(jsonValue));
});
}
/**
* Validate the variant suggestion update data.
*/
variantSuggestionsValidateUpdate(requestParameters, initOverrides) {
return __awaiter(this, void 0, void 0, function* () {
const response = yield this.variantSuggestionsValidateUpdateRaw(requestParameters, initOverrides);
return yield response.value();
});
}
}
exports.VariantSuggestionsApi = VariantSuggestionsApi;
//# sourceMappingURL=variantSuggestionsApi.js.map