/* tslint:disable */ /* eslint-disable */ /** * currencies * 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 { CurrencyDetails } from '../models'; // @ts-ignore import type { ErrorResponse } from '../models'; /** * CurrenciesApi - axios parameter creator */ export const CurrenciesApiAxiosParamCreator = function ( configuration?: Configuration, ) { return { /** * * @summary Delete currency by code * @param {string} currencyCode The currency code. * @param {*} [options] Override http request option. * @throws {RequiredError} */ _delete: async ( currencyCode: string, options: RawAxiosRequestConfig = {}, ): Promise => { // verify required parameter 'currencyCode' is not null or undefined assertParamExists('_delete', 'currencyCode', currencyCode); const localVarPath = `/currencies/{currencyCode}`.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: 'DELETE', ...baseOptions, ...options, }; const localVarHeaderParameter = {} as any; const localVarQueryParameter = {} as any; // authentication basic required // http basic authentication required setBasicAuthToObject(localVarRequestOptions, configuration); 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, }; }, /** * * @summary Create currency * @param {CurrencyDetails} currencyDetails 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 ( currencyDetails: CurrencyDetails, idempotencyKey?: string, options: RawAxiosRequestConfig = {}, ): Promise => { // verify required parameter 'currencyDetails' is not null or undefined assertParamExists('create', 'currencyDetails', currencyDetails); const localVarPath = `/currencies`; // 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( currencyDetails, localVarRequestOptions, configuration, ); return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * * @summary Get currency by code * @param {string} currencyCode The currency code. * @param {GetDetailsLevelEnum} [detailsLevel] The level of details to return: `FULL` means the full details of the object will be returned (custom field values, address, contact info, or any other related objects) and `BASIC` will return only the first level elements of the object. * @param {*} [options] Override http request option. * @throws {RequiredError} */ get: async ( currencyCode: string, detailsLevel?: GetDetailsLevelEnum, options: RawAxiosRequestConfig = {}, ): Promise => { // verify required parameter 'currencyCode' is not null or undefined assertParamExists('get', 'currencyCode', currencyCode); const localVarPath = `/currencies/{currencyCode}`.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 (detailsLevel !== undefined) { localVarQueryParameter['detailsLevel'] = detailsLevel; } 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, }; }, /** * * @summary Get all currencies * @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 {GetAllDetailsLevelEnum} [detailsLevel] The level of details to return: `FULL` means the full details of the object will be returned (custom field values, address, contact info, or any other related objects) and `BASIC` will return only the first level elements of the object. * @param {GetAllTypeEnum} [type] * @param {*} [options] Override http request option. * @throws {RequiredError} */ getAll: async ( offset?: number, limit?: number, paginationDetails?: GetAllPaginationDetailsEnum, detailsLevel?: GetAllDetailsLevelEnum, type?: GetAllTypeEnum, options: RawAxiosRequestConfig = {}, ): Promise => { const localVarPath = `/currencies`; // 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 (detailsLevel !== undefined) { localVarQueryParameter['detailsLevel'] = detailsLevel; } if (type !== undefined) { localVarQueryParameter['type'] = type; } 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, }; }, /** * * @summary Update currency by code * @param {string} currencyCode The currency code. * @param {CurrencyDetails} currencyDetails Currency details to be updated. * @param {*} [options] Override http request option. * @throws {RequiredError} */ update: async ( currencyCode: string, currencyDetails: CurrencyDetails, options: RawAxiosRequestConfig = {}, ): Promise => { // verify required parameter 'currencyCode' is not null or undefined assertParamExists('update', 'currencyCode', currencyCode); // verify required parameter 'currencyDetails' is not null or undefined assertParamExists('update', 'currencyDetails', currencyDetails); const localVarPath = `/currencies/{currencyCode}`.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: 'PUT', ...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'; setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers, }; localVarRequestOptions.data = serializeDataIfNeeded( currencyDetails, localVarRequestOptions, configuration, ); return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, }; }; /** * CurrenciesApi - functional programming interface */ export const CurrenciesApiFp = function (configuration?: Configuration) { const localVarAxiosParamCreator = CurrenciesApiAxiosParamCreator(configuration); return { /** * * @summary Delete currency by code * @param {string} currencyCode The currency code. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async _delete( currencyCode: string, options?: RawAxiosRequestConfig, ): Promise< (axios?: AxiosInstance, basePath?: string) => AxiosPromise > { const localVarAxiosArgs = await localVarAxiosParamCreator._delete( currencyCode, options, ); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['CurrenciesApi._delete']?.[ localVarOperationServerIndex ]?.url; return (axios, basePath) => createRequestFunction( localVarAxiosArgs, globalAxios, BASE_PATH, configuration, )(axios, localVarOperationServerBasePath || basePath); }, /** * * @summary Create currency * @param {CurrencyDetails} currencyDetails 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( currencyDetails: CurrencyDetails, idempotencyKey?: string, options?: RawAxiosRequestConfig, ): Promise< ( axios?: AxiosInstance, basePath?: string, ) => AxiosPromise > { const localVarAxiosArgs = await localVarAxiosParamCreator.create( currencyDetails, idempotencyKey, options, ); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['CurrenciesApi.create']?.[ localVarOperationServerIndex ]?.url; return (axios, basePath) => createRequestFunction( localVarAxiosArgs, globalAxios, BASE_PATH, configuration, )(axios, localVarOperationServerBasePath || basePath); }, /** * * @summary Get currency by code * @param {string} currencyCode The currency code. * @param {GetDetailsLevelEnum} [detailsLevel] The level of details to return: `FULL` means the full details of the object will be returned (custom field values, address, contact info, or any other related objects) and `BASIC` will return only the first level elements of the object. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async get( currencyCode: string, detailsLevel?: GetDetailsLevelEnum, options?: RawAxiosRequestConfig, ): Promise< ( axios?: AxiosInstance, basePath?: string, ) => AxiosPromise > { const localVarAxiosArgs = await localVarAxiosParamCreator.get( currencyCode, detailsLevel, options, ); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['CurrenciesApi.get']?.[localVarOperationServerIndex] ?.url; return (axios, basePath) => createRequestFunction( localVarAxiosArgs, globalAxios, BASE_PATH, configuration, )(axios, localVarOperationServerBasePath || basePath); }, /** * * @summary Get all currencies * @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 {GetAllDetailsLevelEnum} [detailsLevel] The level of details to return: `FULL` means the full details of the object will be returned (custom field values, address, contact info, or any other related objects) and `BASIC` will return only the first level elements of the object. * @param {GetAllTypeEnum} [type] * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getAll( offset?: number, limit?: number, paginationDetails?: GetAllPaginationDetailsEnum, detailsLevel?: GetAllDetailsLevelEnum, type?: GetAllTypeEnum, options?: RawAxiosRequestConfig, ): Promise< ( axios?: AxiosInstance, basePath?: string, ) => AxiosPromise> > { const localVarAxiosArgs = await localVarAxiosParamCreator.getAll( offset, limit, paginationDetails, detailsLevel, type, options, ); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['CurrenciesApi.getAll']?.[ localVarOperationServerIndex ]?.url; return (axios, basePath) => createRequestFunction( localVarAxiosArgs, globalAxios, BASE_PATH, configuration, )(axios, localVarOperationServerBasePath || basePath); }, /** * * @summary Update currency by code * @param {string} currencyCode The currency code. * @param {CurrencyDetails} currencyDetails Currency details to be updated. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async update( currencyCode: string, currencyDetails: CurrencyDetails, options?: RawAxiosRequestConfig, ): Promise< ( axios?: AxiosInstance, basePath?: string, ) => AxiosPromise > { const localVarAxiosArgs = await localVarAxiosParamCreator.update( currencyCode, currencyDetails, options, ); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['CurrenciesApi.update']?.[ localVarOperationServerIndex ]?.url; return (axios, basePath) => createRequestFunction( localVarAxiosArgs, globalAxios, BASE_PATH, configuration, )(axios, localVarOperationServerBasePath || basePath); }, }; }; /** * CurrenciesApi - factory interface */ export const CurrenciesApiFactory = function ( configuration?: Configuration, basePath?: string, axios?: AxiosInstance, ) { const localVarFp = CurrenciesApiFp(configuration); return { /** * * @summary Delete currency by code * @param {string} currencyCode The currency code. * @param {*} [options] Override http request option. * @throws {RequiredError} */ _delete( currencyCode: string, options?: RawAxiosRequestConfig, ): AxiosPromise { return localVarFp ._delete(currencyCode, options) .then((request) => request(axios, basePath)); }, /** * * @summary Create currency * @param {CurrencyDetails} currencyDetails 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( currencyDetails: CurrencyDetails, idempotencyKey?: string, options?: RawAxiosRequestConfig, ): AxiosPromise { return localVarFp .create(currencyDetails, idempotencyKey, options) .then((request) => request(axios, basePath)); }, /** * * @summary Get currency by code * @param {string} currencyCode The currency code. * @param {GetDetailsLevelEnum} [detailsLevel] The level of details to return: `FULL` means the full details of the object will be returned (custom field values, address, contact info, or any other related objects) and `BASIC` will return only the first level elements of the object. * @param {*} [options] Override http request option. * @throws {RequiredError} */ get( currencyCode: string, detailsLevel?: GetDetailsLevelEnum, options?: RawAxiosRequestConfig, ): AxiosPromise { return localVarFp .get(currencyCode, detailsLevel, options) .then((request) => request(axios, basePath)); }, /** * * @summary Get all currencies * @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 {GetAllDetailsLevelEnum} [detailsLevel] The level of details to return: `FULL` means the full details of the object will be returned (custom field values, address, contact info, or any other related objects) and `BASIC` will return only the first level elements of the object. * @param {GetAllTypeEnum} [type] * @param {*} [options] Override http request option. * @throws {RequiredError} */ getAll( offset?: number, limit?: number, paginationDetails?: GetAllPaginationDetailsEnum, detailsLevel?: GetAllDetailsLevelEnum, type?: GetAllTypeEnum, options?: RawAxiosRequestConfig, ): AxiosPromise> { return localVarFp .getAll(offset, limit, paginationDetails, detailsLevel, type, options) .then((request) => request(axios, basePath)); }, /** * * @summary Update currency by code * @param {string} currencyCode The currency code. * @param {CurrencyDetails} currencyDetails Currency details to be updated. * @param {*} [options] Override http request option. * @throws {RequiredError} */ update( currencyCode: string, currencyDetails: CurrencyDetails, options?: RawAxiosRequestConfig, ): AxiosPromise { return localVarFp .update(currencyCode, currencyDetails, options) .then((request) => request(axios, basePath)); }, }; }; /** * CurrenciesApi - object-oriented interface */ export class CurrenciesApi extends BaseAPI { /** * * @summary Delete currency by code * @param {string} currencyCode The currency code. * @param {*} [options] Override http request option. * @throws {RequiredError} */ public _delete(currencyCode: string, options?: RawAxiosRequestConfig) { return CurrenciesApiFp(this.configuration) ._delete(currencyCode, options) .then((request) => request(this.axios, this.basePath)); } /** * * @summary Create currency * @param {CurrencyDetails} currencyDetails 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( currencyDetails: CurrencyDetails, idempotencyKey?: string, options?: RawAxiosRequestConfig, ) { return CurrenciesApiFp(this.configuration) .create(currencyDetails, idempotencyKey, options) .then((request) => request(this.axios, this.basePath)); } /** * * @summary Get currency by code * @param {string} currencyCode The currency code. * @param {GetDetailsLevelEnum} [detailsLevel] The level of details to return: `FULL` means the full details of the object will be returned (custom field values, address, contact info, or any other related objects) and `BASIC` will return only the first level elements of the object. * @param {*} [options] Override http request option. * @throws {RequiredError} */ public get( currencyCode: string, detailsLevel?: GetDetailsLevelEnum, options?: RawAxiosRequestConfig, ) { return CurrenciesApiFp(this.configuration) .get(currencyCode, detailsLevel, options) .then((request) => request(this.axios, this.basePath)); } /** * * @summary Get all currencies * @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 {GetAllDetailsLevelEnum} [detailsLevel] The level of details to return: `FULL` means the full details of the object will be returned (custom field values, address, contact info, or any other related objects) and `BASIC` will return only the first level elements of the object. * @param {GetAllTypeEnum} [type] * @param {*} [options] Override http request option. * @throws {RequiredError} */ public getAll( offset?: number, limit?: number, paginationDetails?: GetAllPaginationDetailsEnum, detailsLevel?: GetAllDetailsLevelEnum, type?: GetAllTypeEnum, options?: RawAxiosRequestConfig, ) { return CurrenciesApiFp(this.configuration) .getAll(offset, limit, paginationDetails, detailsLevel, type, options) .then((request) => request(this.axios, this.basePath)); } /** * * @summary Update currency by code * @param {string} currencyCode The currency code. * @param {CurrencyDetails} currencyDetails Currency details to be updated. * @param {*} [options] Override http request option. * @throws {RequiredError} */ public update( currencyCode: string, currencyDetails: CurrencyDetails, options?: RawAxiosRequestConfig, ) { return CurrenciesApiFp(this.configuration) .update(currencyCode, currencyDetails, options) .then((request) => request(this.axios, this.basePath)); } } export const GetDetailsLevelEnum = { Basic: 'BASIC', Full: 'FULL', } as const; export type GetDetailsLevelEnum = (typeof GetDetailsLevelEnum)[keyof typeof GetDetailsLevelEnum]; export const GetAllPaginationDetailsEnum = { On: 'ON', Off: 'OFF', } as const; export type GetAllPaginationDetailsEnum = (typeof GetAllPaginationDetailsEnum)[keyof typeof GetAllPaginationDetailsEnum]; export const GetAllDetailsLevelEnum = { Basic: 'BASIC', Full: 'FULL', } as const; export type GetAllDetailsLevelEnum = (typeof GetAllDetailsLevelEnum)[keyof typeof GetAllDetailsLevelEnum]; export const GetAllTypeEnum = { FiatCurrency: 'FIAT_CURRENCY', Cryptocurrency: 'CRYPTOCURRENCY', NonTraditionalCurrency: 'NON_TRADITIONAL_CURRENCY', } as const; export type GetAllTypeEnum = (typeof GetAllTypeEnum)[keyof typeof GetAllTypeEnum];