From 28d88de96dcde6a5ed4d73f81bcdf4ad2b366951 Mon Sep 17 00:00:00 2001 From: skywalker Date: Thu, 22 Aug 2024 22:58:53 +0300 Subject: [PATCH] fix(linter): `prettier --write` --- client/src/generated/api.ts | 25 +- client/src/generated/api/basic-login-api.ts | 242 +++++++++----- .../generated/api/get-instrument-by-id-api.ts | 238 ++++++++----- .../generated/api/get-instrument-types-api.ts | 215 +++++++----- .../api/get-instruments-by-criteria-api.ts | 250 +++++++++----- ...t-instruments-by-criteria-paginated-api.ts | 314 ++++++++++++------ .../generated/api/user-registration-api.ts | 241 +++++++++----- client/src/generated/base.ts | 59 ++-- client/src/generated/common.ts | 204 +++++++----- client/src/generated/configuration.ts | 200 ++++++----- client/src/generated/index.ts | 1 - .../model/add-favorite-request-body.ts | 17 +- client/src/generated/model/client-error.ts | 17 +- ...et-instrument-by-criteria-page-response.ts | 78 +++-- .../get-instrument-criteria-request-body.ts | 125 ++++--- .../model/get-instrument-types-response.ts | 17 +- .../get-instruments-by-criteria-response.ts | 18 +- client/src/generated/model/index.ts | 28 +- .../src/generated/model/instrument-detail.ts | 101 +++--- client/src/generated/model/jwt-response.ts | 17 +- .../model/list-favorite-response-body.ts | 18 +- .../model/profile-details-response.ts | 41 ++- .../generated/model/registration-request.ts | 41 ++- .../model/remove-favorite-request-body.ts | 17 +- client/src/generated/model/server-error.ts | 17 +- .../username-and-password-request-body.ts | 29 +- client/src/pages/catalogue/api/loader.ts | 17 +- client/src/pages/catalogue/ui/Catalogue.tsx | 33 +- .../pages/instrument/ui/InstrumentActions.tsx | 3 +- 29 files changed, 1555 insertions(+), 1068 deletions(-) diff --git a/client/src/generated/api.ts b/client/src/generated/api.ts index 56385978..46dd793f 100644 --- a/client/src/generated/api.ts +++ b/client/src/generated/api.ts @@ -12,17 +12,14 @@ * Do not edit the class manually. */ - - -export * from './api/add-favorite-api'; -export * from './api/basic-login-api'; -export * from './api/delete-instrument-by-id-api'; -export * from './api/get-instrument-by-id-api'; -export * from './api/get-instrument-types-api'; -export * from './api/get-instruments-by-criteria-api'; -export * from './api/get-instruments-by-criteria-paginated-api'; -export * from './api/get-user-profile-api'; -export * from './api/list-favorite-api'; -export * from './api/remove-favorite-api'; -export * from './api/user-registration-api'; - +export * from "./api/add-favorite-api"; +export * from "./api/basic-login-api"; +export * from "./api/delete-instrument-by-id-api"; +export * from "./api/get-instrument-by-id-api"; +export * from "./api/get-instrument-types-api"; +export * from "./api/get-instruments-by-criteria-api"; +export * from "./api/get-instruments-by-criteria-paginated-api"; +export * from "./api/get-user-profile-api"; +export * from "./api/list-favorite-api"; +export * from "./api/remove-favorite-api"; +export * from "./api/user-registration-api"; diff --git a/client/src/generated/api/basic-login-api.ts b/client/src/generated/api/basic-login-api.ts index 6823ae68..610c3a84 100644 --- a/client/src/generated/api/basic-login-api.ts +++ b/client/src/generated/api/basic-login-api.ts @@ -12,107 +12,171 @@ * Do not edit the class manually. */ - -import type { Configuration } from '../configuration'; -import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios'; -import globalAxios from 'axios'; +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'; +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'; +import { + BASE_PATH, + COLLECTION_FORMATS, + type RequestArgs, + BaseAPI, + RequiredError, + operationServerMap, +} from "../base"; // @ts-ignore -import type { JwtResponse } from '../model'; +import type { JwtResponse } from "../model"; // @ts-ignore -import type { ServerError } from '../model'; +import type { ServerError } from "../model"; // @ts-ignore -import type { UsernameAndPasswordRequestBody } from '../model'; +import type { UsernameAndPasswordRequestBody } from "../model"; /** * BasicLoginApi - axios parameter creator * @export */ -export const BasicLoginApiAxiosParamCreator = function (configuration?: Configuration) { - return { - /** - * Basic Authentication - * @summary Basic Login - * @param {UsernameAndPasswordRequestBody} usernameAndPasswordRequestBody - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - basicLogin: async (usernameAndPasswordRequestBody: UsernameAndPasswordRequestBody, options: RawAxiosRequestConfig = {}): Promise => { - // verify required parameter 'usernameAndPasswordRequestBody' is not null or undefined - assertParamExists('basicLogin', 'usernameAndPasswordRequestBody', usernameAndPasswordRequestBody) - const localVarPath = `/auth/login`; - // 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; +export const BasicLoginApiAxiosParamCreator = function ( + configuration?: Configuration, +) { + return { + /** + * Basic Authentication + * @summary Basic Login + * @param {UsernameAndPasswordRequestBody} usernameAndPasswordRequestBody + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + basicLogin: async ( + usernameAndPasswordRequestBody: UsernameAndPasswordRequestBody, + options: RawAxiosRequestConfig = {}, + ): Promise => { + // verify required parameter 'usernameAndPasswordRequestBody' is not null or undefined + assertParamExists( + "basicLogin", + "usernameAndPasswordRequestBody", + usernameAndPasswordRequestBody, + ); + const localVarPath = `/auth/login`; + // 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'; + localVarHeaderParameter["Content-Type"] = "application/json"; - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - localVarRequestOptions.data = serializeDataIfNeeded(usernameAndPasswordRequestBody, localVarRequestOptions, configuration) + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = + baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + }; + localVarRequestOptions.data = serializeDataIfNeeded( + usernameAndPasswordRequestBody, + localVarRequestOptions, + configuration, + ); - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - } + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + }; }; /** * BasicLoginApi - functional programming interface * @export */ -export const BasicLoginApiFp = function(configuration?: Configuration) { - const localVarAxiosParamCreator = BasicLoginApiAxiosParamCreator(configuration) - return { - /** - * Basic Authentication - * @summary Basic Login - * @param {UsernameAndPasswordRequestBody} usernameAndPasswordRequestBody - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async basicLogin(usernameAndPasswordRequestBody: UsernameAndPasswordRequestBody, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.basicLogin(usernameAndPasswordRequestBody, options); - const localVarOperationServerIndex = configuration?.serverIndex ?? 0; - const localVarOperationServerBasePath = operationServerMap['BasicLoginApi.basicLogin']?.[localVarOperationServerIndex]?.url; - return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); - }, - } +export const BasicLoginApiFp = function (configuration?: Configuration) { + const localVarAxiosParamCreator = + BasicLoginApiAxiosParamCreator(configuration); + return { + /** + * Basic Authentication + * @summary Basic Login + * @param {UsernameAndPasswordRequestBody} usernameAndPasswordRequestBody + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async basicLogin( + usernameAndPasswordRequestBody: UsernameAndPasswordRequestBody, + options?: RawAxiosRequestConfig, + ): Promise< + (axios?: AxiosInstance, basePath?: string) => AxiosPromise + > { + const localVarAxiosArgs = await localVarAxiosParamCreator.basicLogin( + usernameAndPasswordRequestBody, + options, + ); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = + operationServerMap["BasicLoginApi.basicLogin"]?.[ + localVarOperationServerIndex + ]?.url; + return (axios, basePath) => + createRequestFunction( + localVarAxiosArgs, + globalAxios, + BASE_PATH, + configuration, + )(axios, localVarOperationServerBasePath || basePath); + }, + }; }; /** * BasicLoginApi - factory interface * @export */ -export const BasicLoginApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { - const localVarFp = BasicLoginApiFp(configuration) - return { - /** - * Basic Authentication - * @summary Basic Login - * @param {UsernameAndPasswordRequestBody} usernameAndPasswordRequestBody - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - basicLogin(usernameAndPasswordRequestBody: UsernameAndPasswordRequestBody, options?: RawAxiosRequestConfig): AxiosPromise { - return localVarFp.basicLogin(usernameAndPasswordRequestBody, options).then((request) => request(axios, basePath)); - }, - }; +export const BasicLoginApiFactory = function ( + configuration?: Configuration, + basePath?: string, + axios?: AxiosInstance, +) { + const localVarFp = BasicLoginApiFp(configuration); + return { + /** + * Basic Authentication + * @summary Basic Login + * @param {UsernameAndPasswordRequestBody} usernameAndPasswordRequestBody + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + basicLogin( + usernameAndPasswordRequestBody: UsernameAndPasswordRequestBody, + options?: RawAxiosRequestConfig, + ): AxiosPromise { + return localVarFp + .basicLogin(usernameAndPasswordRequestBody, options) + .then((request) => request(axios, basePath)); + }, + }; }; /** @@ -122,16 +186,20 @@ export const BasicLoginApiFactory = function (configuration?: Configuration, bas * @extends {BaseAPI} */ export class BasicLoginApi extends BaseAPI { - /** - * Basic Authentication - * @summary Basic Login - * @param {UsernameAndPasswordRequestBody} usernameAndPasswordRequestBody - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof BasicLoginApi - */ - public basicLogin(usernameAndPasswordRequestBody: UsernameAndPasswordRequestBody, options?: RawAxiosRequestConfig) { - return BasicLoginApiFp(this.configuration).basicLogin(usernameAndPasswordRequestBody, options).then((request) => request(this.axios, this.basePath)); - } + /** + * Basic Authentication + * @summary Basic Login + * @param {UsernameAndPasswordRequestBody} usernameAndPasswordRequestBody + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof BasicLoginApi + */ + public basicLogin( + usernameAndPasswordRequestBody: UsernameAndPasswordRequestBody, + options?: RawAxiosRequestConfig, + ) { + return BasicLoginApiFp(this.configuration) + .basicLogin(usernameAndPasswordRequestBody, options) + .then((request) => request(this.axios, this.basePath)); + } } - diff --git a/client/src/generated/api/get-instrument-by-id-api.ts b/client/src/generated/api/get-instrument-by-id-api.ts index 7f0b1d73..6520a1ce 100644 --- a/client/src/generated/api/get-instrument-by-id-api.ts +++ b/client/src/generated/api/get-instrument-by-id-api.ts @@ -12,105 +12,167 @@ * Do not edit the class manually. */ - -import type { Configuration } from '../configuration'; -import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios'; -import globalAxios from 'axios'; +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'; +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'; +import { + BASE_PATH, + COLLECTION_FORMATS, + type RequestArgs, + BaseAPI, + RequiredError, + operationServerMap, +} from "../base"; // @ts-ignore -import type { ClientError } from '../model'; +import type { ClientError } from "../model"; // @ts-ignore -import type { InstrumentDetail } from '../model'; +import type { InstrumentDetail } from "../model"; // @ts-ignore -import type { ServerError } from '../model'; +import type { ServerError } from "../model"; /** * GetInstrumentByIdApi - axios parameter creator * @export */ -export const GetInstrumentByIdApiAxiosParamCreator = function (configuration?: Configuration) { - return { - /** - * Get Instrument by ID - * @summary Get Instrument by ID - * @param {string} instrumentId Instrument ID - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getInstrumentById: async (instrumentId: string, options: RawAxiosRequestConfig = {}): Promise => { - // verify required parameter 'instrumentId' is not null or undefined - assertParamExists('getInstrumentById', 'instrumentId', instrumentId) - const localVarPath = `/instrument/{instrumentId}` - .replace(`{${"instrumentId"}}`, encodeURIComponent(String(instrumentId))); - // 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; +export const GetInstrumentByIdApiAxiosParamCreator = function ( + configuration?: Configuration, +) { + return { + /** + * Get Instrument by ID + * @summary Get Instrument by ID + * @param {string} instrumentId Instrument ID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getInstrumentById: async ( + instrumentId: string, + options: RawAxiosRequestConfig = {}, + ): Promise => { + // verify required parameter 'instrumentId' is not null or undefined + assertParamExists("getInstrumentById", "instrumentId", instrumentId); + const localVarPath = `/instrument/{instrumentId}`.replace( + `{${"instrumentId"}}`, + encodeURIComponent(String(instrumentId)), + ); + // 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}; + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = + baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + }; - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - } + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + }; }; /** * GetInstrumentByIdApi - functional programming interface * @export */ -export const GetInstrumentByIdApiFp = function(configuration?: Configuration) { - const localVarAxiosParamCreator = GetInstrumentByIdApiAxiosParamCreator(configuration) - return { - /** - * Get Instrument by ID - * @summary Get Instrument by ID - * @param {string} instrumentId Instrument ID - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async getInstrumentById(instrumentId: string, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.getInstrumentById(instrumentId, options); - const localVarOperationServerIndex = configuration?.serverIndex ?? 0; - const localVarOperationServerBasePath = operationServerMap['GetInstrumentByIdApi.getInstrumentById']?.[localVarOperationServerIndex]?.url; - return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); - }, - } +export const GetInstrumentByIdApiFp = function (configuration?: Configuration) { + const localVarAxiosParamCreator = + GetInstrumentByIdApiAxiosParamCreator(configuration); + return { + /** + * Get Instrument by ID + * @summary Get Instrument by ID + * @param {string} instrumentId Instrument ID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getInstrumentById( + instrumentId: string, + options?: RawAxiosRequestConfig, + ): Promise< + ( + axios?: AxiosInstance, + basePath?: string, + ) => AxiosPromise + > { + const localVarAxiosArgs = + await localVarAxiosParamCreator.getInstrumentById( + instrumentId, + options, + ); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = + operationServerMap["GetInstrumentByIdApi.getInstrumentById"]?.[ + localVarOperationServerIndex + ]?.url; + return (axios, basePath) => + createRequestFunction( + localVarAxiosArgs, + globalAxios, + BASE_PATH, + configuration, + )(axios, localVarOperationServerBasePath || basePath); + }, + }; }; /** * GetInstrumentByIdApi - factory interface * @export */ -export const GetInstrumentByIdApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { - const localVarFp = GetInstrumentByIdApiFp(configuration) - return { - /** - * Get Instrument by ID - * @summary Get Instrument by ID - * @param {string} instrumentId Instrument ID - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getInstrumentById(instrumentId: string, options?: RawAxiosRequestConfig): AxiosPromise { - return localVarFp.getInstrumentById(instrumentId, options).then((request) => request(axios, basePath)); - }, - }; +export const GetInstrumentByIdApiFactory = function ( + configuration?: Configuration, + basePath?: string, + axios?: AxiosInstance, +) { + const localVarFp = GetInstrumentByIdApiFp(configuration); + return { + /** + * Get Instrument by ID + * @summary Get Instrument by ID + * @param {string} instrumentId Instrument ID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getInstrumentById( + instrumentId: string, + options?: RawAxiosRequestConfig, + ): AxiosPromise { + return localVarFp + .getInstrumentById(instrumentId, options) + .then((request) => request(axios, basePath)); + }, + }; }; /** @@ -120,16 +182,20 @@ export const GetInstrumentByIdApiFactory = function (configuration?: Configurati * @extends {BaseAPI} */ export class GetInstrumentByIdApi extends BaseAPI { - /** - * Get Instrument by ID - * @summary Get Instrument by ID - * @param {string} instrumentId Instrument ID - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof GetInstrumentByIdApi - */ - public getInstrumentById(instrumentId: string, options?: RawAxiosRequestConfig) { - return GetInstrumentByIdApiFp(this.configuration).getInstrumentById(instrumentId, options).then((request) => request(this.axios, this.basePath)); - } + /** + * Get Instrument by ID + * @summary Get Instrument by ID + * @param {string} instrumentId Instrument ID + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof GetInstrumentByIdApi + */ + public getInstrumentById( + instrumentId: string, + options?: RawAxiosRequestConfig, + ) { + return GetInstrumentByIdApiFp(this.configuration) + .getInstrumentById(instrumentId, options) + .then((request) => request(this.axios, this.basePath)); + } } - diff --git a/client/src/generated/api/get-instrument-types-api.ts b/client/src/generated/api/get-instrument-types-api.ts index 30a848b7..f15be6ba 100644 --- a/client/src/generated/api/get-instrument-types-api.ts +++ b/client/src/generated/api/get-instrument-types-api.ts @@ -12,99 +12,155 @@ * Do not edit the class manually. */ - -import type { Configuration } from '../configuration'; -import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios'; -import globalAxios from 'axios'; +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'; +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'; +import { + BASE_PATH, + COLLECTION_FORMATS, + type RequestArgs, + BaseAPI, + RequiredError, + operationServerMap, +} from "../base"; // @ts-ignore -import type { ClientError } from '../model'; +import type { ClientError } from "../model"; // @ts-ignore -import type { GetInstrumentTypesResponse } from '../model'; +import type { GetInstrumentTypesResponse } from "../model"; // @ts-ignore -import type { ServerError } from '../model'; +import type { ServerError } from "../model"; /** * GetInstrumentTypesApi - axios parameter creator * @export */ -export const GetInstrumentTypesApiAxiosParamCreator = function (configuration?: Configuration) { - return { - /** - * Get Instrument Types - * @summary Get Instrument Types - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getInstrumentTypes: async (options: RawAxiosRequestConfig = {}): Promise => { - const localVarPath = `/instrument/types`; - // 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; +export const GetInstrumentTypesApiAxiosParamCreator = function ( + configuration?: Configuration, +) { + return { + /** + * Get Instrument Types + * @summary Get Instrument Types + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getInstrumentTypes: async ( + options: RawAxiosRequestConfig = {}, + ): Promise => { + const localVarPath = `/instrument/types`; + // 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}; + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = + baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + }; - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - } + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + }; }; /** * GetInstrumentTypesApi - functional programming interface * @export */ -export const GetInstrumentTypesApiFp = function(configuration?: Configuration) { - const localVarAxiosParamCreator = GetInstrumentTypesApiAxiosParamCreator(configuration) - return { - /** - * Get Instrument Types - * @summary Get Instrument Types - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async getInstrumentTypes(options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.getInstrumentTypes(options); - const localVarOperationServerIndex = configuration?.serverIndex ?? 0; - const localVarOperationServerBasePath = operationServerMap['GetInstrumentTypesApi.getInstrumentTypes']?.[localVarOperationServerIndex]?.url; - return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); - }, - } +export const GetInstrumentTypesApiFp = function ( + configuration?: Configuration, +) { + const localVarAxiosParamCreator = + GetInstrumentTypesApiAxiosParamCreator(configuration); + return { + /** + * Get Instrument Types + * @summary Get Instrument Types + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getInstrumentTypes( + options?: RawAxiosRequestConfig, + ): Promise< + ( + axios?: AxiosInstance, + basePath?: string, + ) => AxiosPromise + > { + const localVarAxiosArgs = + await localVarAxiosParamCreator.getInstrumentTypes(options); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = + operationServerMap["GetInstrumentTypesApi.getInstrumentTypes"]?.[ + localVarOperationServerIndex + ]?.url; + return (axios, basePath) => + createRequestFunction( + localVarAxiosArgs, + globalAxios, + BASE_PATH, + configuration, + )(axios, localVarOperationServerBasePath || basePath); + }, + }; }; /** * GetInstrumentTypesApi - factory interface * @export */ -export const GetInstrumentTypesApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { - const localVarFp = GetInstrumentTypesApiFp(configuration) - return { - /** - * Get Instrument Types - * @summary Get Instrument Types - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getInstrumentTypes(options?: RawAxiosRequestConfig): AxiosPromise { - return localVarFp.getInstrumentTypes(options).then((request) => request(axios, basePath)); - }, - }; +export const GetInstrumentTypesApiFactory = function ( + configuration?: Configuration, + basePath?: string, + axios?: AxiosInstance, +) { + const localVarFp = GetInstrumentTypesApiFp(configuration); + return { + /** + * Get Instrument Types + * @summary Get Instrument Types + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getInstrumentTypes( + options?: RawAxiosRequestConfig, + ): AxiosPromise { + return localVarFp + .getInstrumentTypes(options) + .then((request) => request(axios, basePath)); + }, + }; }; /** @@ -114,15 +170,16 @@ export const GetInstrumentTypesApiFactory = function (configuration?: Configurat * @extends {BaseAPI} */ export class GetInstrumentTypesApi extends BaseAPI { - /** - * Get Instrument Types - * @summary Get Instrument Types - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof GetInstrumentTypesApi - */ - public getInstrumentTypes(options?: RawAxiosRequestConfig) { - return GetInstrumentTypesApiFp(this.configuration).getInstrumentTypes(options).then((request) => request(this.axios, this.basePath)); - } + /** + * Get Instrument Types + * @summary Get Instrument Types + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof GetInstrumentTypesApi + */ + public getInstrumentTypes(options?: RawAxiosRequestConfig) { + return GetInstrumentTypesApiFp(this.configuration) + .getInstrumentTypes(options) + .then((request) => request(this.axios, this.basePath)); + } } - diff --git a/client/src/generated/api/get-instruments-by-criteria-api.ts b/client/src/generated/api/get-instruments-by-criteria-api.ts index 8f91e226..8d9d1858 100644 --- a/client/src/generated/api/get-instruments-by-criteria-api.ts +++ b/client/src/generated/api/get-instruments-by-criteria-api.ts @@ -12,109 +12,179 @@ * Do not edit the class manually. */ - -import type { Configuration } from '../configuration'; -import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios'; -import globalAxios from 'axios'; +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'; +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'; +import { + BASE_PATH, + COLLECTION_FORMATS, + type RequestArgs, + BaseAPI, + RequiredError, + operationServerMap, +} from "../base"; // @ts-ignore -import type { ClientError } from '../model'; +import type { ClientError } from "../model"; // @ts-ignore -import type { GetInstrumentCriteriaRequestBody } from '../model'; +import type { GetInstrumentCriteriaRequestBody } from "../model"; // @ts-ignore -import type { GetInstrumentsByCriteriaResponse } from '../model'; +import type { GetInstrumentsByCriteriaResponse } from "../model"; // @ts-ignore -import type { ServerError } from '../model'; +import type { ServerError } from "../model"; /** * GetInstrumentsByCriteriaApi - axios parameter creator * @export */ -export const GetInstrumentsByCriteriaApiAxiosParamCreator = function (configuration?: Configuration) { - return { - /** - * Get Instruments by Criteria - * @summary Get Instruments by Criteria - * @param {GetInstrumentCriteriaRequestBody} getInstrumentCriteriaRequestBody - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getInstrumentsByCriteria: async (getInstrumentCriteriaRequestBody: GetInstrumentCriteriaRequestBody, options: RawAxiosRequestConfig = {}): Promise => { - // verify required parameter 'getInstrumentCriteriaRequestBody' is not null or undefined - assertParamExists('getInstrumentsByCriteria', 'getInstrumentCriteriaRequestBody', getInstrumentCriteriaRequestBody) - const localVarPath = `/instruments`; - // 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; +export const GetInstrumentsByCriteriaApiAxiosParamCreator = function ( + configuration?: Configuration, +) { + return { + /** + * Get Instruments by Criteria + * @summary Get Instruments by Criteria + * @param {GetInstrumentCriteriaRequestBody} getInstrumentCriteriaRequestBody + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getInstrumentsByCriteria: async ( + getInstrumentCriteriaRequestBody: GetInstrumentCriteriaRequestBody, + options: RawAxiosRequestConfig = {}, + ): Promise => { + // verify required parameter 'getInstrumentCriteriaRequestBody' is not null or undefined + assertParamExists( + "getInstrumentsByCriteria", + "getInstrumentCriteriaRequestBody", + getInstrumentCriteriaRequestBody, + ); + const localVarPath = `/instruments`; + // 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'; + localVarHeaderParameter["Content-Type"] = "application/json"; - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - localVarRequestOptions.data = serializeDataIfNeeded(getInstrumentCriteriaRequestBody, localVarRequestOptions, configuration) + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = + baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + }; + localVarRequestOptions.data = serializeDataIfNeeded( + getInstrumentCriteriaRequestBody, + localVarRequestOptions, + configuration, + ); - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - } + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + }; }; /** * GetInstrumentsByCriteriaApi - functional programming interface * @export */ -export const GetInstrumentsByCriteriaApiFp = function(configuration?: Configuration) { - const localVarAxiosParamCreator = GetInstrumentsByCriteriaApiAxiosParamCreator(configuration) - return { - /** - * Get Instruments by Criteria - * @summary Get Instruments by Criteria - * @param {GetInstrumentCriteriaRequestBody} getInstrumentCriteriaRequestBody - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async getInstrumentsByCriteria(getInstrumentCriteriaRequestBody: GetInstrumentCriteriaRequestBody, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.getInstrumentsByCriteria(getInstrumentCriteriaRequestBody, options); - const localVarOperationServerIndex = configuration?.serverIndex ?? 0; - const localVarOperationServerBasePath = operationServerMap['GetInstrumentsByCriteriaApi.getInstrumentsByCriteria']?.[localVarOperationServerIndex]?.url; - return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); - }, - } +export const GetInstrumentsByCriteriaApiFp = function ( + configuration?: Configuration, +) { + const localVarAxiosParamCreator = + GetInstrumentsByCriteriaApiAxiosParamCreator(configuration); + return { + /** + * Get Instruments by Criteria + * @summary Get Instruments by Criteria + * @param {GetInstrumentCriteriaRequestBody} getInstrumentCriteriaRequestBody + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getInstrumentsByCriteria( + getInstrumentCriteriaRequestBody: GetInstrumentCriteriaRequestBody, + options?: RawAxiosRequestConfig, + ): Promise< + ( + axios?: AxiosInstance, + basePath?: string, + ) => AxiosPromise + > { + const localVarAxiosArgs = + await localVarAxiosParamCreator.getInstrumentsByCriteria( + getInstrumentCriteriaRequestBody, + options, + ); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = + operationServerMap[ + "GetInstrumentsByCriteriaApi.getInstrumentsByCriteria" + ]?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => + createRequestFunction( + localVarAxiosArgs, + globalAxios, + BASE_PATH, + configuration, + )(axios, localVarOperationServerBasePath || basePath); + }, + }; }; /** * GetInstrumentsByCriteriaApi - factory interface * @export */ -export const GetInstrumentsByCriteriaApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { - const localVarFp = GetInstrumentsByCriteriaApiFp(configuration) - return { - /** - * Get Instruments by Criteria - * @summary Get Instruments by Criteria - * @param {GetInstrumentCriteriaRequestBody} getInstrumentCriteriaRequestBody - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getInstrumentsByCriteria(getInstrumentCriteriaRequestBody: GetInstrumentCriteriaRequestBody, options?: RawAxiosRequestConfig): AxiosPromise { - return localVarFp.getInstrumentsByCriteria(getInstrumentCriteriaRequestBody, options).then((request) => request(axios, basePath)); - }, - }; +export const GetInstrumentsByCriteriaApiFactory = function ( + configuration?: Configuration, + basePath?: string, + axios?: AxiosInstance, +) { + const localVarFp = GetInstrumentsByCriteriaApiFp(configuration); + return { + /** + * Get Instruments by Criteria + * @summary Get Instruments by Criteria + * @param {GetInstrumentCriteriaRequestBody} getInstrumentCriteriaRequestBody + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getInstrumentsByCriteria( + getInstrumentCriteriaRequestBody: GetInstrumentCriteriaRequestBody, + options?: RawAxiosRequestConfig, + ): AxiosPromise { + return localVarFp + .getInstrumentsByCriteria(getInstrumentCriteriaRequestBody, options) + .then((request) => request(axios, basePath)); + }, + }; }; /** @@ -124,16 +194,20 @@ export const GetInstrumentsByCriteriaApiFactory = function (configuration?: Conf * @extends {BaseAPI} */ export class GetInstrumentsByCriteriaApi extends BaseAPI { - /** - * Get Instruments by Criteria - * @summary Get Instruments by Criteria - * @param {GetInstrumentCriteriaRequestBody} getInstrumentCriteriaRequestBody - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof GetInstrumentsByCriteriaApi - */ - public getInstrumentsByCriteria(getInstrumentCriteriaRequestBody: GetInstrumentCriteriaRequestBody, options?: RawAxiosRequestConfig) { - return GetInstrumentsByCriteriaApiFp(this.configuration).getInstrumentsByCriteria(getInstrumentCriteriaRequestBody, options).then((request) => request(this.axios, this.basePath)); - } + /** + * Get Instruments by Criteria + * @summary Get Instruments by Criteria + * @param {GetInstrumentCriteriaRequestBody} getInstrumentCriteriaRequestBody + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof GetInstrumentsByCriteriaApi + */ + public getInstrumentsByCriteria( + getInstrumentCriteriaRequestBody: GetInstrumentCriteriaRequestBody, + options?: RawAxiosRequestConfig, + ) { + return GetInstrumentsByCriteriaApiFp(this.configuration) + .getInstrumentsByCriteria(getInstrumentCriteriaRequestBody, options) + .then((request) => request(this.axios, this.basePath)); + } } - diff --git a/client/src/generated/api/get-instruments-by-criteria-paginated-api.ts b/client/src/generated/api/get-instruments-by-criteria-paginated-api.ts index 68d40a42..1f6c7b84 100644 --- a/client/src/generated/api/get-instruments-by-criteria-paginated-api.ts +++ b/client/src/generated/api/get-instruments-by-criteria-paginated-api.ts @@ -12,127 +12,218 @@ * Do not edit the class manually. */ - -import type { Configuration } from '../configuration'; -import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios'; -import globalAxios from 'axios'; +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'; +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'; +import { + BASE_PATH, + COLLECTION_FORMATS, + type RequestArgs, + BaseAPI, + RequiredError, + operationServerMap, +} from "../base"; // @ts-ignore -import type { ClientError } from '../model'; +import type { ClientError } from "../model"; // @ts-ignore -import type { GetInstrumentByCriteriaPageResponse } from '../model'; +import type { GetInstrumentByCriteriaPageResponse } from "../model"; // @ts-ignore -import type { GetInstrumentCriteriaRequestBody } from '../model'; +import type { GetInstrumentCriteriaRequestBody } from "../model"; // @ts-ignore -import type { ServerError } from '../model'; +import type { ServerError } from "../model"; /** * GetInstrumentsByCriteriaPaginatedApi - axios parameter creator * @export */ -export const GetInstrumentsByCriteriaPaginatedApiAxiosParamCreator = function (configuration?: Configuration) { - return { - /** - * Get Instruments by Criteria Paginated - * @summary Get Instruments by Criteria Paginated - * @param {number} pageSize Page Size - * @param {number} pageNumber Page Number (1-based enumeration) - * @param {GetInstrumentCriteriaRequestBody} getInstrumentCriteriaRequestBody - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getInstrumentsByCriteriaPaginated: async (pageSize: number, pageNumber: number, getInstrumentCriteriaRequestBody: GetInstrumentCriteriaRequestBody, options: RawAxiosRequestConfig = {}): Promise => { - // verify required parameter 'pageSize' is not null or undefined - assertParamExists('getInstrumentsByCriteriaPaginated', 'pageSize', pageSize) - // verify required parameter 'pageNumber' is not null or undefined - assertParamExists('getInstrumentsByCriteriaPaginated', 'pageNumber', pageNumber) - // verify required parameter 'getInstrumentCriteriaRequestBody' is not null or undefined - assertParamExists('getInstrumentsByCriteriaPaginated', 'getInstrumentCriteriaRequestBody', getInstrumentCriteriaRequestBody) - const localVarPath = `/instruments/paginated`; - // 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; +export const GetInstrumentsByCriteriaPaginatedApiAxiosParamCreator = function ( + configuration?: Configuration, +) { + return { + /** + * Get Instruments by Criteria Paginated + * @summary Get Instruments by Criteria Paginated + * @param {number} pageSize Page Size + * @param {number} pageNumber Page Number (1-based enumeration) + * @param {GetInstrumentCriteriaRequestBody} getInstrumentCriteriaRequestBody + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getInstrumentsByCriteriaPaginated: async ( + pageSize: number, + pageNumber: number, + getInstrumentCriteriaRequestBody: GetInstrumentCriteriaRequestBody, + options: RawAxiosRequestConfig = {}, + ): Promise => { + // verify required parameter 'pageSize' is not null or undefined + assertParamExists( + "getInstrumentsByCriteriaPaginated", + "pageSize", + pageSize, + ); + // verify required parameter 'pageNumber' is not null or undefined + assertParamExists( + "getInstrumentsByCriteriaPaginated", + "pageNumber", + pageNumber, + ); + // verify required parameter 'getInstrumentCriteriaRequestBody' is not null or undefined + assertParamExists( + "getInstrumentsByCriteriaPaginated", + "getInstrumentCriteriaRequestBody", + getInstrumentCriteriaRequestBody, + ); + const localVarPath = `/instruments/paginated`; + // 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; + } - if (pageSize !== undefined) { - localVarQueryParameter['page_size'] = pageSize; - } + const localVarRequestOptions = { + method: "POST", + ...baseOptions, + ...options, + }; + const localVarHeaderParameter = {} as any; + const localVarQueryParameter = {} as any; - if (pageNumber !== undefined) { - localVarQueryParameter['page_number'] = pageNumber; - } + if (pageSize !== undefined) { + localVarQueryParameter["page_size"] = pageSize; + } + if (pageNumber !== undefined) { + localVarQueryParameter["page_number"] = pageNumber; + } - - localVarHeaderParameter['Content-Type'] = 'application/json'; + localVarHeaderParameter["Content-Type"] = "application/json"; - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - localVarRequestOptions.data = serializeDataIfNeeded(getInstrumentCriteriaRequestBody, localVarRequestOptions, configuration) + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = + baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + }; + localVarRequestOptions.data = serializeDataIfNeeded( + getInstrumentCriteriaRequestBody, + localVarRequestOptions, + configuration, + ); - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - } + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + }; }; /** * GetInstrumentsByCriteriaPaginatedApi - functional programming interface * @export */ -export const GetInstrumentsByCriteriaPaginatedApiFp = function(configuration?: Configuration) { - const localVarAxiosParamCreator = GetInstrumentsByCriteriaPaginatedApiAxiosParamCreator(configuration) - return { - /** - * Get Instruments by Criteria Paginated - * @summary Get Instruments by Criteria Paginated - * @param {number} pageSize Page Size - * @param {number} pageNumber Page Number (1-based enumeration) - * @param {GetInstrumentCriteriaRequestBody} getInstrumentCriteriaRequestBody - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async getInstrumentsByCriteriaPaginated(pageSize: number, pageNumber: number, getInstrumentCriteriaRequestBody: GetInstrumentCriteriaRequestBody, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.getInstrumentsByCriteriaPaginated(pageSize, pageNumber, getInstrumentCriteriaRequestBody, options); - const localVarOperationServerIndex = configuration?.serverIndex ?? 0; - const localVarOperationServerBasePath = operationServerMap['GetInstrumentsByCriteriaPaginatedApi.getInstrumentsByCriteriaPaginated']?.[localVarOperationServerIndex]?.url; - return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); - }, - } +export const GetInstrumentsByCriteriaPaginatedApiFp = function ( + configuration?: Configuration, +) { + const localVarAxiosParamCreator = + GetInstrumentsByCriteriaPaginatedApiAxiosParamCreator(configuration); + return { + /** + * Get Instruments by Criteria Paginated + * @summary Get Instruments by Criteria Paginated + * @param {number} pageSize Page Size + * @param {number} pageNumber Page Number (1-based enumeration) + * @param {GetInstrumentCriteriaRequestBody} getInstrumentCriteriaRequestBody + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async getInstrumentsByCriteriaPaginated( + pageSize: number, + pageNumber: number, + getInstrumentCriteriaRequestBody: GetInstrumentCriteriaRequestBody, + options?: RawAxiosRequestConfig, + ): Promise< + ( + axios?: AxiosInstance, + basePath?: string, + ) => AxiosPromise + > { + const localVarAxiosArgs = + await localVarAxiosParamCreator.getInstrumentsByCriteriaPaginated( + pageSize, + pageNumber, + getInstrumentCriteriaRequestBody, + options, + ); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = + operationServerMap[ + "GetInstrumentsByCriteriaPaginatedApi.getInstrumentsByCriteriaPaginated" + ]?.[localVarOperationServerIndex]?.url; + return (axios, basePath) => + createRequestFunction( + localVarAxiosArgs, + globalAxios, + BASE_PATH, + configuration, + )(axios, localVarOperationServerBasePath || basePath); + }, + }; }; /** * GetInstrumentsByCriteriaPaginatedApi - factory interface * @export */ -export const GetInstrumentsByCriteriaPaginatedApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { - const localVarFp = GetInstrumentsByCriteriaPaginatedApiFp(configuration) - return { - /** - * Get Instruments by Criteria Paginated - * @summary Get Instruments by Criteria Paginated - * @param {number} pageSize Page Size - * @param {number} pageNumber Page Number (1-based enumeration) - * @param {GetInstrumentCriteriaRequestBody} getInstrumentCriteriaRequestBody - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - getInstrumentsByCriteriaPaginated(pageSize: number, pageNumber: number, getInstrumentCriteriaRequestBody: GetInstrumentCriteriaRequestBody, options?: RawAxiosRequestConfig): AxiosPromise { - return localVarFp.getInstrumentsByCriteriaPaginated(pageSize, pageNumber, getInstrumentCriteriaRequestBody, options).then((request) => request(axios, basePath)); - }, - }; +export const GetInstrumentsByCriteriaPaginatedApiFactory = function ( + configuration?: Configuration, + basePath?: string, + axios?: AxiosInstance, +) { + const localVarFp = GetInstrumentsByCriteriaPaginatedApiFp(configuration); + return { + /** + * Get Instruments by Criteria Paginated + * @summary Get Instruments by Criteria Paginated + * @param {number} pageSize Page Size + * @param {number} pageNumber Page Number (1-based enumeration) + * @param {GetInstrumentCriteriaRequestBody} getInstrumentCriteriaRequestBody + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + getInstrumentsByCriteriaPaginated( + pageSize: number, + pageNumber: number, + getInstrumentCriteriaRequestBody: GetInstrumentCriteriaRequestBody, + options?: RawAxiosRequestConfig, + ): AxiosPromise { + return localVarFp + .getInstrumentsByCriteriaPaginated( + pageSize, + pageNumber, + getInstrumentCriteriaRequestBody, + options, + ) + .then((request) => request(axios, basePath)); + }, + }; }; /** @@ -142,18 +233,29 @@ export const GetInstrumentsByCriteriaPaginatedApiFactory = function (configurati * @extends {BaseAPI} */ export class GetInstrumentsByCriteriaPaginatedApi extends BaseAPI { - /** - * Get Instruments by Criteria Paginated - * @summary Get Instruments by Criteria Paginated - * @param {number} pageSize Page Size - * @param {number} pageNumber Page Number (1-based enumeration) - * @param {GetInstrumentCriteriaRequestBody} getInstrumentCriteriaRequestBody - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof GetInstrumentsByCriteriaPaginatedApi - */ - public getInstrumentsByCriteriaPaginated(pageSize: number, pageNumber: number, getInstrumentCriteriaRequestBody: GetInstrumentCriteriaRequestBody, options?: RawAxiosRequestConfig) { - return GetInstrumentsByCriteriaPaginatedApiFp(this.configuration).getInstrumentsByCriteriaPaginated(pageSize, pageNumber, getInstrumentCriteriaRequestBody, options).then((request) => request(this.axios, this.basePath)); - } + /** + * Get Instruments by Criteria Paginated + * @summary Get Instruments by Criteria Paginated + * @param {number} pageSize Page Size + * @param {number} pageNumber Page Number (1-based enumeration) + * @param {GetInstrumentCriteriaRequestBody} getInstrumentCriteriaRequestBody + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof GetInstrumentsByCriteriaPaginatedApi + */ + public getInstrumentsByCriteriaPaginated( + pageSize: number, + pageNumber: number, + getInstrumentCriteriaRequestBody: GetInstrumentCriteriaRequestBody, + options?: RawAxiosRequestConfig, + ) { + return GetInstrumentsByCriteriaPaginatedApiFp(this.configuration) + .getInstrumentsByCriteriaPaginated( + pageSize, + pageNumber, + getInstrumentCriteriaRequestBody, + options, + ) + .then((request) => request(this.axios, this.basePath)); + } } - diff --git a/client/src/generated/api/user-registration-api.ts b/client/src/generated/api/user-registration-api.ts index d321fb27..0c151b7e 100644 --- a/client/src/generated/api/user-registration-api.ts +++ b/client/src/generated/api/user-registration-api.ts @@ -12,105 +12,170 @@ * Do not edit the class manually. */ - -import type { Configuration } from '../configuration'; -import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios'; -import globalAxios from 'axios'; +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'; +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'; +import { + BASE_PATH, + COLLECTION_FORMATS, + type RequestArgs, + BaseAPI, + RequiredError, + operationServerMap, +} from "../base"; // @ts-ignore -import type { RegistrationRequest } from '../model'; +import type { RegistrationRequest } from "../model"; // @ts-ignore -import type { ServerError } from '../model'; +import type { ServerError } from "../model"; /** * UserRegistrationApi - axios parameter creator * @export */ -export const UserRegistrationApiAxiosParamCreator = function (configuration?: Configuration) { - return { - /** - * Register User - * @summary User Registration - * @param {RegistrationRequest} registrationRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - userRegistration: async (registrationRequest: RegistrationRequest, options: RawAxiosRequestConfig = {}): Promise => { - // verify required parameter 'registrationRequest' is not null or undefined - assertParamExists('userRegistration', 'registrationRequest', registrationRequest) - const localVarPath = `/registration`; - // 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; +export const UserRegistrationApiAxiosParamCreator = function ( + configuration?: Configuration, +) { + return { + /** + * Register User + * @summary User Registration + * @param {RegistrationRequest} registrationRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + userRegistration: async ( + registrationRequest: RegistrationRequest, + options: RawAxiosRequestConfig = {}, + ): Promise => { + // verify required parameter 'registrationRequest' is not null or undefined + assertParamExists( + "userRegistration", + "registrationRequest", + registrationRequest, + ); + const localVarPath = `/registration`; + // 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'; + localVarHeaderParameter["Content-Type"] = "application/json"; - setSearchParams(localVarUrlObj, localVarQueryParameter); - let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; - localVarRequestOptions.headers = {...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers}; - localVarRequestOptions.data = serializeDataIfNeeded(registrationRequest, localVarRequestOptions, configuration) + setSearchParams(localVarUrlObj, localVarQueryParameter); + let headersFromBaseOptions = + baseOptions && baseOptions.headers ? baseOptions.headers : {}; + localVarRequestOptions.headers = { + ...localVarHeaderParameter, + ...headersFromBaseOptions, + ...options.headers, + }; + localVarRequestOptions.data = serializeDataIfNeeded( + registrationRequest, + localVarRequestOptions, + configuration, + ); - return { - url: toPathString(localVarUrlObj), - options: localVarRequestOptions, - }; - }, - } + return { + url: toPathString(localVarUrlObj), + options: localVarRequestOptions, + }; + }, + }; }; /** * UserRegistrationApi - functional programming interface * @export */ -export const UserRegistrationApiFp = function(configuration?: Configuration) { - const localVarAxiosParamCreator = UserRegistrationApiAxiosParamCreator(configuration) - return { - /** - * Register User - * @summary User Registration - * @param {RegistrationRequest} registrationRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - async userRegistration(registrationRequest: RegistrationRequest, options?: RawAxiosRequestConfig): Promise<(axios?: AxiosInstance, basePath?: string) => AxiosPromise> { - const localVarAxiosArgs = await localVarAxiosParamCreator.userRegistration(registrationRequest, options); - const localVarOperationServerIndex = configuration?.serverIndex ?? 0; - const localVarOperationServerBasePath = operationServerMap['UserRegistrationApi.userRegistration']?.[localVarOperationServerIndex]?.url; - return (axios, basePath) => createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration)(axios, localVarOperationServerBasePath || basePath); - }, - } +export const UserRegistrationApiFp = function (configuration?: Configuration) { + const localVarAxiosParamCreator = + UserRegistrationApiAxiosParamCreator(configuration); + return { + /** + * Register User + * @summary User Registration + * @param {RegistrationRequest} registrationRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + async userRegistration( + registrationRequest: RegistrationRequest, + options?: RawAxiosRequestConfig, + ): Promise< + (axios?: AxiosInstance, basePath?: string) => AxiosPromise + > { + const localVarAxiosArgs = + await localVarAxiosParamCreator.userRegistration( + registrationRequest, + options, + ); + const localVarOperationServerIndex = configuration?.serverIndex ?? 0; + const localVarOperationServerBasePath = + operationServerMap["UserRegistrationApi.userRegistration"]?.[ + localVarOperationServerIndex + ]?.url; + return (axios, basePath) => + createRequestFunction( + localVarAxiosArgs, + globalAxios, + BASE_PATH, + configuration, + )(axios, localVarOperationServerBasePath || basePath); + }, + }; }; /** * UserRegistrationApi - factory interface * @export */ -export const UserRegistrationApiFactory = function (configuration?: Configuration, basePath?: string, axios?: AxiosInstance) { - const localVarFp = UserRegistrationApiFp(configuration) - return { - /** - * Register User - * @summary User Registration - * @param {RegistrationRequest} registrationRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - */ - userRegistration(registrationRequest: RegistrationRequest, options?: RawAxiosRequestConfig): AxiosPromise { - return localVarFp.userRegistration(registrationRequest, options).then((request) => request(axios, basePath)); - }, - }; +export const UserRegistrationApiFactory = function ( + configuration?: Configuration, + basePath?: string, + axios?: AxiosInstance, +) { + const localVarFp = UserRegistrationApiFp(configuration); + return { + /** + * Register User + * @summary User Registration + * @param {RegistrationRequest} registrationRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + */ + userRegistration( + registrationRequest: RegistrationRequest, + options?: RawAxiosRequestConfig, + ): AxiosPromise { + return localVarFp + .userRegistration(registrationRequest, options) + .then((request) => request(axios, basePath)); + }, + }; }; /** @@ -120,16 +185,20 @@ export const UserRegistrationApiFactory = function (configuration?: Configuratio * @extends {BaseAPI} */ export class UserRegistrationApi extends BaseAPI { - /** - * Register User - * @summary User Registration - * @param {RegistrationRequest} registrationRequest - * @param {*} [options] Override http request option. - * @throws {RequiredError} - * @memberof UserRegistrationApi - */ - public userRegistration(registrationRequest: RegistrationRequest, options?: RawAxiosRequestConfig) { - return UserRegistrationApiFp(this.configuration).userRegistration(registrationRequest, options).then((request) => request(this.axios, this.basePath)); - } + /** + * Register User + * @summary User Registration + * @param {RegistrationRequest} registrationRequest + * @param {*} [options] Override http request option. + * @throws {RequiredError} + * @memberof UserRegistrationApi + */ + public userRegistration( + registrationRequest: RegistrationRequest, + options?: RawAxiosRequestConfig, + ) { + return UserRegistrationApiFp(this.configuration) + .userRegistration(registrationRequest, options) + .then((request) => request(this.axios, this.basePath)); + } } - diff --git a/client/src/generated/base.ts b/client/src/generated/base.ts index 22fbb303..15c4c9d8 100644 --- a/client/src/generated/base.ts +++ b/client/src/generated/base.ts @@ -12,12 +12,11 @@ * Do not edit the class manually. */ - -import type { Configuration } from './configuration'; +import type { Configuration } from "./configuration"; // Some imports not used depending on template conditions // @ts-ignore -import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios'; -import globalAxios from 'axios'; +import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from "axios"; +import globalAxios from "axios"; export const BASE_PATH = "http://localhost:8080/api".replace(/\/+$/, ""); @@ -26,10 +25,10 @@ export const BASE_PATH = "http://localhost:8080/api".replace(/\/+$/, ""); * @export */ export const COLLECTION_FORMATS = { - csv: ",", - ssv: " ", - tsv: "\t", - pipes: "|", + csv: ",", + ssv: " ", + tsv: "\t", + pipes: "|", }; /** @@ -38,8 +37,8 @@ export const COLLECTION_FORMATS = { * @interface RequestArgs */ export interface RequestArgs { - url: string; - options: RawAxiosRequestConfig; + url: string; + options: RawAxiosRequestConfig; } /** @@ -48,15 +47,19 @@ export interface RequestArgs { * @class BaseAPI */ export class BaseAPI { - protected configuration: Configuration | undefined; + protected configuration: Configuration | undefined; - constructor(configuration?: Configuration, protected basePath: string = BASE_PATH, protected axios: AxiosInstance = globalAxios) { - if (configuration) { - this.configuration = configuration; - this.basePath = configuration.basePath ?? basePath; - } + constructor( + configuration?: Configuration, + protected basePath: string = BASE_PATH, + protected axios: AxiosInstance = globalAxios, + ) { + if (configuration) { + this.configuration = configuration; + this.basePath = configuration.basePath ?? basePath; } -}; + } +} /** * @@ -65,22 +68,24 @@ export class BaseAPI { * @extends {Error} */ export class RequiredError extends Error { - constructor(public field: string, msg?: string) { - super(msg); - this.name = "RequiredError" - } + constructor( + public field: string, + msg?: string, + ) { + super(msg); + this.name = "RequiredError"; + } } interface ServerMap { - [key: string]: { - url: string, - description: string, - }[]; + [key: string]: { + url: string; + description: string; + }[]; } /** * * @export */ -export const operationServerMap: ServerMap = { -} +export const operationServerMap: ServerMap = {}; diff --git a/client/src/generated/common.ts b/client/src/generated/common.ts index 6620ffaf..4b31eed7 100644 --- a/client/src/generated/common.ts +++ b/client/src/generated/common.ts @@ -12,98 +12,132 @@ * Do not edit the class manually. */ - import type { Configuration } from "./configuration"; import type { RequestArgs } from "./base"; -import type { AxiosInstance, AxiosResponse } from 'axios'; +import type { AxiosInstance, AxiosResponse } from "axios"; import { RequiredError } from "./base"; /** * * @export */ -export const DUMMY_BASE_URL = 'https://example.com' +export const DUMMY_BASE_URL = "https://example.com"; /** * * @throws {RequiredError} * @export */ -export const assertParamExists = function (functionName: string, paramName: string, paramValue: unknown) { - if (paramValue === null || paramValue === undefined) { - throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`); - } -} +export const assertParamExists = function ( + functionName: string, + paramName: string, + paramValue: unknown, +) { + if (paramValue === null || paramValue === undefined) { + throw new RequiredError( + paramName, + `Required parameter ${paramName} was null or undefined when calling ${functionName}.`, + ); + } +}; /** * * @export */ -export const setApiKeyToObject = async function (object: any, keyParamName: string, configuration?: Configuration) { - if (configuration && configuration.apiKey) { - const localVarApiKeyValue = typeof configuration.apiKey === 'function' - ? await configuration.apiKey(keyParamName) - : await configuration.apiKey; - object[keyParamName] = localVarApiKeyValue; - } -} +export const setApiKeyToObject = async function ( + object: any, + keyParamName: string, + configuration?: Configuration, +) { + if (configuration && configuration.apiKey) { + const localVarApiKeyValue = + typeof configuration.apiKey === "function" + ? await configuration.apiKey(keyParamName) + : await configuration.apiKey; + object[keyParamName] = localVarApiKeyValue; + } +}; /** * * @export */ -export const setBasicAuthToObject = function (object: any, configuration?: Configuration) { - if (configuration && (configuration.username || configuration.password)) { - object["auth"] = { username: configuration.username, password: configuration.password }; - } -} +export const setBasicAuthToObject = function ( + object: any, + configuration?: Configuration, +) { + if (configuration && (configuration.username || configuration.password)) { + object["auth"] = { + username: configuration.username, + password: configuration.password, + }; + } +}; /** * * @export */ -export const setBearerAuthToObject = async function (object: any, configuration?: Configuration) { - if (configuration && configuration.accessToken) { - const accessToken = typeof configuration.accessToken === 'function' - ? await configuration.accessToken() - : await configuration.accessToken; - object["Authorization"] = "Bearer " + accessToken; - } -} +export const setBearerAuthToObject = async function ( + object: any, + configuration?: Configuration, +) { + if (configuration && configuration.accessToken) { + const accessToken = + typeof configuration.accessToken === "function" + ? await configuration.accessToken() + : await configuration.accessToken; + object["Authorization"] = "Bearer " + accessToken; + } +}; /** * * @export */ -export const setOAuthToObject = async function (object: any, name: string, scopes: string[], configuration?: Configuration) { - if (configuration && configuration.accessToken) { - const localVarAccessTokenValue = typeof configuration.accessToken === 'function' - ? await configuration.accessToken(name, scopes) - : await configuration.accessToken; - object["Authorization"] = "Bearer " + localVarAccessTokenValue; - } -} +export const setOAuthToObject = async function ( + object: any, + name: string, + scopes: string[], + configuration?: Configuration, +) { + if (configuration && configuration.accessToken) { + const localVarAccessTokenValue = + typeof configuration.accessToken === "function" + ? await configuration.accessToken(name, scopes) + : await configuration.accessToken; + object["Authorization"] = "Bearer " + localVarAccessTokenValue; + } +}; -function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: any, key: string = ""): void { - if (parameter == null) return; - if (typeof parameter === "object") { - if (Array.isArray(parameter)) { - (parameter as any[]).forEach(item => setFlattenedQueryParams(urlSearchParams, item, key)); - } - else { - Object.keys(parameter).forEach(currentKey => - setFlattenedQueryParams(urlSearchParams, parameter[currentKey], `${key}${key !== '' ? '.' : ''}${currentKey}`) - ); - } - } - else { - if (urlSearchParams.has(key)) { - urlSearchParams.append(key, parameter); - } - else { - urlSearchParams.set(key, parameter); - } +function setFlattenedQueryParams( + urlSearchParams: URLSearchParams, + parameter: any, + key: string = "", +): void { + if (parameter == null) return; + if (typeof parameter === "object") { + if (Array.isArray(parameter)) { + (parameter as any[]).forEach((item) => + setFlattenedQueryParams(urlSearchParams, item, key), + ); + } else { + Object.keys(parameter).forEach((currentKey) => + setFlattenedQueryParams( + urlSearchParams, + parameter[currentKey], + `${key}${key !== "" ? "." : ""}${currentKey}`, + ), + ); + } + } else { + if (urlSearchParams.has(key)) { + urlSearchParams.append(key, parameter); + } else { + urlSearchParams.set(key, parameter); } + } } /** @@ -111,40 +145,58 @@ function setFlattenedQueryParams(urlSearchParams: URLSearchParams, parameter: an * @export */ export const setSearchParams = function (url: URL, ...objects: any[]) { - const searchParams = new URLSearchParams(url.search); - setFlattenedQueryParams(searchParams, objects); - url.search = searchParams.toString(); -} + const searchParams = new URLSearchParams(url.search); + setFlattenedQueryParams(searchParams, objects); + url.search = searchParams.toString(); +}; /** * * @export */ -export const serializeDataIfNeeded = function (value: any, requestOptions: any, configuration?: Configuration) { - const nonString = typeof value !== 'string'; - const needsSerialization = nonString && configuration && configuration.isJsonMime - ? configuration.isJsonMime(requestOptions.headers['Content-Type']) - : nonString; - return needsSerialization - ? JSON.stringify(value !== undefined ? value : {}) - : (value || ""); -} +export const serializeDataIfNeeded = function ( + value: any, + requestOptions: any, + configuration?: Configuration, +) { + const nonString = typeof value !== "string"; + const needsSerialization = + nonString && configuration && configuration.isJsonMime + ? configuration.isJsonMime(requestOptions.headers["Content-Type"]) + : nonString; + return needsSerialization + ? JSON.stringify(value !== undefined ? value : {}) + : value || ""; +}; /** * * @export */ export const toPathString = function (url: URL) { - return url.pathname + url.search + url.hash -} + return url.pathname + url.search + url.hash; +}; /** * * @export */ -export const createRequestFunction = function (axiosArgs: RequestArgs, globalAxios: AxiosInstance, BASE_PATH: string, configuration?: Configuration) { - return >(axios: AxiosInstance = globalAxios, basePath: string = BASE_PATH) => { - const axiosRequestArgs = {...axiosArgs.options, url: (axios.defaults.baseURL ? '' : configuration?.basePath ?? basePath) + axiosArgs.url}; - return axios.request(axiosRequestArgs); +export const createRequestFunction = function ( + axiosArgs: RequestArgs, + globalAxios: AxiosInstance, + BASE_PATH: string, + configuration?: Configuration, +) { + return >( + axios: AxiosInstance = globalAxios, + basePath: string = BASE_PATH, + ) => { + const axiosRequestArgs = { + ...axiosArgs.options, + url: + (axios.defaults.baseURL ? "" : (configuration?.basePath ?? basePath)) + + axiosArgs.url, }; -} + return axios.request(axiosRequestArgs); + }; +}; diff --git a/client/src/generated/configuration.ts b/client/src/generated/configuration.ts index 4e533bd9..f77a0ed9 100644 --- a/client/src/generated/configuration.ts +++ b/client/src/generated/configuration.ts @@ -12,99 +12,121 @@ * Do not edit the class manually. */ - export interface ConfigurationParameters { - apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise); - username?: string; - password?: string; - accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); - basePath?: string; - serverIndex?: number; - baseOptions?: any; - formDataCtor?: new () => any; + apiKey?: + | string + | Promise + | ((name: string) => string) + | ((name: string) => Promise); + username?: string; + password?: string; + accessToken?: + | string + | Promise + | ((name?: string, scopes?: string[]) => string) + | ((name?: string, scopes?: string[]) => Promise); + basePath?: string; + serverIndex?: number; + baseOptions?: any; + formDataCtor?: new () => any; } export class Configuration { - /** - * parameter for apiKey security - * @param name security name - * @memberof Configuration - */ - apiKey?: string | Promise | ((name: string) => string) | ((name: string) => Promise); - /** - * parameter for basic security - * - * @type {string} - * @memberof Configuration - */ - username?: string; - /** - * parameter for basic security - * - * @type {string} - * @memberof Configuration - */ - password?: string; - /** - * parameter for oauth2 security - * @param name security name - * @param scopes oauth2 scope - * @memberof Configuration - */ - accessToken?: string | Promise | ((name?: string, scopes?: string[]) => string) | ((name?: string, scopes?: string[]) => Promise); - /** - * override base path - * - * @type {string} - * @memberof Configuration - */ - basePath?: string; - /** - * override server index - * - * @type {number} - * @memberof Configuration - */ - serverIndex?: number; - /** - * base options for axios calls - * - * @type {any} - * @memberof Configuration - */ - baseOptions?: any; - /** - * The FormData constructor that will be used to create multipart form data - * requests. You can inject this here so that execution environments that - * do not support the FormData class can still run the generated client. - * - * @type {new () => FormData} - */ - formDataCtor?: new () => any; + /** + * parameter for apiKey security + * @param name security name + * @memberof Configuration + */ + apiKey?: + | string + | Promise + | ((name: string) => string) + | ((name: string) => Promise); + /** + * parameter for basic security + * + * @type {string} + * @memberof Configuration + */ + username?: string; + /** + * parameter for basic security + * + * @type {string} + * @memberof Configuration + */ + password?: string; + /** + * parameter for oauth2 security + * @param name security name + * @param scopes oauth2 scope + * @memberof Configuration + */ + accessToken?: + | string + | Promise + | ((name?: string, scopes?: string[]) => string) + | ((name?: string, scopes?: string[]) => Promise); + /** + * override base path + * + * @type {string} + * @memberof Configuration + */ + basePath?: string; + /** + * override server index + * + * @type {number} + * @memberof Configuration + */ + serverIndex?: number; + /** + * base options for axios calls + * + * @type {any} + * @memberof Configuration + */ + baseOptions?: any; + /** + * The FormData constructor that will be used to create multipart form data + * requests. You can inject this here so that execution environments that + * do not support the FormData class can still run the generated client. + * + * @type {new () => FormData} + */ + formDataCtor?: new () => any; - constructor(param: ConfigurationParameters = {}) { - this.apiKey = param.apiKey; - this.username = param.username; - this.password = param.password; - this.accessToken = param.accessToken; - this.basePath = param.basePath; - this.serverIndex = param.serverIndex; - this.baseOptions = param.baseOptions; - this.formDataCtor = param.formDataCtor; - } + constructor(param: ConfigurationParameters = {}) { + this.apiKey = param.apiKey; + this.username = param.username; + this.password = param.password; + this.accessToken = param.accessToken; + this.basePath = param.basePath; + this.serverIndex = param.serverIndex; + this.baseOptions = param.baseOptions; + this.formDataCtor = param.formDataCtor; + } - /** - * Check if the given MIME is a JSON MIME. - * JSON MIME examples: - * application/json - * application/json; charset=UTF8 - * APPLICATION/JSON - * application/vnd.company+json - * @param mime - MIME (Multipurpose Internet Mail Extensions) - * @return True if the given MIME is JSON, false otherwise. - */ - public isJsonMime(mime: string): boolean { - const jsonMime: RegExp = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i'); - return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json'); - } + /** + * Check if the given MIME is a JSON MIME. + * JSON MIME examples: + * application/json + * application/json; charset=UTF8 + * APPLICATION/JSON + * application/vnd.company+json + * @param mime - MIME (Multipurpose Internet Mail Extensions) + * @return True if the given MIME is JSON, false otherwise. + */ + public isJsonMime(mime: string): boolean { + const jsonMime: RegExp = new RegExp( + "^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$", + "i", + ); + return ( + mime !== null && + (jsonMime.test(mime) || + mime.toLowerCase() === "application/json-patch+json") + ); + } } diff --git a/client/src/generated/index.ts b/client/src/generated/index.ts index f096401e..9b106d3e 100644 --- a/client/src/generated/index.ts +++ b/client/src/generated/index.ts @@ -12,7 +12,6 @@ * Do not edit the class manually. */ - export * from "./api"; export * from "./configuration"; export * from "./model"; diff --git a/client/src/generated/model/add-favorite-request-body.ts b/client/src/generated/model/add-favorite-request-body.ts index fd22b036..b8d9d386 100644 --- a/client/src/generated/model/add-favorite-request-body.ts +++ b/client/src/generated/model/add-favorite-request-body.ts @@ -12,19 +12,16 @@ * Do not edit the class manually. */ - - /** - * + * * @export * @interface AddFavoriteRequestBody */ export interface AddFavoriteRequestBody { - /** - * - * @type {number} - * @memberof AddFavoriteRequestBody - */ - 'instrument_id': number; + /** + * + * @type {number} + * @memberof AddFavoriteRequestBody + */ + instrument_id: number; } - diff --git a/client/src/generated/model/client-error.ts b/client/src/generated/model/client-error.ts index 07ee85ab..f19c4775 100644 --- a/client/src/generated/model/client-error.ts +++ b/client/src/generated/model/client-error.ts @@ -12,19 +12,16 @@ * Do not edit the class manually. */ - - /** - * + * * @export * @interface ClientError */ export interface ClientError { - /** - * Error description - * @type {string} - * @memberof ClientError - */ - 'message': string; + /** + * Error description + * @type {string} + * @memberof ClientError + */ + message: string; } - diff --git a/client/src/generated/model/get-instrument-by-criteria-page-response.ts b/client/src/generated/model/get-instrument-by-criteria-page-response.ts index 4084033a..335daef2 100644 --- a/client/src/generated/model/get-instrument-by-criteria-page-response.ts +++ b/client/src/generated/model/get-instrument-by-criteria-page-response.ts @@ -12,52 +12,50 @@ * Do not edit the class manually. */ - // May contain unused imports in some cases // @ts-ignore -import type { InstrumentDetail } from './instrument-detail'; +import type { InstrumentDetail } from "./instrument-detail"; /** - * + * * @export * @interface GetInstrumentByCriteriaPageResponse */ export interface GetInstrumentByCriteriaPageResponse { - /** - * - * @type {Array} - * @memberof GetInstrumentByCriteriaPageResponse - */ - 'content': Array; - /** - * The number of items in the content. - * @type {number} - * @memberof GetInstrumentByCriteriaPageResponse - */ - 'content_size': number; - /** - * The number of items per page. - * @type {number} - * @memberof GetInstrumentByCriteriaPageResponse - */ - 'page_size': number; - /** - * The current page number (0-based index). - * @type {number} - * @memberof GetInstrumentByCriteriaPageResponse - */ - 'page_number': number; - /** - * The total number of elements across all pages. - * @type {number} - * @memberof GetInstrumentByCriteriaPageResponse - */ - 'total_elements': number; - /** - * The total number of pages. - * @type {number} - * @memberof GetInstrumentByCriteriaPageResponse - */ - 'total_pages': number; + /** + * + * @type {Array} + * @memberof GetInstrumentByCriteriaPageResponse + */ + content: Array; + /** + * The number of items in the content. + * @type {number} + * @memberof GetInstrumentByCriteriaPageResponse + */ + content_size: number; + /** + * The number of items per page. + * @type {number} + * @memberof GetInstrumentByCriteriaPageResponse + */ + page_size: number; + /** + * The current page number (0-based index). + * @type {number} + * @memberof GetInstrumentByCriteriaPageResponse + */ + page_number: number; + /** + * The total number of elements across all pages. + * @type {number} + * @memberof GetInstrumentByCriteriaPageResponse + */ + total_elements: number; + /** + * The total number of pages. + * @type {number} + * @memberof GetInstrumentByCriteriaPageResponse + */ + total_pages: number; } - diff --git a/client/src/generated/model/get-instrument-criteria-request-body.ts b/client/src/generated/model/get-instrument-criteria-request-body.ts index 784163be..c45e9bfd 100644 --- a/client/src/generated/model/get-instrument-criteria-request-body.ts +++ b/client/src/generated/model/get-instrument-criteria-request-body.ts @@ -12,73 +12,70 @@ * Do not edit the class manually. */ - - /** - * + * * @export * @interface GetInstrumentCriteriaRequestBody */ export interface GetInstrumentCriteriaRequestBody { - /** - * - * @type {string} - * @memberof GetInstrumentCriteriaRequestBody - */ - 'instrument_name'?: string; - /** - * - * @type {Array} - * @memberof GetInstrumentCriteriaRequestBody - */ - 'instrument_types'?: Array; - /** - * - * @type {Array} - * @memberof GetInstrumentCriteriaRequestBody - */ - 'manufacturer_names'?: Array; - /** - * - * @type {string} - * @memberof GetInstrumentCriteriaRequestBody - */ - 'manufacture_date_from'?: string; - /** - * - * @type {string} - * @memberof GetInstrumentCriteriaRequestBody - */ - 'manufacture_date_to'?: string; - /** - * - * @type {string} - * @memberof GetInstrumentCriteriaRequestBody - */ - 'release_date_from'?: string; - /** - * - * @type {string} - * @memberof GetInstrumentCriteriaRequestBody - */ - 'release_date_to'?: string; - /** - * - * @type {Array} - * @memberof GetInstrumentCriteriaRequestBody - */ - 'countries'?: Array; - /** - * - * @type {Array} - * @memberof GetInstrumentCriteriaRequestBody - */ - 'materials'?: Array; - /** - * - * @type {Array} - * @memberof GetInstrumentCriteriaRequestBody - */ - 'instrument_ids'?: Array; + /** + * + * @type {string} + * @memberof GetInstrumentCriteriaRequestBody + */ + instrument_name?: string; + /** + * + * @type {Array} + * @memberof GetInstrumentCriteriaRequestBody + */ + instrument_types?: Array; + /** + * + * @type {Array} + * @memberof GetInstrumentCriteriaRequestBody + */ + manufacturer_names?: Array; + /** + * + * @type {string} + * @memberof GetInstrumentCriteriaRequestBody + */ + manufacture_date_from?: string; + /** + * + * @type {string} + * @memberof GetInstrumentCriteriaRequestBody + */ + manufacture_date_to?: string; + /** + * + * @type {string} + * @memberof GetInstrumentCriteriaRequestBody + */ + release_date_from?: string; + /** + * + * @type {string} + * @memberof GetInstrumentCriteriaRequestBody + */ + release_date_to?: string; + /** + * + * @type {Array} + * @memberof GetInstrumentCriteriaRequestBody + */ + countries?: Array; + /** + * + * @type {Array} + * @memberof GetInstrumentCriteriaRequestBody + */ + materials?: Array; + /** + * + * @type {Array} + * @memberof GetInstrumentCriteriaRequestBody + */ + instrument_ids?: Array; } - diff --git a/client/src/generated/model/get-instrument-types-response.ts b/client/src/generated/model/get-instrument-types-response.ts index ba9aee89..cf418f24 100644 --- a/client/src/generated/model/get-instrument-types-response.ts +++ b/client/src/generated/model/get-instrument-types-response.ts @@ -12,19 +12,16 @@ * Do not edit the class manually. */ - - /** - * + * * @export * @interface GetInstrumentTypesResponse */ export interface GetInstrumentTypesResponse { - /** - * - * @type {Array} - * @memberof GetInstrumentTypesResponse - */ - 'content'?: Array; + /** + * + * @type {Array} + * @memberof GetInstrumentTypesResponse + */ + content?: Array; } - diff --git a/client/src/generated/model/get-instruments-by-criteria-response.ts b/client/src/generated/model/get-instruments-by-criteria-response.ts index cf965e12..a89e17d0 100644 --- a/client/src/generated/model/get-instruments-by-criteria-response.ts +++ b/client/src/generated/model/get-instruments-by-criteria-response.ts @@ -12,22 +12,20 @@ * Do not edit the class manually. */ - // May contain unused imports in some cases // @ts-ignore -import type { InstrumentDetail } from './instrument-detail'; +import type { InstrumentDetail } from "./instrument-detail"; /** - * + * * @export * @interface GetInstrumentsByCriteriaResponse */ export interface GetInstrumentsByCriteriaResponse { - /** - * - * @type {Array} - * @memberof GetInstrumentsByCriteriaResponse - */ - 'content': Array; + /** + * + * @type {Array} + * @memberof GetInstrumentsByCriteriaResponse + */ + content: Array; } - diff --git a/client/src/generated/model/index.ts b/client/src/generated/model/index.ts index f8a01195..6a808bf9 100644 --- a/client/src/generated/model/index.ts +++ b/client/src/generated/model/index.ts @@ -1,14 +1,14 @@ -export * from './add-favorite-request-body'; -export * from './client-error'; -export * from './get-instrument-by-criteria-page-response'; -export * from './get-instrument-criteria-request-body'; -export * from './get-instrument-types-response'; -export * from './get-instruments-by-criteria-response'; -export * from './instrument-detail'; -export * from './jwt-response'; -export * from './list-favorite-response-body'; -export * from './profile-details-response'; -export * from './registration-request'; -export * from './remove-favorite-request-body'; -export * from './server-error'; -export * from './username-and-password-request-body'; +export * from "./add-favorite-request-body"; +export * from "./client-error"; +export * from "./get-instrument-by-criteria-page-response"; +export * from "./get-instrument-criteria-request-body"; +export * from "./get-instrument-types-response"; +export * from "./get-instruments-by-criteria-response"; +export * from "./instrument-detail"; +export * from "./jwt-response"; +export * from "./list-favorite-response-body"; +export * from "./profile-details-response"; +export * from "./registration-request"; +export * from "./remove-favorite-request-body"; +export * from "./server-error"; +export * from "./username-and-password-request-body"; diff --git a/client/src/generated/model/instrument-detail.ts b/client/src/generated/model/instrument-detail.ts index 251e001f..cbb904a5 100644 --- a/client/src/generated/model/instrument-detail.ts +++ b/client/src/generated/model/instrument-detail.ts @@ -12,61 +12,58 @@ * Do not edit the class manually. */ - - /** - * + * * @export * @interface InstrumentDetail */ export interface InstrumentDetail { - /** - * - * @type {number} - * @memberof InstrumentDetail - */ - 'id': number; - /** - * - * @type {string} - * @memberof InstrumentDetail - */ - 'name': string; - /** - * - * @type {string} - * @memberof InstrumentDetail - */ - 'type': string; - /** - * - * @type {string} - * @memberof InstrumentDetail - */ - 'manufacturer': string; - /** - * - * @type {string} - * @memberof InstrumentDetail - */ - 'manufacturer_date': string; - /** - * - * @type {string} - * @memberof InstrumentDetail - */ - 'release_date': string; - /** - * - * @type {string} - * @memberof InstrumentDetail - */ - 'country': string; - /** - * - * @type {Array} - * @memberof InstrumentDetail - */ - 'basic_materials': Array; + /** + * + * @type {number} + * @memberof InstrumentDetail + */ + id: number; + /** + * + * @type {string} + * @memberof InstrumentDetail + */ + name: string; + /** + * + * @type {string} + * @memberof InstrumentDetail + */ + type: string; + /** + * + * @type {string} + * @memberof InstrumentDetail + */ + manufacturer: string; + /** + * + * @type {string} + * @memberof InstrumentDetail + */ + manufacturer_date: string; + /** + * + * @type {string} + * @memberof InstrumentDetail + */ + release_date: string; + /** + * + * @type {string} + * @memberof InstrumentDetail + */ + country: string; + /** + * + * @type {Array} + * @memberof InstrumentDetail + */ + basic_materials: Array; } - diff --git a/client/src/generated/model/jwt-response.ts b/client/src/generated/model/jwt-response.ts index e1987d16..e2af0f82 100644 --- a/client/src/generated/model/jwt-response.ts +++ b/client/src/generated/model/jwt-response.ts @@ -12,19 +12,16 @@ * Do not edit the class manually. */ - - /** - * + * * @export * @interface JwtResponse */ export interface JwtResponse { - /** - * - * @type {string} - * @memberof JwtResponse - */ - 'jwt': string; + /** + * + * @type {string} + * @memberof JwtResponse + */ + jwt: string; } - diff --git a/client/src/generated/model/list-favorite-response-body.ts b/client/src/generated/model/list-favorite-response-body.ts index 1719cf94..396db813 100644 --- a/client/src/generated/model/list-favorite-response-body.ts +++ b/client/src/generated/model/list-favorite-response-body.ts @@ -12,22 +12,20 @@ * Do not edit the class manually. */ - // May contain unused imports in some cases // @ts-ignore -import type { InstrumentDetail } from './instrument-detail'; +import type { InstrumentDetail } from "./instrument-detail"; /** - * + * * @export * @interface ListFavoriteResponseBody */ export interface ListFavoriteResponseBody { - /** - * - * @type {Array} - * @memberof ListFavoriteResponseBody - */ - 'content': Array; + /** + * + * @type {Array} + * @memberof ListFavoriteResponseBody + */ + content: Array; } - diff --git a/client/src/generated/model/profile-details-response.ts b/client/src/generated/model/profile-details-response.ts index b0838a5e..146b7ce7 100644 --- a/client/src/generated/model/profile-details-response.ts +++ b/client/src/generated/model/profile-details-response.ts @@ -12,31 +12,28 @@ * Do not edit the class manually. */ - - /** - * + * * @export * @interface ProfileDetailsResponse */ export interface ProfileDetailsResponse { - /** - * - * @type {string} - * @memberof ProfileDetailsResponse - */ - 'username': string; - /** - * - * @type {string} - * @memberof ProfileDetailsResponse - */ - 'role': string; - /** - * - * @type {string} - * @memberof ProfileDetailsResponse - */ - 'full_name': string; + /** + * + * @type {string} + * @memberof ProfileDetailsResponse + */ + username: string; + /** + * + * @type {string} + * @memberof ProfileDetailsResponse + */ + role: string; + /** + * + * @type {string} + * @memberof ProfileDetailsResponse + */ + full_name: string; } - diff --git a/client/src/generated/model/registration-request.ts b/client/src/generated/model/registration-request.ts index c2529748..81d00b96 100644 --- a/client/src/generated/model/registration-request.ts +++ b/client/src/generated/model/registration-request.ts @@ -12,31 +12,28 @@ * Do not edit the class manually. */ - - /** - * + * * @export * @interface RegistrationRequest */ export interface RegistrationRequest { - /** - * - * @type {string} - * @memberof RegistrationRequest - */ - 'full_name': string; - /** - * - * @type {string} - * @memberof RegistrationRequest - */ - 'login': string; - /** - * - * @type {string} - * @memberof RegistrationRequest - */ - 'password': string; + /** + * + * @type {string} + * @memberof RegistrationRequest + */ + full_name: string; + /** + * + * @type {string} + * @memberof RegistrationRequest + */ + login: string; + /** + * + * @type {string} + * @memberof RegistrationRequest + */ + password: string; } - diff --git a/client/src/generated/model/remove-favorite-request-body.ts b/client/src/generated/model/remove-favorite-request-body.ts index 5e6b1032..27f857cc 100644 --- a/client/src/generated/model/remove-favorite-request-body.ts +++ b/client/src/generated/model/remove-favorite-request-body.ts @@ -12,19 +12,16 @@ * Do not edit the class manually. */ - - /** - * + * * @export * @interface RemoveFavoriteRequestBody */ export interface RemoveFavoriteRequestBody { - /** - * - * @type {number} - * @memberof RemoveFavoriteRequestBody - */ - 'instrument_id': number; + /** + * + * @type {number} + * @memberof RemoveFavoriteRequestBody + */ + instrument_id: number; } - diff --git a/client/src/generated/model/server-error.ts b/client/src/generated/model/server-error.ts index e87a186f..55841fe5 100644 --- a/client/src/generated/model/server-error.ts +++ b/client/src/generated/model/server-error.ts @@ -12,19 +12,16 @@ * Do not edit the class manually. */ - - /** - * + * * @export * @interface ServerError */ export interface ServerError { - /** - * A description of the error. - * @type {string} - * @memberof ServerError - */ - 'message': string; + /** + * A description of the error. + * @type {string} + * @memberof ServerError + */ + message: string; } - diff --git a/client/src/generated/model/username-and-password-request-body.ts b/client/src/generated/model/username-and-password-request-body.ts index db8b19f8..9edf989a 100644 --- a/client/src/generated/model/username-and-password-request-body.ts +++ b/client/src/generated/model/username-and-password-request-body.ts @@ -12,25 +12,22 @@ * Do not edit the class manually. */ - - /** - * + * * @export * @interface UsernameAndPasswordRequestBody */ export interface UsernameAndPasswordRequestBody { - /** - * - * @type {string} - * @memberof UsernameAndPasswordRequestBody - */ - 'username': string; - /** - * - * @type {string} - * @memberof UsernameAndPasswordRequestBody - */ - 'password': string; + /** + * + * @type {string} + * @memberof UsernameAndPasswordRequestBody + */ + username: string; + /** + * + * @type {string} + * @memberof UsernameAndPasswordRequestBody + */ + password: string; } - diff --git a/client/src/pages/catalogue/api/loader.ts b/client/src/pages/catalogue/api/loader.ts index ee22eef5..c18bc4d6 100644 --- a/client/src/pages/catalogue/api/loader.ts +++ b/client/src/pages/catalogue/api/loader.ts @@ -1,8 +1,11 @@ import { CATALOGUE_DEFAULT_PAGE_NUMBER, - CATALOGUE_DEFAULT_PAGE_SIZE + CATALOGUE_DEFAULT_PAGE_SIZE, } from "shared/config"; -import { GetInstrumentsByCriteriaPaginatedApi, ListFavoriteApi } from "generated/api"; +import { + GetInstrumentsByCriteriaPaginatedApi, + ListFavoriteApi, +} from "generated/api"; import { GetInstrumentByCriteriaPageResponse } from "generated/model"; const getInstrumentsByCriteriaPaginated = @@ -22,14 +25,16 @@ export const loader = async (): Promise => { CATALOGUE_DEFAULT_PAGE_NUMBER, {}, { - withCredentials: true - } + withCredentials: true, + }, ); const favoriteInstrumentDetails = await listFavoriteApi.listFavorite(); - const favoriteInstrumentIds = favoriteInstrumentDetails.data.content.map((favorite) => favorite.id); + const favoriteInstrumentIds = favoriteInstrumentDetails.data.content.map( + (favorite) => favorite.id, + ); return { instrumentPage: instrumentsPage.data, - favoriteInstrumentIds: favoriteInstrumentIds + favoriteInstrumentIds: favoriteInstrumentIds, }; }; diff --git a/client/src/pages/catalogue/ui/Catalogue.tsx b/client/src/pages/catalogue/ui/Catalogue.tsx index 09a83be6..41b70904 100644 --- a/client/src/pages/catalogue/ui/Catalogue.tsx +++ b/client/src/pages/catalogue/ui/Catalogue.tsx @@ -17,7 +17,10 @@ import { import { SearchBarForm } from "./SearchBarForm"; import { NavigationBar } from "./NavigationBar"; import { CatalogueLoader } from "pages/catalogue"; -import { type GetInstrumentCriteriaRequestBody, InstrumentDetail } from "generated/model"; +import { + type GetInstrumentCriteriaRequestBody, + InstrumentDetail, +} from "generated/model"; import { GetInstrumentsByCriteriaPaginatedApi } from "generated/api/get-instruments-by-criteria-paginated-api"; import { ListFavoriteApi } from "generated/api/list-favorite-api"; @@ -43,9 +46,13 @@ export function Catalogue() { ); useEffect(() => { - listFavoriteApi.listFavorite().then((favorites) => - setFavoriteInstrumentIds(favorites.data.content.map(favorite => favorite.id)), - ) + listFavoriteApi + .listFavorite() + .then((favorites) => + setFavoriteInstrumentIds( + favorites.data.content.map((favorite) => favorite.id), + ), + ); if (instrumentName === "") { filters.instrumentName = null; @@ -54,14 +61,16 @@ export function Catalogue() { filters.instrumentName = instrumentName; } - getInstrumentsByCriteriaPaginated.getInstrumentsByCriteriaPaginated( - CATALOGUE_DEFAULT_PAGE_SIZE, - pageNumber, - JSON.stringify(filters, null, 2) as GetInstrumentCriteriaRequestBody, - ).then((r) => { - setInstruments(r.data.content); - totalPages.current = r.data.total_pages; - }); + getInstrumentsByCriteriaPaginated + .getInstrumentsByCriteriaPaginated( + CATALOGUE_DEFAULT_PAGE_SIZE, + pageNumber, + JSON.stringify(filters, null, 2) as GetInstrumentCriteriaRequestBody, + ) + .then((r) => { + setInstruments(r.data.content); + totalPages.current = r.data.total_pages; + }); }, [filters, instrumentName, pageNumber]); return ( diff --git a/client/src/pages/instrument/ui/InstrumentActions.tsx b/client/src/pages/instrument/ui/InstrumentActions.tsx index f074ccc1..6f24252c 100644 --- a/client/src/pages/instrument/ui/InstrumentActions.tsx +++ b/client/src/pages/instrument/ui/InstrumentActions.tsx @@ -19,7 +19,8 @@ export const InstrumentActions = (props: Props) => { const navigate = useNavigate(); const handleOnDeleteInstrument = () => { - deleteInstrumentById.deleteInstrumentById(props.instrument.id) + deleteInstrumentById + .deleteInstrumentById(props.instrument.id) .then(() => { setDeleteSuccessModal(true); })