/* tslint:disable */ /* eslint-disable */ /** * installments * 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 { Installment } from '../models'; /** * InstallmentsApi - axios parameter creator */ export const InstallmentsApiAxiosParamCreator = function ( configuration?: Configuration, ) { return { /** * * @summary Get installments for `ACTIVE` or `ACTIVE_IN_ARREARS` loan accounts * @param {string} dueFrom The date of the installments to search from * @param {string} dueTo The date of the installments to search to * @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} [productTypeKey] The encoded key of the product type to search for * @param {GetAllAccountStateEnum} [accountState] The state of the loan accounts to search for * @param {GetAllInstallmentStateEnum} [installmentState] The state of the installments to search for * @param {*} [options] Override http request option. * @throws {RequiredError} */ getAll: async ( dueFrom: string, dueTo: string, offset?: number, limit?: number, paginationDetails?: GetAllPaginationDetailsEnum, productTypeKey?: string, accountState?: GetAllAccountStateEnum, installmentState?: GetAllInstallmentStateEnum, options: RawAxiosRequestConfig = {}, ): Promise => { // verify required parameter 'dueFrom' is not null or undefined assertParamExists('getAll', 'dueFrom', dueFrom); // verify required parameter 'dueTo' is not null or undefined assertParamExists('getAll', 'dueTo', dueTo); const localVarPath = `/installments`; // 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 (dueFrom !== undefined) { localVarQueryParameter['dueFrom'] = (dueFrom as any) instanceof Date ? (dueFrom as any).toISOString().substring(0, 10) : dueFrom; } if (dueTo !== undefined) { localVarQueryParameter['dueTo'] = (dueTo as any) instanceof Date ? (dueTo as any).toISOString().substring(0, 10) : dueTo; } if (productTypeKey !== undefined) { localVarQueryParameter['productTypeKey'] = productTypeKey; } if (accountState !== undefined) { localVarQueryParameter['accountState'] = accountState; } if (installmentState !== undefined) { localVarQueryParameter['installmentState'] = installmentState; } 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, }; }, }; }; /** * InstallmentsApi - functional programming interface */ export const InstallmentsApiFp = function (configuration?: Configuration) { const localVarAxiosParamCreator = InstallmentsApiAxiosParamCreator(configuration); return { /** * * @summary Get installments for `ACTIVE` or `ACTIVE_IN_ARREARS` loan accounts * @param {string} dueFrom The date of the installments to search from * @param {string} dueTo The date of the installments to search to * @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} [productTypeKey] The encoded key of the product type to search for * @param {GetAllAccountStateEnum} [accountState] The state of the loan accounts to search for * @param {GetAllInstallmentStateEnum} [installmentState] The state of the installments to search for * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getAll( dueFrom: string, dueTo: string, offset?: number, limit?: number, paginationDetails?: GetAllPaginationDetailsEnum, productTypeKey?: string, accountState?: GetAllAccountStateEnum, installmentState?: GetAllInstallmentStateEnum, options?: RawAxiosRequestConfig, ): Promise< ( axios?: AxiosInstance, basePath?: string, ) => AxiosPromise> > { const localVarAxiosArgs = await localVarAxiosParamCreator.getAll( dueFrom, dueTo, offset, limit, paginationDetails, productTypeKey, accountState, installmentState, options, ); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['InstallmentsApi.getAll']?.[ localVarOperationServerIndex ]?.url; return (axios, basePath) => createRequestFunction( localVarAxiosArgs, globalAxios, BASE_PATH, configuration, )(axios, localVarOperationServerBasePath || basePath); }, }; }; /** * InstallmentsApi - factory interface */ export const InstallmentsApiFactory = function ( configuration?: Configuration, basePath?: string, axios?: AxiosInstance, ) { const localVarFp = InstallmentsApiFp(configuration); return { /** * * @summary Get installments for `ACTIVE` or `ACTIVE_IN_ARREARS` loan accounts * @param {string} dueFrom The date of the installments to search from * @param {string} dueTo The date of the installments to search to * @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} [productTypeKey] The encoded key of the product type to search for * @param {GetAllAccountStateEnum} [accountState] The state of the loan accounts to search for * @param {GetAllInstallmentStateEnum} [installmentState] The state of the installments to search for * @param {*} [options] Override http request option. * @throws {RequiredError} */ getAll( dueFrom: string, dueTo: string, offset?: number, limit?: number, paginationDetails?: GetAllPaginationDetailsEnum, productTypeKey?: string, accountState?: GetAllAccountStateEnum, installmentState?: GetAllInstallmentStateEnum, options?: RawAxiosRequestConfig, ): AxiosPromise> { return localVarFp .getAll( dueFrom, dueTo, offset, limit, paginationDetails, productTypeKey, accountState, installmentState, options, ) .then((request) => request(axios, basePath)); }, }; }; /** * InstallmentsApi - object-oriented interface */ export class InstallmentsApi extends BaseAPI { /** * * @summary Get installments for `ACTIVE` or `ACTIVE_IN_ARREARS` loan accounts * @param {string} dueFrom The date of the installments to search from * @param {string} dueTo The date of the installments to search to * @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} [productTypeKey] The encoded key of the product type to search for * @param {GetAllAccountStateEnum} [accountState] The state of the loan accounts to search for * @param {GetAllInstallmentStateEnum} [installmentState] The state of the installments to search for * @param {*} [options] Override http request option. * @throws {RequiredError} */ public getAll( dueFrom: string, dueTo: string, offset?: number, limit?: number, paginationDetails?: GetAllPaginationDetailsEnum, productTypeKey?: string, accountState?: GetAllAccountStateEnum, installmentState?: GetAllInstallmentStateEnum, options?: RawAxiosRequestConfig, ) { return InstallmentsApiFp(this.configuration) .getAll( dueFrom, dueTo, offset, limit, paginationDetails, productTypeKey, accountState, installmentState, 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]; export const GetAllAccountStateEnum = { PartialApplication: 'PARTIAL_APPLICATION', PendingApproval: 'PENDING_APPROVAL', Approved: 'APPROVED', Active: 'ACTIVE', ActiveInArrears: 'ACTIVE_IN_ARREARS', Closed: 'CLOSED', ClosedWrittenOff: 'CLOSED_WRITTEN_OFF', ClosedRejected: 'CLOSED_REJECTED', } as const; export type GetAllAccountStateEnum = (typeof GetAllAccountStateEnum)[keyof typeof GetAllAccountStateEnum]; export const GetAllInstallmentStateEnum = { Pending: 'PENDING', Late: 'LATE', Paid: 'PAID', PartiallyPaid: 'PARTIALLY_PAID', Grace: 'GRACE', } as const; export type GetAllInstallmentStateEnum = (typeof GetAllInstallmentStateEnum)[keyof typeof GetAllInstallmentStateEnum];