/* tslint:disable */ /* eslint-disable */ /** * loans * 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 { ApplyBalanceInterestInput } from '../models'; // @ts-ignore import type { ErrorResponse } from '../models'; // @ts-ignore import type { LoanAccountBalanceChanges } from '../models'; // @ts-ignore import type { LoanAccountBalances } from '../models'; /** * LoanAccountBalancesApi - axios parameter creator */ export const LoanAccountBalancesApiAxiosParamCreator = function ( configuration?: Configuration, ) { return { /** * * @summary Apply interest on a loan account balance * @param {string} loanAccountId The ID or encoded key of the loan account. * @param {string} loanAccountBalance Loan account balance to apply interest on * @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 {ApplyBalanceInterestInput} [applyBalanceInterestInput] Represents a request for applying the accrued interest on a loan account balance * @param {*} [options] Override http request option. * @throws {RequiredError} */ applyBalanceInterest: async ( loanAccountId: string, loanAccountBalance: string, idempotencyKey?: string, applyBalanceInterestInput?: ApplyBalanceInterestInput, options: RawAxiosRequestConfig = {}, ): Promise => { // verify required parameter 'loanAccountId' is not null or undefined assertParamExists('applyBalanceInterest', 'loanAccountId', loanAccountId); // verify required parameter 'loanAccountBalance' is not null or undefined assertParamExists( 'applyBalanceInterest', 'loanAccountBalance', loanAccountBalance, ); const localVarPath = `/loans/{loanAccountId}/balances/{loanAccountBalance}:applyInterest` .replace( `{${'loanAccountId'}}`, encodeURIComponent(String(loanAccountId)), ) .replace( `{${'loanAccountBalance'}}`, encodeURIComponent(String(loanAccountBalance)), ); // 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( applyBalanceInterestInput, localVarRequestOptions, configuration, ); return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * * @summary Get loan account balances * @param {string} loanAccountId The ID or encoded key of the loan account. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getBalancesByLoanAccountId: async ( loanAccountId: string, options: RawAxiosRequestConfig = {}, ): Promise => { // verify required parameter 'loanAccountId' is not null or undefined assertParamExists( 'getBalancesByLoanAccountId', 'loanAccountId', loanAccountId, ); const localVarPath = `/loans/{loanAccountId}/balances`.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, }; }, }; }; /** * LoanAccountBalancesApi - functional programming interface */ export const LoanAccountBalancesApiFp = function ( configuration?: Configuration, ) { const localVarAxiosParamCreator = LoanAccountBalancesApiAxiosParamCreator(configuration); return { /** * * @summary Apply interest on a loan account balance * @param {string} loanAccountId The ID or encoded key of the loan account. * @param {string} loanAccountBalance Loan account balance to apply interest on * @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 {ApplyBalanceInterestInput} [applyBalanceInterestInput] Represents a request for applying the accrued interest on a loan account balance * @param {*} [options] Override http request option. * @throws {RequiredError} */ async applyBalanceInterest( loanAccountId: string, loanAccountBalance: string, idempotencyKey?: string, applyBalanceInterestInput?: ApplyBalanceInterestInput, options?: RawAxiosRequestConfig, ): Promise< ( axios?: AxiosInstance, basePath?: string, ) => AxiosPromise > { const localVarAxiosArgs = await localVarAxiosParamCreator.applyBalanceInterest( loanAccountId, loanAccountBalance, idempotencyKey, applyBalanceInterestInput, options, ); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['LoanAccountBalancesApi.applyBalanceInterest']?.[ localVarOperationServerIndex ]?.url; return (axios, basePath) => createRequestFunction( localVarAxiosArgs, globalAxios, BASE_PATH, configuration, )(axios, localVarOperationServerBasePath || basePath); }, /** * * @summary Get loan account balances * @param {string} loanAccountId The ID or encoded key of the loan account. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getBalancesByLoanAccountId( loanAccountId: string, options?: RawAxiosRequestConfig, ): Promise< ( axios?: AxiosInstance, basePath?: string, ) => AxiosPromise > { const localVarAxiosArgs = await localVarAxiosParamCreator.getBalancesByLoanAccountId( loanAccountId, options, ); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap[ 'LoanAccountBalancesApi.getBalancesByLoanAccountId' ]?.[localVarOperationServerIndex]?.url; return (axios, basePath) => createRequestFunction( localVarAxiosArgs, globalAxios, BASE_PATH, configuration, )(axios, localVarOperationServerBasePath || basePath); }, }; }; /** * LoanAccountBalancesApi - factory interface */ export const LoanAccountBalancesApiFactory = function ( configuration?: Configuration, basePath?: string, axios?: AxiosInstance, ) { const localVarFp = LoanAccountBalancesApiFp(configuration); return { /** * * @summary Apply interest on a loan account balance * @param {string} loanAccountId The ID or encoded key of the loan account. * @param {string} loanAccountBalance Loan account balance to apply interest on * @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 {ApplyBalanceInterestInput} [applyBalanceInterestInput] Represents a request for applying the accrued interest on a loan account balance * @param {*} [options] Override http request option. * @throws {RequiredError} */ applyBalanceInterest( loanAccountId: string, loanAccountBalance: string, idempotencyKey?: string, applyBalanceInterestInput?: ApplyBalanceInterestInput, options?: RawAxiosRequestConfig, ): AxiosPromise { return localVarFp .applyBalanceInterest( loanAccountId, loanAccountBalance, idempotencyKey, applyBalanceInterestInput, options, ) .then((request) => request(axios, basePath)); }, /** * * @summary Get loan account balances * @param {string} loanAccountId The ID or encoded key of the loan account. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getBalancesByLoanAccountId( loanAccountId: string, options?: RawAxiosRequestConfig, ): AxiosPromise { return localVarFp .getBalancesByLoanAccountId(loanAccountId, options) .then((request) => request(axios, basePath)); }, }; }; /** * LoanAccountBalancesApi - object-oriented interface */ export class LoanAccountBalancesApi extends BaseAPI { /** * * @summary Apply interest on a loan account balance * @param {string} loanAccountId The ID or encoded key of the loan account. * @param {string} loanAccountBalance Loan account balance to apply interest on * @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 {ApplyBalanceInterestInput} [applyBalanceInterestInput] Represents a request for applying the accrued interest on a loan account balance * @param {*} [options] Override http request option. * @throws {RequiredError} */ public applyBalanceInterest( loanAccountId: string, loanAccountBalance: string, idempotencyKey?: string, applyBalanceInterestInput?: ApplyBalanceInterestInput, options?: RawAxiosRequestConfig, ) { return LoanAccountBalancesApiFp(this.configuration) .applyBalanceInterest( loanAccountId, loanAccountBalance, idempotencyKey, applyBalanceInterestInput, options, ) .then((request) => request(this.axios, this.basePath)); } /** * * @summary Get loan account balances * @param {string} loanAccountId The ID or encoded key of the loan account. * @param {*} [options] Override http request option. * @throws {RequiredError} */ public getBalancesByLoanAccountId( loanAccountId: string, options?: RawAxiosRequestConfig, ) { return LoanAccountBalancesApiFp(this.configuration) .getBalancesByLoanAccountId(loanAccountId, options) .then((request) => request(this.axios, this.basePath)); } }