/* tslint:disable */ /* eslint-disable */ /** * accounting/reports * 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 { AccountingReport } from '../models'; // @ts-ignore import type { AccountingReportGenerationInput } from '../models'; // @ts-ignore import type { AccountingReportGenerationResponse } from '../models'; // @ts-ignore import type { ErrorResponse } from '../models'; /** * AccountingReportsApi - axios parameter creator */ export const AccountingReportsApiAxiosParamCreator = function ( configuration?: Configuration, ) { return { /** * * @summary Create accounting report * @param {AccountingReportGenerationInput} accountingReportGenerationInput Represents information for creating an accounting report. * @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 ( accountingReportGenerationInput: AccountingReportGenerationInput, idempotencyKey?: string, options: RawAxiosRequestConfig = {}, ): Promise => { // verify required parameter 'accountingReportGenerationInput' is not null or undefined assertParamExists( 'create', 'accountingReportGenerationInput', accountingReportGenerationInput, ); const localVarPath = `/accounting/reports`; // 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( accountingReportGenerationInput, localVarRequestOptions, configuration, ); return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * * @summary Get accounting reports * @param {string} reportKey The report\'s encoded key. * @param {*} [options] Override http request option. * @throws {RequiredError} */ get: async ( reportKey: string, options: RawAxiosRequestConfig = {}, ): Promise => { // verify required parameter 'reportKey' is not null or undefined assertParamExists('get', 'reportKey', reportKey); const localVarPath = `/accounting/reports/{reportKey}`.replace( `{${'reportKey'}}`, encodeURIComponent(String(reportKey)), ); // 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, }; }, }; }; /** * AccountingReportsApi - functional programming interface */ export const AccountingReportsApiFp = function (configuration?: Configuration) { const localVarAxiosParamCreator = AccountingReportsApiAxiosParamCreator(configuration); return { /** * * @summary Create accounting report * @param {AccountingReportGenerationInput} accountingReportGenerationInput Represents information for creating an accounting report. * @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( accountingReportGenerationInput: AccountingReportGenerationInput, idempotencyKey?: string, options?: RawAxiosRequestConfig, ): Promise< ( axios?: AxiosInstance, basePath?: string, ) => AxiosPromise > { const localVarAxiosArgs = await localVarAxiosParamCreator.create( accountingReportGenerationInput, idempotencyKey, options, ); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['AccountingReportsApi.create']?.[ localVarOperationServerIndex ]?.url; return (axios, basePath) => createRequestFunction( localVarAxiosArgs, globalAxios, BASE_PATH, configuration, )(axios, localVarOperationServerBasePath || basePath); }, /** * * @summary Get accounting reports * @param {string} reportKey The report\'s encoded key. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async get( reportKey: string, options?: RawAxiosRequestConfig, ): Promise< ( axios?: AxiosInstance, basePath?: string, ) => AxiosPromise > { const localVarAxiosArgs = await localVarAxiosParamCreator.get( reportKey, options, ); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['AccountingReportsApi.get']?.[ localVarOperationServerIndex ]?.url; return (axios, basePath) => createRequestFunction( localVarAxiosArgs, globalAxios, BASE_PATH, configuration, )(axios, localVarOperationServerBasePath || basePath); }, }; }; /** * AccountingReportsApi - factory interface */ export const AccountingReportsApiFactory = function ( configuration?: Configuration, basePath?: string, axios?: AxiosInstance, ) { const localVarFp = AccountingReportsApiFp(configuration); return { /** * * @summary Create accounting report * @param {AccountingReportGenerationInput} accountingReportGenerationInput Represents information for creating an accounting report. * @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( accountingReportGenerationInput: AccountingReportGenerationInput, idempotencyKey?: string, options?: RawAxiosRequestConfig, ): AxiosPromise { return localVarFp .create(accountingReportGenerationInput, idempotencyKey, options) .then((request) => request(axios, basePath)); }, /** * * @summary Get accounting reports * @param {string} reportKey The report\'s encoded key. * @param {*} [options] Override http request option. * @throws {RequiredError} */ get( reportKey: string, options?: RawAxiosRequestConfig, ): AxiosPromise { return localVarFp .get(reportKey, options) .then((request) => request(axios, basePath)); }, }; }; /** * AccountingReportsApi - object-oriented interface */ export class AccountingReportsApi extends BaseAPI { /** * * @summary Create accounting report * @param {AccountingReportGenerationInput} accountingReportGenerationInput Represents information for creating an accounting report. * @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( accountingReportGenerationInput: AccountingReportGenerationInput, idempotencyKey?: string, options?: RawAxiosRequestConfig, ) { return AccountingReportsApiFp(this.configuration) .create(accountingReportGenerationInput, idempotencyKey, options) .then((request) => request(this.axios, this.basePath)); } /** * * @summary Get accounting reports * @param {string} reportKey The report\'s encoded key. * @param {*} [options] Override http request option. * @throws {RequiredError} */ public get(reportKey: string, options?: RawAxiosRequestConfig) { return AccountingReportsApiFp(this.configuration) .get(reportKey, options) .then((request) => request(this.axios, this.basePath)); } }