/* tslint:disable */ /* eslint-disable */ /** * glaccounts * 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 { GLAccount } from '../models'; // @ts-ignore import type { GLAccountInput } from '../models'; // @ts-ignore import type { PatchOperation } from '../models'; /** * GLAccountsApi - axios parameter creator */ export const GLAccountsApiAxiosParamCreator = function ( configuration?: Configuration, ) { return { /** * * @summary Create general ledger account * @param {Array} gLAccountInput Represents the information to create a general ledger account. * @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} */ create: async ( gLAccountInput: Array, idempotencyKey?: string, options: RawAxiosRequestConfig = {}, ): Promise => { // verify required parameter 'gLAccountInput' is not null or undefined assertParamExists('create', 'gLAccountInput', gLAccountInput); const localVarPath = `/glaccounts`; // 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( gLAccountInput, localVarRequestOptions, configuration, ); return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * * @summary Get general ledger accounts * @param {GetAllTypeEnum} type The general ledger account type. * @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} [from] The start date to calculate the account balance from. * @param {string} [to] The end date to calculate the account balance to. * @param {string} [branchId] The branch ID that the general ledger account balances are generated for. * @param {boolean} [balanceExcluded] `TRUE` if the balance is excluded, `FALSE` otherwise. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getAll: async ( type: GetAllTypeEnum, offset?: number, limit?: number, paginationDetails?: GetAllPaginationDetailsEnum, from?: string, to?: string, branchId?: string, balanceExcluded?: boolean, options: RawAxiosRequestConfig = {}, ): Promise => { // verify required parameter 'type' is not null or undefined assertParamExists('getAll', 'type', type); const localVarPath = `/glaccounts`; // 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 (type !== undefined) { localVarQueryParameter['type'] = type; } if (from !== undefined) { localVarQueryParameter['from'] = (from as any) instanceof Date ? (from as any).toISOString().substring(0, 10) : from; } if (to !== undefined) { localVarQueryParameter['to'] = (to as any) instanceof Date ? (to as any).toISOString().substring(0, 10) : to; } if (branchId !== undefined) { localVarQueryParameter['branchId'] = branchId; } if (balanceExcluded !== undefined) { localVarQueryParameter['balanceExcluded'] = balanceExcluded; } 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 general ledger account * @param {string} glAccountId The general ledger account code or encoded key. * @param {string} [from] The start date to calculate the account balance from. * @param {string} [to] The end date to calculate the account balance to. * @param {string} [branchId] The branch ID to use to calculate general ledger account balances. * @param {boolean} [balanceExcluded] `TRUE` if the balance is excluded, `FALSE` otherwise. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getById: async ( glAccountId: string, from?: string, to?: string, branchId?: string, balanceExcluded?: boolean, options: RawAxiosRequestConfig = {}, ): Promise => { // verify required parameter 'glAccountId' is not null or undefined assertParamExists('getById', 'glAccountId', glAccountId); const localVarPath = `/glaccounts/{glAccountId}`.replace( `{${'glAccountId'}}`, encodeURIComponent(String(glAccountId)), ); // 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 (from !== undefined) { localVarQueryParameter['from'] = (from as any) instanceof Date ? (from as any).toISOString().substring(0, 10) : from; } if (to !== undefined) { localVarQueryParameter['to'] = (to as any) instanceof Date ? (to as any).toISOString().substring(0, 10) : to; } if (branchId !== undefined) { localVarQueryParameter['branchId'] = branchId; } if (balanceExcluded !== undefined) { localVarQueryParameter['balanceExcluded'] = balanceExcluded; } 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 Partially update an existing general ledger account * @param {string} glAccountId The general ledger account code or encoded key. * @param {Array} patchOperation Patch operations to be applied to a resource. * @param {*} [options] Override http request option. * @throws {RequiredError} */ patch: async ( glAccountId: string, patchOperation: Array, options: RawAxiosRequestConfig = {}, ): Promise => { // verify required parameter 'glAccountId' is not null or undefined assertParamExists('patch', 'glAccountId', glAccountId); // verify required parameter 'patchOperation' is not null or undefined assertParamExists('patch', 'patchOperation', patchOperation); const localVarPath = `/glaccounts/{glAccountId}`.replace( `{${'glAccountId'}}`, encodeURIComponent(String(glAccountId)), ); // 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: 'PATCH', ...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( patchOperation, localVarRequestOptions, configuration, ); return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, }; }; /** * GLAccountsApi - functional programming interface */ export const GLAccountsApiFp = function (configuration?: Configuration) { const localVarAxiosParamCreator = GLAccountsApiAxiosParamCreator(configuration); return { /** * * @summary Create general ledger account * @param {Array} gLAccountInput Represents the information to create a general ledger account. * @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 create( gLAccountInput: Array, idempotencyKey?: string, options?: RawAxiosRequestConfig, ): Promise< ( axios?: AxiosInstance, basePath?: string, ) => AxiosPromise> > { const localVarAxiosArgs = await localVarAxiosParamCreator.create( gLAccountInput, idempotencyKey, options, ); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['GLAccountsApi.create']?.[ localVarOperationServerIndex ]?.url; return (axios, basePath) => createRequestFunction( localVarAxiosArgs, globalAxios, BASE_PATH, configuration, )(axios, localVarOperationServerBasePath || basePath); }, /** * * @summary Get general ledger accounts * @param {GetAllTypeEnum} type The general ledger account type. * @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} [from] The start date to calculate the account balance from. * @param {string} [to] The end date to calculate the account balance to. * @param {string} [branchId] The branch ID that the general ledger account balances are generated for. * @param {boolean} [balanceExcluded] `TRUE` if the balance is excluded, `FALSE` otherwise. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getAll( type: GetAllTypeEnum, offset?: number, limit?: number, paginationDetails?: GetAllPaginationDetailsEnum, from?: string, to?: string, branchId?: string, balanceExcluded?: boolean, options?: RawAxiosRequestConfig, ): Promise< ( axios?: AxiosInstance, basePath?: string, ) => AxiosPromise> > { const localVarAxiosArgs = await localVarAxiosParamCreator.getAll( type, offset, limit, paginationDetails, from, to, branchId, balanceExcluded, options, ); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['GLAccountsApi.getAll']?.[ localVarOperationServerIndex ]?.url; return (axios, basePath) => createRequestFunction( localVarAxiosArgs, globalAxios, BASE_PATH, configuration, )(axios, localVarOperationServerBasePath || basePath); }, /** * * @summary Get general ledger account * @param {string} glAccountId The general ledger account code or encoded key. * @param {string} [from] The start date to calculate the account balance from. * @param {string} [to] The end date to calculate the account balance to. * @param {string} [branchId] The branch ID to use to calculate general ledger account balances. * @param {boolean} [balanceExcluded] `TRUE` if the balance is excluded, `FALSE` otherwise. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getById( glAccountId: string, from?: string, to?: string, branchId?: string, balanceExcluded?: boolean, options?: RawAxiosRequestConfig, ): Promise< (axios?: AxiosInstance, basePath?: string) => AxiosPromise > { const localVarAxiosArgs = await localVarAxiosParamCreator.getById( glAccountId, from, to, branchId, balanceExcluded, options, ); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['GLAccountsApi.getById']?.[ localVarOperationServerIndex ]?.url; return (axios, basePath) => createRequestFunction( localVarAxiosArgs, globalAxios, BASE_PATH, configuration, )(axios, localVarOperationServerBasePath || basePath); }, /** * * @summary Partially update an existing general ledger account * @param {string} glAccountId The general ledger account code or encoded key. * @param {Array} patchOperation Patch operations to be applied to a resource. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async patch( glAccountId: string, patchOperation: Array, options?: RawAxiosRequestConfig, ): Promise< (axios?: AxiosInstance, basePath?: string) => AxiosPromise > { const localVarAxiosArgs = await localVarAxiosParamCreator.patch( glAccountId, patchOperation, options, ); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['GLAccountsApi.patch']?.[ localVarOperationServerIndex ]?.url; return (axios, basePath) => createRequestFunction( localVarAxiosArgs, globalAxios, BASE_PATH, configuration, )(axios, localVarOperationServerBasePath || basePath); }, }; }; /** * GLAccountsApi - factory interface */ export const GLAccountsApiFactory = function ( configuration?: Configuration, basePath?: string, axios?: AxiosInstance, ) { const localVarFp = GLAccountsApiFp(configuration); return { /** * * @summary Create general ledger account * @param {Array} gLAccountInput Represents the information to create a general ledger account. * @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} */ create( gLAccountInput: Array, idempotencyKey?: string, options?: RawAxiosRequestConfig, ): AxiosPromise> { return localVarFp .create(gLAccountInput, idempotencyKey, options) .then((request) => request(axios, basePath)); }, /** * * @summary Get general ledger accounts * @param {GetAllTypeEnum} type The general ledger account type. * @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} [from] The start date to calculate the account balance from. * @param {string} [to] The end date to calculate the account balance to. * @param {string} [branchId] The branch ID that the general ledger account balances are generated for. * @param {boolean} [balanceExcluded] `TRUE` if the balance is excluded, `FALSE` otherwise. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getAll( type: GetAllTypeEnum, offset?: number, limit?: number, paginationDetails?: GetAllPaginationDetailsEnum, from?: string, to?: string, branchId?: string, balanceExcluded?: boolean, options?: RawAxiosRequestConfig, ): AxiosPromise> { return localVarFp .getAll( type, offset, limit, paginationDetails, from, to, branchId, balanceExcluded, options, ) .then((request) => request(axios, basePath)); }, /** * * @summary Get general ledger account * @param {string} glAccountId The general ledger account code or encoded key. * @param {string} [from] The start date to calculate the account balance from. * @param {string} [to] The end date to calculate the account balance to. * @param {string} [branchId] The branch ID to use to calculate general ledger account balances. * @param {boolean} [balanceExcluded] `TRUE` if the balance is excluded, `FALSE` otherwise. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getById( glAccountId: string, from?: string, to?: string, branchId?: string, balanceExcluded?: boolean, options?: RawAxiosRequestConfig, ): AxiosPromise { return localVarFp .getById(glAccountId, from, to, branchId, balanceExcluded, options) .then((request) => request(axios, basePath)); }, /** * * @summary Partially update an existing general ledger account * @param {string} glAccountId The general ledger account code or encoded key. * @param {Array} patchOperation Patch operations to be applied to a resource. * @param {*} [options] Override http request option. * @throws {RequiredError} */ patch( glAccountId: string, patchOperation: Array, options?: RawAxiosRequestConfig, ): AxiosPromise { return localVarFp .patch(glAccountId, patchOperation, options) .then((request) => request(axios, basePath)); }, }; }; /** * GLAccountsApi - object-oriented interface */ export class GLAccountsApi extends BaseAPI { /** * * @summary Create general ledger account * @param {Array} gLAccountInput Represents the information to create a general ledger account. * @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 create( gLAccountInput: Array, idempotencyKey?: string, options?: RawAxiosRequestConfig, ) { return GLAccountsApiFp(this.configuration) .create(gLAccountInput, idempotencyKey, options) .then((request) => request(this.axios, this.basePath)); } /** * * @summary Get general ledger accounts * @param {GetAllTypeEnum} type The general ledger account type. * @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} [from] The start date to calculate the account balance from. * @param {string} [to] The end date to calculate the account balance to. * @param {string} [branchId] The branch ID that the general ledger account balances are generated for. * @param {boolean} [balanceExcluded] `TRUE` if the balance is excluded, `FALSE` otherwise. * @param {*} [options] Override http request option. * @throws {RequiredError} */ public getAll( type: GetAllTypeEnum, offset?: number, limit?: number, paginationDetails?: GetAllPaginationDetailsEnum, from?: string, to?: string, branchId?: string, balanceExcluded?: boolean, options?: RawAxiosRequestConfig, ) { return GLAccountsApiFp(this.configuration) .getAll( type, offset, limit, paginationDetails, from, to, branchId, balanceExcluded, options, ) .then((request) => request(this.axios, this.basePath)); } /** * * @summary Get general ledger account * @param {string} glAccountId The general ledger account code or encoded key. * @param {string} [from] The start date to calculate the account balance from. * @param {string} [to] The end date to calculate the account balance to. * @param {string} [branchId] The branch ID to use to calculate general ledger account balances. * @param {boolean} [balanceExcluded] `TRUE` if the balance is excluded, `FALSE` otherwise. * @param {*} [options] Override http request option. * @throws {RequiredError} */ public getById( glAccountId: string, from?: string, to?: string, branchId?: string, balanceExcluded?: boolean, options?: RawAxiosRequestConfig, ) { return GLAccountsApiFp(this.configuration) .getById(glAccountId, from, to, branchId, balanceExcluded, options) .then((request) => request(this.axios, this.basePath)); } /** * * @summary Partially update an existing general ledger account * @param {string} glAccountId The general ledger account code or encoded key. * @param {Array} patchOperation Patch operations to be applied to a resource. * @param {*} [options] Override http request option. * @throws {RequiredError} */ public patch( glAccountId: string, patchOperation: Array, options?: RawAxiosRequestConfig, ) { return GLAccountsApiFp(this.configuration) .patch(glAccountId, patchOperation, options) .then((request) => request(this.axios, this.basePath)); } } export const GetAllTypeEnum = { Asset: 'ASSET', Liability: 'LIABILITY', Equity: 'EQUITY', Income: 'INCOME', Expense: 'EXPENSE', } as const; export type GetAllTypeEnum = (typeof GetAllTypeEnum)[keyof typeof GetAllTypeEnum]; export const GetAllPaginationDetailsEnum = { On: 'ON', Off: 'OFF', } as const; export type GetAllPaginationDetailsEnum = (typeof GetAllPaginationDetailsEnum)[keyof typeof GetAllPaginationDetailsEnum];