Files
dex-ui-vue/src/api/openapi/service/deck-service.ts
2025-06-21 16:55:53 +02:00

418 lines
18 KiB
TypeScript

/* tslint:disable */
/* eslint-disable */
/**
* dex API
* No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
*
* 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 type { Configuration } from '../configuration';
import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios';
import globalAxios from 'axios';
// Some imports not used depending on template conditions
// @ts-ignore
import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction } from '../common';
// @ts-ignore
import { BASE_PATH, COLLECTION_FORMATS, type RequestArgs, BaseAPI, RequiredError, operationServerMap } from '../base';
// @ts-ignore
import type { Deck } from '../model';
// @ts-ignore
import type { PageDeck } from '../model';
/**
* DeckService - axios parameter creator
* @export
*/
export const DeckServiceAxiosParamCreator = function (configuration?: Configuration) {
return {
/**
*
* @summary Add a Card by its ID to a Deck by its name
* @param {number} cardId
* @param {string} deckName
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
addCardToDeck: async (cardId: number, deckName: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
// verify required parameter 'cardId' is not null or undefined
assertParamExists('addCardToDeck', 'cardId', cardId)
// verify required parameter 'deckName' is not null or undefined
assertParamExists('addCardToDeck', 'deckName', deckName)
const localVarPath = `/api/decks/{deckName}/{cardId}`
.replace(`{${"cardId"}}`, encodeURIComponent(String(cardId)))
.replace(`{${"deckName"}}`, encodeURIComponent(String(deckName)));
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
*
* @summary Create a Deck with a given name
* @param {Deck} deck
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createDeck: async (deck: Deck, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
// verify required parameter 'deck' is not null or undefined
assertParamExists('createDeck', 'deck', deck)
const localVarPath = `/api/decks`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
localVarHeaderParameter['Content-Type'] = 'application/json';
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
localVarRequestOptions.data = serializeDataIfNeeded(deck, localVarRequestOptions, configuration)
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
*
* @summary Get a singular Deck by its name
* @param {string} name
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getDeckByName: async (name: string, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
// verify required parameter 'name' is not null or undefined
assertParamExists('getDeckByName', 'name', name)
const localVarPath = `/api/decks/{name}`
.replace(`{${"name"}}`, encodeURIComponent(String(name)));
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
/**
*
* @summary Get a page of Decks with optional name query parameter
* @param {string | null} [name]
* @param {number} [page]
* @param {number} [pageSize]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getDecks: async (name?: string | null, page?: number, pageSize?: number, options: RawAxiosRequestConfig = {}): Promise<RequestArgs> => {
const localVarPath = `/api/decks`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options};
const localVarHeaderParameter = {} as any;
const localVarQueryParameter = {} as any;
if (name !== undefined) {
localVarQueryParameter['name'] = name;
}
if (page !== undefined) {
localVarQueryParameter['page'] = page;
}
if (pageSize !== undefined) {
localVarQueryParameter['pageSize'] = pageSize;
}
setSearchParams(localVarUrlObj, localVarQueryParameter);
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers};
return {
url: toPathString(localVarUrlObj),
options: localVarRequestOptions,
};
},
}
};
/**
* DeckService - functional programming interface
* @export
*/
export const DeckServiceFp = function(configuration?: Configuration) {
const localVarAxiosParamCreator = DeckServiceAxiosParamCreator(configuration)
return {
/**
*
* @summary Add a Card by its ID to a Deck by its name
* @param {number} cardId
* @param {string} deckName
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async addCardToDeck(cardId: number, deckName: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.addCardToDeck(cardId, deckName, options);
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
const localVarOperationServerBasePath = operationServerMap['DeckService.addCardToDeck']?.[localVarOperationServerIndex]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
},
/**
*
* @summary Create a Deck with a given name
* @param {Deck} deck
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async createDeck(deck: Deck, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<void>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.createDeck(deck, options);
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
const localVarOperationServerBasePath = operationServerMap['DeckService.createDeck']?.[localVarOperationServerIndex]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
},
/**
*
* @summary Get a singular Deck by its name
* @param {string} name
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async getDeckByName(name: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<Deck>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.getDeckByName(name, options);
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
const localVarOperationServerBasePath = operationServerMap['DeckService.getDeckByName']?.[localVarOperationServerIndex]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
},
/**
*
* @summary Get a page of Decks with optional name query parameter
* @param {string | null} [name]
* @param {number} [page]
* @param {number} [pageSize]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
async getDecks(name?: string | null, page?: number, pageSize?: number, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise<PageDeck>> {
const localVarAxiosArgs = await localVarAxiosParamCreator.getDecks(name, page, pageSize, options);
const localVarOperationServerIndex = configuration?.serverIndex ?? 0;
const localVarOperationServerBasePath = operationServerMap['DeckService.getDecks']?.[localVarOperationServerIndex]?.url;
return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath);
},
}
};
/**
* DeckService - factory interface
* @export
*/
export const DeckServiceFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) {
const localVarFp = DeckServiceFp(configuration)
return {
/**
*
* @summary Add a Card by its ID to a Deck by its name
* @param {number} cardId
* @param {string} deckName
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
addCardToDeck(cardId: number, deckName: string, options?: RawAxiosRequestConfig): AxiosPromise<void> {
return localVarFp.addCardToDeck(cardId, deckName, options).then((request) => request(axios, basePath));
},
/**
*
* @summary Create a Deck with a given name
* @param {Deck} deck
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
createDeck(deck: Deck, options?: RawAxiosRequestConfig): AxiosPromise<void> {
return localVarFp.createDeck(deck, options).then((request) => request(axios, basePath));
},
/**
*
* @summary Get a singular Deck by its name
* @param {string} name
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getDeckByName(name: string, options?: RawAxiosRequestConfig): AxiosPromise<Deck> {
return localVarFp.getDeckByName(name, options).then((request) => request(axios, basePath));
},
/**
*
* @summary Get a page of Decks with optional name query parameter
* @param {string | null} [name]
* @param {number} [page]
* @param {number} [pageSize]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getDecks(name?: string | null, page?: number, pageSize?: number, options?: RawAxiosRequestConfig): AxiosPromise<PageDeck> {
return localVarFp.getDecks(name, page, pageSize, options).then((request) => request(axios, basePath));
},
};
};
/**
* DeckService - interface
* @export
* @interface DeckService
*/
export interface DeckServiceInterface {
/**
*
* @summary Add a Card by its ID to a Deck by its name
* @param {number} cardId
* @param {string} deckName
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof DeckServiceInterface
*/
addCardToDeck(cardId: number, deckName: string, options?: RawAxiosRequestConfig): AxiosPromise<void>;
/**
*
* @summary Create a Deck with a given name
* @param {Deck} deck
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof DeckServiceInterface
*/
createDeck(deck: Deck, options?: RawAxiosRequestConfig): AxiosPromise<void>;
/**
*
* @summary Get a singular Deck by its name
* @param {string} name
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof DeckServiceInterface
*/
getDeckByName(name: string, options?: RawAxiosRequestConfig): AxiosPromise<Deck>;
/**
*
* @summary Get a page of Decks with optional name query parameter
* @param {string | null} [name]
* @param {number} [page]
* @param {number} [pageSize]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof DeckServiceInterface
*/
getDecks(name?: string | null, page?: number, pageSize?: number, options?: RawAxiosRequestConfig): AxiosPromise<PageDeck>;
}
/**
* DeckService - object-oriented interface
* @export
* @class DeckService
* @extends {BaseAPI}
*/
export class DeckService extends BaseAPI implements DeckServiceInterface {
/**
*
* @summary Add a Card by its ID to a Deck by its name
* @param {number} cardId
* @param {string} deckName
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof DeckService
*/
public addCardToDeck(cardId: number, deckName: string, options?: RawAxiosRequestConfig) {
return DeckServiceFp(this.configuration).addCardToDeck(cardId, deckName, options).then((request) => request(this.axios, this.basePath));
}
/**
*
* @summary Create a Deck with a given name
* @param {Deck} deck
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof DeckService
*/
public createDeck(deck: Deck, options?: RawAxiosRequestConfig) {
return DeckServiceFp(this.configuration).createDeck(deck, options).then((request) => request(this.axios, this.basePath));
}
/**
*
* @summary Get a singular Deck by its name
* @param {string} name
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof DeckService
*/
public getDeckByName(name: string, options?: RawAxiosRequestConfig) {
return DeckServiceFp(this.configuration).getDeckByName(name, options).then((request) => request(this.axios, this.basePath));
}
/**
*
* @summary Get a page of Decks with optional name query parameter
* @param {string | null} [name]
* @param {number} [page]
* @param {number} [pageSize]
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof DeckService
*/
public getDecks(name?: string | null, page?: number, pageSize?: number, options?: RawAxiosRequestConfig) {
return DeckServiceFp(this.configuration).getDecks(name, page, pageSize, options).then((request) => request(this.axios, this.basePath));
}
}