/* tslint:disable */ /* eslint-disable */ /** * indexratesources * 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 { IndexRate } from '../models'; /** * IndexRatesApi - axios parameter creator */ export const IndexRatesApiAxiosParamCreator = function ( configuration?: Configuration, ) { return { /** * * @summary Create index rate * @param {string} indexRateSourceId The ID of the index rate source. * @param {IndexRate} indexRate Index rate 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} */ createIndexRate: async ( indexRateSourceId: string, indexRate: IndexRate, idempotencyKey?: string, options: RawAxiosRequestConfig = {}, ): Promise => { // verify required parameter 'indexRateSourceId' is not null or undefined assertParamExists( 'createIndexRate', 'indexRateSourceId', indexRateSourceId, ); // verify required parameter 'indexRate' is not null or undefined assertParamExists('createIndexRate', 'indexRate', indexRate); const localVarPath = `/indexratesources/{indexRateSourceId}/indexrates`.replace( `{${'indexRateSourceId'}}`, encodeURIComponent(String(indexRateSourceId)), ); // 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( indexRate, localVarRequestOptions, configuration, ); return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * * @summary Delete index rate * @param {string} indexRateSourceId The ID of the index rate source. * @param {string} indexRateId The encoded key of the index rate to be deleted. * @param {*} [options] Override http request option. * @throws {RequiredError} */ deleteIndexRate: async ( indexRateSourceId: string, indexRateId: string, options: RawAxiosRequestConfig = {}, ): Promise => { // verify required parameter 'indexRateSourceId' is not null or undefined assertParamExists( 'deleteIndexRate', 'indexRateSourceId', indexRateSourceId, ); // verify required parameter 'indexRateId' is not null or undefined assertParamExists('deleteIndexRate', 'indexRateId', indexRateId); const localVarPath = `/indexratesources/{indexRateSourceId}/indexrates/{indexRateId}` .replace( `{${'indexRateSourceId'}}`, encodeURIComponent(String(indexRateSourceId)), ) .replace( `{${'indexRateId'}}`, encodeURIComponent(String(indexRateId)), ); // 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 Get index rates for a source * @param {string} indexRateSourceId The ID of the index rate source. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getAllIndexRates: async ( indexRateSourceId: string, options: RawAxiosRequestConfig = {}, ): Promise => { // verify required parameter 'indexRateSourceId' is not null or undefined assertParamExists( 'getAllIndexRates', 'indexRateSourceId', indexRateSourceId, ); const localVarPath = `/indexratesources/{indexRateSourceId}/indexrates`.replace( `{${'indexRateSourceId'}}`, encodeURIComponent(String(indexRateSourceId)), ); // 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); 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, }; }, }; }; /** * IndexRatesApi - functional programming interface */ export const IndexRatesApiFp = function (configuration?: Configuration) { const localVarAxiosParamCreator = IndexRatesApiAxiosParamCreator(configuration); return { /** * * @summary Create index rate * @param {string} indexRateSourceId The ID of the index rate source. * @param {IndexRate} indexRate Index rate 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 createIndexRate( indexRateSourceId: string, indexRate: IndexRate, idempotencyKey?: string, options?: RawAxiosRequestConfig, ): Promise< (axios?: AxiosInstance, basePath?: string) => AxiosPromise > { const localVarAxiosArgs = await localVarAxiosParamCreator.createIndexRate( indexRateSourceId, indexRate, idempotencyKey, options, ); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['IndexRatesApi.createIndexRate']?.[ localVarOperationServerIndex ]?.url; return (axios, basePath) => createRequestFunction( localVarAxiosArgs, globalAxios, BASE_PATH, configuration, )(axios, localVarOperationServerBasePath || basePath); }, /** * * @summary Delete index rate * @param {string} indexRateSourceId The ID of the index rate source. * @param {string} indexRateId The encoded key of the index rate to be deleted. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async deleteIndexRate( indexRateSourceId: string, indexRateId: string, options?: RawAxiosRequestConfig, ): Promise< (axios?: AxiosInstance, basePath?: string) => AxiosPromise > { const localVarAxiosArgs = await localVarAxiosParamCreator.deleteIndexRate( indexRateSourceId, indexRateId, options, ); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['IndexRatesApi.deleteIndexRate']?.[ localVarOperationServerIndex ]?.url; return (axios, basePath) => createRequestFunction( localVarAxiosArgs, globalAxios, BASE_PATH, configuration, )(axios, localVarOperationServerBasePath || basePath); }, /** * * @summary Get index rates for a source * @param {string} indexRateSourceId The ID of the index rate source. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getAllIndexRates( indexRateSourceId: string, options?: RawAxiosRequestConfig, ): Promise< ( axios?: AxiosInstance, basePath?: string, ) => AxiosPromise> > { const localVarAxiosArgs = await localVarAxiosParamCreator.getAllIndexRates( indexRateSourceId, options, ); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['IndexRatesApi.getAllIndexRates']?.[ localVarOperationServerIndex ]?.url; return (axios, basePath) => createRequestFunction( localVarAxiosArgs, globalAxios, BASE_PATH, configuration, )(axios, localVarOperationServerBasePath || basePath); }, }; }; /** * IndexRatesApi - factory interface */ export const IndexRatesApiFactory = function ( configuration?: Configuration, basePath?: string, axios?: AxiosInstance, ) { const localVarFp = IndexRatesApiFp(configuration); return { /** * * @summary Create index rate * @param {string} indexRateSourceId The ID of the index rate source. * @param {IndexRate} indexRate Index rate 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} */ createIndexRate( indexRateSourceId: string, indexRate: IndexRate, idempotencyKey?: string, options?: RawAxiosRequestConfig, ): AxiosPromise { return localVarFp .createIndexRate(indexRateSourceId, indexRate, idempotencyKey, options) .then((request) => request(axios, basePath)); }, /** * * @summary Delete index rate * @param {string} indexRateSourceId The ID of the index rate source. * @param {string} indexRateId The encoded key of the index rate to be deleted. * @param {*} [options] Override http request option. * @throws {RequiredError} */ deleteIndexRate( indexRateSourceId: string, indexRateId: string, options?: RawAxiosRequestConfig, ): AxiosPromise { return localVarFp .deleteIndexRate(indexRateSourceId, indexRateId, options) .then((request) => request(axios, basePath)); }, /** * * @summary Get index rates for a source * @param {string} indexRateSourceId The ID of the index rate source. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getAllIndexRates( indexRateSourceId: string, options?: RawAxiosRequestConfig, ): AxiosPromise> { return localVarFp .getAllIndexRates(indexRateSourceId, options) .then((request) => request(axios, basePath)); }, }; }; /** * IndexRatesApi - object-oriented interface */ export class IndexRatesApi extends BaseAPI { /** * * @summary Create index rate * @param {string} indexRateSourceId The ID of the index rate source. * @param {IndexRate} indexRate Index rate 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 createIndexRate( indexRateSourceId: string, indexRate: IndexRate, idempotencyKey?: string, options?: RawAxiosRequestConfig, ) { return IndexRatesApiFp(this.configuration) .createIndexRate(indexRateSourceId, indexRate, idempotencyKey, options) .then((request) => request(this.axios, this.basePath)); } /** * * @summary Delete index rate * @param {string} indexRateSourceId The ID of the index rate source. * @param {string} indexRateId The encoded key of the index rate to be deleted. * @param {*} [options] Override http request option. * @throws {RequiredError} */ public deleteIndexRate( indexRateSourceId: string, indexRateId: string, options?: RawAxiosRequestConfig, ) { return IndexRatesApiFp(this.configuration) .deleteIndexRate(indexRateSourceId, indexRateId, options) .then((request) => request(this.axios, this.basePath)); } /** * * @summary Get index rates for a source * @param {string} indexRateSourceId The ID of the index rate source. * @param {*} [options] Override http request option. * @throws {RequiredError} */ public getAllIndexRates( indexRateSourceId: string, options?: RawAxiosRequestConfig, ) { return IndexRatesApiFp(this.configuration) .getAllIndexRates(indexRateSourceId, options) .then((request) => request(this.axios, this.basePath)); } }