/* tslint:disable */ /* eslint-disable */ /** * loans/tranches * 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 { LoanTranche } from '../models'; /** * LoanAccountTranchesApi - axios parameter creator */ export const LoanAccountTranchesApiAxiosParamCreator = function ( configuration?: Configuration, ) { return { /** * * @summary Update loan account tranches list * @param {string} loanAccountId The ID or encoded key of the loan account. * @param {Array} loanTranche The list of tranches to update the current loan account with. * @param {*} [options] Override http request option. * @throws {RequiredError} */ editTranches: async ( loanAccountId: string, loanTranche: Array, options: RawAxiosRequestConfig = {}, ): Promise => { // verify required parameter 'loanAccountId' is not null or undefined assertParamExists('editTranches', 'loanAccountId', loanAccountId); // verify required parameter 'loanTranche' is not null or undefined assertParamExists('editTranches', 'loanTranche', loanTranche); const localVarPath = `/loans/{loanAccountId}/tranches`.replace( `{${'loanAccountId'}}`, encodeURIComponent(String(loanAccountId)), ); // 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( loanTranche, localVarRequestOptions, configuration, ); return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * * @summary Get loan account tranches list * @param {string} loanAccountId The ID or encoded key of the loan account. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getTranches: async ( loanAccountId: string, options: RawAxiosRequestConfig = {}, ): Promise => { // verify required parameter 'loanAccountId' is not null or undefined assertParamExists('getTranches', 'loanAccountId', loanAccountId); const localVarPath = `/loans/{loanAccountId}/tranches`.replace( `{${'loanAccountId'}}`, encodeURIComponent(String(loanAccountId)), ); // 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, }; }, }; }; /** * LoanAccountTranchesApi - functional programming interface */ export const LoanAccountTranchesApiFp = function ( configuration?: Configuration, ) { const localVarAxiosParamCreator = LoanAccountTranchesApiAxiosParamCreator(configuration); return { /** * * @summary Update loan account tranches list * @param {string} loanAccountId The ID or encoded key of the loan account. * @param {Array} loanTranche The list of tranches to update the current loan account with. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async editTranches( loanAccountId: string, loanTranche: Array, options?: RawAxiosRequestConfig, ): Promise< ( axios?: AxiosInstance, basePath?: string, ) => AxiosPromise> > { const localVarAxiosArgs = await localVarAxiosParamCreator.editTranches( loanAccountId, loanTranche, options, ); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['LoanAccountTranchesApi.editTranches']?.[ localVarOperationServerIndex ]?.url; return (axios, basePath) => createRequestFunction( localVarAxiosArgs, globalAxios, BASE_PATH, configuration, )(axios, localVarOperationServerBasePath || basePath); }, /** * * @summary Get loan account tranches list * @param {string} loanAccountId The ID or encoded key of the loan account. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getTranches( loanAccountId: string, options?: RawAxiosRequestConfig, ): Promise< ( axios?: AxiosInstance, basePath?: string, ) => AxiosPromise> > { const localVarAxiosArgs = await localVarAxiosParamCreator.getTranches( loanAccountId, options, ); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['LoanAccountTranchesApi.getTranches']?.[ localVarOperationServerIndex ]?.url; return (axios, basePath) => createRequestFunction( localVarAxiosArgs, globalAxios, BASE_PATH, configuration, )(axios, localVarOperationServerBasePath || basePath); }, }; }; /** * LoanAccountTranchesApi - factory interface */ export const LoanAccountTranchesApiFactory = function ( configuration?: Configuration, basePath?: string, axios?: AxiosInstance, ) { const localVarFp = LoanAccountTranchesApiFp(configuration); return { /** * * @summary Update loan account tranches list * @param {string} loanAccountId The ID or encoded key of the loan account. * @param {Array} loanTranche The list of tranches to update the current loan account with. * @param {*} [options] Override http request option. * @throws {RequiredError} */ editTranches( loanAccountId: string, loanTranche: Array, options?: RawAxiosRequestConfig, ): AxiosPromise> { return localVarFp .editTranches(loanAccountId, loanTranche, options) .then((request) => request(axios, basePath)); }, /** * * @summary Get loan account tranches list * @param {string} loanAccountId The ID or encoded key of the loan account. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getTranches( loanAccountId: string, options?: RawAxiosRequestConfig, ): AxiosPromise> { return localVarFp .getTranches(loanAccountId, options) .then((request) => request(axios, basePath)); }, }; }; /** * LoanAccountTranchesApi - object-oriented interface */ export class LoanAccountTranchesApi extends BaseAPI { /** * * @summary Update loan account tranches list * @param {string} loanAccountId The ID or encoded key of the loan account. * @param {Array} loanTranche The list of tranches to update the current loan account with. * @param {*} [options] Override http request option. * @throws {RequiredError} */ public editTranches( loanAccountId: string, loanTranche: Array, options?: RawAxiosRequestConfig, ) { return LoanAccountTranchesApiFp(this.configuration) .editTranches(loanAccountId, loanTranche, options) .then((request) => request(this.axios, this.basePath)); } /** * * @summary Get loan account tranches list * @param {string} loanAccountId The ID or encoded key of the loan account. * @param {*} [options] Override http request option. * @throws {RequiredError} */ public getTranches(loanAccountId: string, options?: RawAxiosRequestConfig) { return LoanAccountTranchesApiFp(this.configuration) .getTranches(loanAccountId, options) .then((request) => request(this.axios, this.basePath)); } }