/* tslint:disable */ /* eslint-disable */ /** * currencies/rates * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v2 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ import type { Configuration } from '../configuration'; import type { AxiosPromise, AxiosInstance, RawAxiosRequestConfig } from 'axios'; import globalAxios from 'axios'; // Some imports not used depending on template conditions // @ts-ignore import { DUMMY_BASE_URL, assertParamExists, setApiKeyToObject, setBasicAuthToObject, setBearerAuthToObject, setOAuthToObject, setSearchParams, serializeDataIfNeeded, toPathString, createRequestFunction, replaceWithSerializableTypeIfNeeded, } from '../common'; // @ts-ignore import { BASE_PATH, COLLECTION_FORMATS, type RequestArgs, BaseAPI, RequiredError, operationServerMap, } from '../base'; // @ts-ignore import type { ErrorResponse } from '../models'; // @ts-ignore import type { ExchangeRate } from '../models'; // @ts-ignore import type { ExchangeRateInput } from '../models'; /** * ExchangeRateApi - axios parameter creator */ export const ExchangeRateApiAxiosParamCreator = function ( configuration?: Configuration, ) { return { /** * * @summary Post exchange rates for a specific currency. * @param {string} currencyCode * @param {ExchangeRateInput} exchangeRateInput Currency exchange rates for a specific currency to be created! * @param {string} [idempotencyKey] Key that can be used to support idempotency on this POST. Must be a valid UUID(version 4 is recommended) string and can only be used with the exact same request. Can be used in retry mechanisms to prevent double posting. * @param {*} [options] Override http request option. * @throws {RequiredError} */ create: async ( currencyCode: string, exchangeRateInput: ExchangeRateInput, idempotencyKey?: string, options: RawAxiosRequestConfig = {}, ): Promise => { // verify required parameter 'currencyCode' is not null or undefined assertParamExists('create', 'currencyCode', currencyCode); // verify required parameter 'exchangeRateInput' is not null or undefined assertParamExists('create', 'exchangeRateInput', exchangeRateInput); const localVarPath = `/currencies/{currencyCode}/rates`.replace( `{${'currencyCode'}}`, encodeURIComponent(String(currencyCode)), ); // 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; // authentication basic required // http basic authentication required setBasicAuthToObject(localVarRequestOptions, configuration); localVarHeaderParameter['Content-Type'] = 'application/json'; localVarHeaderParameter['Accept'] = 'application/vnd.mambu.v2+json'; if (idempotencyKey != null) { localVarHeaderParameter['Idempotency-Key'] = String(idempotencyKey); } setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers, }; localVarRequestOptions.data = serializeDataIfNeeded( exchangeRateInput, localVarRequestOptions, configuration, ); return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * * @summary Get exchange rates for a specific currency. * @param {string} currencyCode * @param {number} [offset] Pagination, index to start searching at when retrieving elements, used in combination with limit to paginate results * @param {number} [limit] Pagination, the number of elements to retrieve, used in combination with offset to paginate results * @param {GetAllPaginationDetailsEnum} [paginationDetails] Flag specifying whether the pagination details should be provided in response headers. Please note that by default it is disabled (OFF), in order to improve the performance of the APIs * @param {string} [from] The date and time of the Exchange Rates to search from * @param {string} [to] The date and time of the Exchange Rates to search to * @param {*} [options] Override http request option. * @throws {RequiredError} */ getAll: async ( currencyCode: string, offset?: number, limit?: number, paginationDetails?: GetAllPaginationDetailsEnum, from?: string, to?: string, options: RawAxiosRequestConfig = {}, ): Promise => { // verify required parameter 'currencyCode' is not null or undefined assertParamExists('getAll', 'currencyCode', currencyCode); const localVarPath = `/currencies/{currencyCode}/rates`.replace( `{${'currencyCode'}}`, encodeURIComponent(String(currencyCode)), ); // 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; // authentication basic required // http basic authentication required setBasicAuthToObject(localVarRequestOptions, configuration); if (offset !== undefined) { localVarQueryParameter['offset'] = offset; } if (limit !== undefined) { localVarQueryParameter['limit'] = limit; } if (paginationDetails !== undefined) { localVarQueryParameter['paginationDetails'] = paginationDetails; } if (from !== undefined) { localVarQueryParameter['from'] = (from as any) instanceof Date ? (from as any).toISOString() : from; } if (to !== undefined) { localVarQueryParameter['to'] = (to as any) instanceof Date ? (to as any).toISOString() : to; } localVarHeaderParameter['Accept'] = 'application/vnd.mambu.v2+json'; setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers, }; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, }; }; /** * ExchangeRateApi - functional programming interface */ export const ExchangeRateApiFp = function (configuration?: Configuration) { const localVarAxiosParamCreator = ExchangeRateApiAxiosParamCreator(configuration); return { /** * * @summary Post exchange rates for a specific currency. * @param {string} currencyCode * @param {ExchangeRateInput} exchangeRateInput Currency exchange rates for a specific currency to be created! * @param {string} [idempotencyKey] Key that can be used to support idempotency on this POST. Must be a valid UUID(version 4 is recommended) string and can only be used with the exact same request. Can be used in retry mechanisms to prevent double posting. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async create( currencyCode: string, exchangeRateInput: ExchangeRateInput, idempotencyKey?: string, options?: RawAxiosRequestConfig, ): Promise< (axios?: AxiosInstance, basePath?: string) => AxiosPromise > { const localVarAxiosArgs = await localVarAxiosParamCreator.create( currencyCode, exchangeRateInput, idempotencyKey, options, ); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['ExchangeRateApi.create']?.[ localVarOperationServerIndex ]?.url; return (axios, basePath) => createRequestFunction( localVarAxiosArgs, globalAxios, BASE_PATH, configuration, )(axios, localVarOperationServerBasePath || basePath); }, /** * * @summary Get exchange rates for a specific currency. * @param {string} currencyCode * @param {number} [offset] Pagination, index to start searching at when retrieving elements, used in combination with limit to paginate results * @param {number} [limit] Pagination, the number of elements to retrieve, used in combination with offset to paginate results * @param {GetAllPaginationDetailsEnum} [paginationDetails] Flag specifying whether the pagination details should be provided in response headers. Please note that by default it is disabled (OFF), in order to improve the performance of the APIs * @param {string} [from] The date and time of the Exchange Rates to search from * @param {string} [to] The date and time of the Exchange Rates to search to * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getAll( currencyCode: string, offset?: number, limit?: number, paginationDetails?: GetAllPaginationDetailsEnum, from?: string, to?: string, options?: RawAxiosRequestConfig, ): Promise< ( axios?: AxiosInstance, basePath?: string, ) => AxiosPromise> > { const localVarAxiosArgs = await localVarAxiosParamCreator.getAll( currencyCode, offset, limit, paginationDetails, from, to, options, ); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['ExchangeRateApi.getAll']?.[ localVarOperationServerIndex ]?.url; return (axios, basePath) => createRequestFunction( localVarAxiosArgs, globalAxios, BASE_PATH, configuration, )(axios, localVarOperationServerBasePath || basePath); }, }; }; /** * ExchangeRateApi - factory interface */ export const ExchangeRateApiFactory = function ( configuration?: Configuration, basePath?: string, axios?: AxiosInstance, ) { const localVarFp = ExchangeRateApiFp(configuration); return { /** * * @summary Post exchange rates for a specific currency. * @param {string} currencyCode * @param {ExchangeRateInput} exchangeRateInput Currency exchange rates for a specific currency to be created! * @param {string} [idempotencyKey] Key that can be used to support idempotency on this POST. Must be a valid UUID(version 4 is recommended) string and can only be used with the exact same request. Can be used in retry mechanisms to prevent double posting. * @param {*} [options] Override http request option. * @throws {RequiredError} */ create( currencyCode: string, exchangeRateInput: ExchangeRateInput, idempotencyKey?: string, options?: RawAxiosRequestConfig, ): AxiosPromise { return localVarFp .create(currencyCode, exchangeRateInput, idempotencyKey, options) .then((request) => request(axios, basePath)); }, /** * * @summary Get exchange rates for a specific currency. * @param {string} currencyCode * @param {number} [offset] Pagination, index to start searching at when retrieving elements, used in combination with limit to paginate results * @param {number} [limit] Pagination, the number of elements to retrieve, used in combination with offset to paginate results * @param {GetAllPaginationDetailsEnum} [paginationDetails] Flag specifying whether the pagination details should be provided in response headers. Please note that by default it is disabled (OFF), in order to improve the performance of the APIs * @param {string} [from] The date and time of the Exchange Rates to search from * @param {string} [to] The date and time of the Exchange Rates to search to * @param {*} [options] Override http request option. * @throws {RequiredError} */ getAll( currencyCode: string, offset?: number, limit?: number, paginationDetails?: GetAllPaginationDetailsEnum, from?: string, to?: string, options?: RawAxiosRequestConfig, ): AxiosPromise> { return localVarFp .getAll( currencyCode, offset, limit, paginationDetails, from, to, options, ) .then((request) => request(axios, basePath)); }, }; }; /** * ExchangeRateApi - object-oriented interface */ export class ExchangeRateApi extends BaseAPI { /** * * @summary Post exchange rates for a specific currency. * @param {string} currencyCode * @param {ExchangeRateInput} exchangeRateInput Currency exchange rates for a specific currency to be created! * @param {string} [idempotencyKey] Key that can be used to support idempotency on this POST. Must be a valid UUID(version 4 is recommended) string and can only be used with the exact same request. Can be used in retry mechanisms to prevent double posting. * @param {*} [options] Override http request option. * @throws {RequiredError} */ public create( currencyCode: string, exchangeRateInput: ExchangeRateInput, idempotencyKey?: string, options?: RawAxiosRequestConfig, ) { return ExchangeRateApiFp(this.configuration) .create(currencyCode, exchangeRateInput, idempotencyKey, options) .then((request) => request(this.axios, this.basePath)); } /** * * @summary Get exchange rates for a specific currency. * @param {string} currencyCode * @param {number} [offset] Pagination, index to start searching at when retrieving elements, used in combination with limit to paginate results * @param {number} [limit] Pagination, the number of elements to retrieve, used in combination with offset to paginate results * @param {GetAllPaginationDetailsEnum} [paginationDetails] Flag specifying whether the pagination details should be provided in response headers. Please note that by default it is disabled (OFF), in order to improve the performance of the APIs * @param {string} [from] The date and time of the Exchange Rates to search from * @param {string} [to] The date and time of the Exchange Rates to search to * @param {*} [options] Override http request option. * @throws {RequiredError} */ public getAll( currencyCode: string, offset?: number, limit?: number, paginationDetails?: GetAllPaginationDetailsEnum, from?: string, to?: string, options?: RawAxiosRequestConfig, ) { return ExchangeRateApiFp(this.configuration) .getAll(currencyCode, offset, limit, paginationDetails, from, to, options) .then((request) => request(this.axios, this.basePath)); } } export const GetAllPaginationDetailsEnum = { On: 'ON', Off: 'OFF', } as const; export type GetAllPaginationDetailsEnum = (typeof GetAllPaginationDetailsEnum)[keyof typeof GetAllPaginationDetailsEnum];