/* tslint:disable */ /* eslint-disable */ /** * comments * 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 { Comment } from '../models'; // @ts-ignore import type { ErrorResponse } from '../models'; /** * CommentsApi - axios parameter creator */ export const CommentsApiAxiosParamCreator = function ( configuration?: Configuration, ) { return { /** * * @summary Create a new comment for an entity. * @param {Comment} comment The comment to be created, which contains the message, the key, and entity type: `CLIENT`, `GROUP`, `LOAN_ACCOUNT`, `DEPOSIT_ACCOUNT`, `BRANCH`, `CENTRE`, `USER`, `LOAN_PRODUCT`, or `SAVINGS_PRODUCT`. * @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} */ createComment: async ( comment: Comment, idempotencyKey?: string, options: RawAxiosRequestConfig = {}, ): Promise => { // verify required parameter 'comment' is not null or undefined assertParamExists('createComment', 'comment', comment); const localVarPath = `/comments`; // 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( comment, localVarRequestOptions, configuration, ); return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * * @summary Get comments for an entity * @param {GetCommentsOwnerTypeEnum} ownerType The type of the entity that owns the comment: `CLIENT`, `GROUP`, `LOAN_ACCOUNT`, `DEPOSIT_ACCOUNT`, `BRANCH`, `CENTRE`, `USER`, `LOAN_PRODUCT`, or `SAVINGS_PRODUCT`. * @param {string} ownerKey The ID or key of the entity that owns the comment. * @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 {GetCommentsPaginationDetailsEnum} [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 {*} [options] Override http request option. * @throws {RequiredError} */ getComments: async ( ownerType: GetCommentsOwnerTypeEnum, ownerKey: string, offset?: number, limit?: number, paginationDetails?: GetCommentsPaginationDetailsEnum, options: RawAxiosRequestConfig = {}, ): Promise => { // verify required parameter 'ownerType' is not null or undefined assertParamExists('getComments', 'ownerType', ownerType); // verify required parameter 'ownerKey' is not null or undefined assertParamExists('getComments', 'ownerKey', ownerKey); const localVarPath = `/comments`; // 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 (ownerType !== undefined) { localVarQueryParameter['ownerType'] = ownerType; } if (ownerKey !== undefined) { localVarQueryParameter['ownerKey'] = ownerKey; } 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, }; }, }; }; /** * CommentsApi - functional programming interface */ export const CommentsApiFp = function (configuration?: Configuration) { const localVarAxiosParamCreator = CommentsApiAxiosParamCreator(configuration); return { /** * * @summary Create a new comment for an entity. * @param {Comment} comment The comment to be created, which contains the message, the key, and entity type: `CLIENT`, `GROUP`, `LOAN_ACCOUNT`, `DEPOSIT_ACCOUNT`, `BRANCH`, `CENTRE`, `USER`, `LOAN_PRODUCT`, or `SAVINGS_PRODUCT`. * @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 createComment( comment: Comment, idempotencyKey?: string, options?: RawAxiosRequestConfig, ): Promise< (axios?: AxiosInstance, basePath?: string) => AxiosPromise > { const localVarAxiosArgs = await localVarAxiosParamCreator.createComment( comment, idempotencyKey, options, ); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['CommentsApi.createComment']?.[ localVarOperationServerIndex ]?.url; return (axios, basePath) => createRequestFunction( localVarAxiosArgs, globalAxios, BASE_PATH, configuration, )(axios, localVarOperationServerBasePath || basePath); }, /** * * @summary Get comments for an entity * @param {GetCommentsOwnerTypeEnum} ownerType The type of the entity that owns the comment: `CLIENT`, `GROUP`, `LOAN_ACCOUNT`, `DEPOSIT_ACCOUNT`, `BRANCH`, `CENTRE`, `USER`, `LOAN_PRODUCT`, or `SAVINGS_PRODUCT`. * @param {string} ownerKey The ID or key of the entity that owns the comment. * @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 {GetCommentsPaginationDetailsEnum} [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 {*} [options] Override http request option. * @throws {RequiredError} */ async getComments( ownerType: GetCommentsOwnerTypeEnum, ownerKey: string, offset?: number, limit?: number, paginationDetails?: GetCommentsPaginationDetailsEnum, options?: RawAxiosRequestConfig, ): Promise< (axios?: AxiosInstance, basePath?: string) => AxiosPromise> > { const localVarAxiosArgs = await localVarAxiosParamCreator.getComments( ownerType, ownerKey, offset, limit, paginationDetails, options, ); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['CommentsApi.getComments']?.[ localVarOperationServerIndex ]?.url; return (axios, basePath) => createRequestFunction( localVarAxiosArgs, globalAxios, BASE_PATH, configuration, )(axios, localVarOperationServerBasePath || basePath); }, }; }; /** * CommentsApi - factory interface */ export const CommentsApiFactory = function ( configuration?: Configuration, basePath?: string, axios?: AxiosInstance, ) { const localVarFp = CommentsApiFp(configuration); return { /** * * @summary Create a new comment for an entity. * @param {Comment} comment The comment to be created, which contains the message, the key, and entity type: `CLIENT`, `GROUP`, `LOAN_ACCOUNT`, `DEPOSIT_ACCOUNT`, `BRANCH`, `CENTRE`, `USER`, `LOAN_PRODUCT`, or `SAVINGS_PRODUCT`. * @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} */ createComment( comment: Comment, idempotencyKey?: string, options?: RawAxiosRequestConfig, ): AxiosPromise { return localVarFp .createComment(comment, idempotencyKey, options) .then((request) => request(axios, basePath)); }, /** * * @summary Get comments for an entity * @param {GetCommentsOwnerTypeEnum} ownerType The type of the entity that owns the comment: `CLIENT`, `GROUP`, `LOAN_ACCOUNT`, `DEPOSIT_ACCOUNT`, `BRANCH`, `CENTRE`, `USER`, `LOAN_PRODUCT`, or `SAVINGS_PRODUCT`. * @param {string} ownerKey The ID or key of the entity that owns the comment. * @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 {GetCommentsPaginationDetailsEnum} [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 {*} [options] Override http request option. * @throws {RequiredError} */ getComments( ownerType: GetCommentsOwnerTypeEnum, ownerKey: string, offset?: number, limit?: number, paginationDetails?: GetCommentsPaginationDetailsEnum, options?: RawAxiosRequestConfig, ): AxiosPromise> { return localVarFp .getComments( ownerType, ownerKey, offset, limit, paginationDetails, options, ) .then((request) => request(axios, basePath)); }, }; }; /** * CommentsApi - object-oriented interface */ export class CommentsApi extends BaseAPI { /** * * @summary Create a new comment for an entity. * @param {Comment} comment The comment to be created, which contains the message, the key, and entity type: `CLIENT`, `GROUP`, `LOAN_ACCOUNT`, `DEPOSIT_ACCOUNT`, `BRANCH`, `CENTRE`, `USER`, `LOAN_PRODUCT`, or `SAVINGS_PRODUCT`. * @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 createComment( comment: Comment, idempotencyKey?: string, options?: RawAxiosRequestConfig, ) { return CommentsApiFp(this.configuration) .createComment(comment, idempotencyKey, options) .then((request) => request(this.axios, this.basePath)); } /** * * @summary Get comments for an entity * @param {GetCommentsOwnerTypeEnum} ownerType The type of the entity that owns the comment: `CLIENT`, `GROUP`, `LOAN_ACCOUNT`, `DEPOSIT_ACCOUNT`, `BRANCH`, `CENTRE`, `USER`, `LOAN_PRODUCT`, or `SAVINGS_PRODUCT`. * @param {string} ownerKey The ID or key of the entity that owns the comment. * @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 {GetCommentsPaginationDetailsEnum} [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 {*} [options] Override http request option. * @throws {RequiredError} */ public getComments( ownerType: GetCommentsOwnerTypeEnum, ownerKey: string, offset?: number, limit?: number, paginationDetails?: GetCommentsPaginationDetailsEnum, options?: RawAxiosRequestConfig, ) { return CommentsApiFp(this.configuration) .getComments( ownerType, ownerKey, offset, limit, paginationDetails, options, ) .then((request) => request(this.axios, this.basePath)); } } export const GetCommentsOwnerTypeEnum = { Client: 'CLIENT', Group: 'GROUP', LoanProduct: 'LOAN_PRODUCT', SavingsProduct: 'SAVINGS_PRODUCT', Centre: 'CENTRE', Branch: 'BRANCH', User: 'USER', LoanAccount: 'LOAN_ACCOUNT', DepositAccount: 'DEPOSIT_ACCOUNT', IdDocument: 'ID_DOCUMENT', LineOfCredit: 'LINE_OF_CREDIT', GlJournalEntry: 'GL_JOURNAL_ENTRY', } as const; export type GetCommentsOwnerTypeEnum = (typeof GetCommentsOwnerTypeEnum)[keyof typeof GetCommentsOwnerTypeEnum]; export const GetCommentsPaginationDetailsEnum = { On: 'ON', Off: 'OFF', } as const; export type GetCommentsPaginationDetailsEnum = (typeof GetCommentsPaginationDetailsEnum)[keyof typeof GetCommentsPaginationDetailsEnum];