/* tslint:disable */ /* eslint-disable */ /** * clients/documents * 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 { Document } from '../models'; // @ts-ignore import type { ErrorResponse } from '../models'; /** * ClientDocumentsApi - axios parameter creator */ export const ClientDocumentsApiAxiosParamCreator = function ( configuration?: Configuration, ) { return { /** * * @summary Create client document * @param {string} clientId The ID or encoded key of the client to be returned. * @param {File} file The file to be attached for a client. * @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 {string} [name] The name (title) of the attached file. * @param {string} [notes] The description of the attached file. * @param {*} [options] Override http request option. * @throws {RequiredError} */ createDocument: async ( clientId: string, file: File, idempotencyKey?: string, name?: string, notes?: string, options: RawAxiosRequestConfig = {}, ): Promise => { // verify required parameter 'clientId' is not null or undefined assertParamExists('createDocument', 'clientId', clientId); // verify required parameter 'file' is not null or undefined assertParamExists('createDocument', 'file', file); const localVarPath = `/clients/{clientId}/documents`.replace( `{${'clientId'}}`, encodeURIComponent(String(clientId)), ); // 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; const localVarFormParams = new ( (configuration && configuration.formDataCtor) || FormData )(); // authentication basic required // http basic authentication required setBasicAuthToObject(localVarRequestOptions, configuration); if (file !== undefined) { localVarFormParams.append('file', file as any); } if (name !== undefined) { localVarFormParams.append('name', name as any); } if (notes !== undefined) { localVarFormParams.append('notes', notes as any); } localVarHeaderParameter['Content-Type'] = 'multipart/form-data'; 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 = localVarFormParams; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * * @summary Get client document * @param {string} documentId The ID or encoded key of the client document to be returned. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getClientDocumentById: async ( documentId: string, options: RawAxiosRequestConfig = {}, ): Promise => { // verify required parameter 'documentId' is not null or undefined assertParamExists('getClientDocumentById', 'documentId', documentId); const localVarPath = `/clients/documents/{documentId}/metadata`.replace( `{${'documentId'}}`, encodeURIComponent(String(documentId)), ); // 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, }; }, /** * * @summary Download client document * @param {string} documentId The ID or encoded key of the client document to be returned. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getClientDocumentFileById: async ( documentId: string, options: RawAxiosRequestConfig = {}, ): Promise => { // verify required parameter 'documentId' is not null or undefined assertParamExists('getClientDocumentFileById', 'documentId', documentId); const localVarPath = `/clients/documents/{documentId}`.replace( `{${'documentId'}}`, encodeURIComponent(String(documentId)), ); // 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+file'; setSearchParams(localVarUrlObj, localVarQueryParameter); let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {}; localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers, }; return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * * @summary Get all client documents * @param {string} clientId The ID or encoded key of the client to be returned. * @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 {GetDocumentsByClientIdPaginationDetailsEnum} [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} */ getDocumentsByClientId: async ( clientId: string, offset?: number, limit?: number, paginationDetails?: GetDocumentsByClientIdPaginationDetailsEnum, options: RawAxiosRequestConfig = {}, ): Promise => { // verify required parameter 'clientId' is not null or undefined assertParamExists('getDocumentsByClientId', 'clientId', clientId); const localVarPath = `/clients/{clientId}/documentsMetadata`.replace( `{${'clientId'}}`, encodeURIComponent(String(clientId)), ); // 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; } 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, }; }, }; }; /** * ClientDocumentsApi - functional programming interface */ export const ClientDocumentsApiFp = function (configuration?: Configuration) { const localVarAxiosParamCreator = ClientDocumentsApiAxiosParamCreator(configuration); return { /** * * @summary Create client document * @param {string} clientId The ID or encoded key of the client to be returned. * @param {File} file The file to be attached for a client. * @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 {string} [name] The name (title) of the attached file. * @param {string} [notes] The description of the attached file. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async createDocument( clientId: string, file: File, idempotencyKey?: string, name?: string, notes?: string, options?: RawAxiosRequestConfig, ): Promise< (axios?: AxiosInstance, basePath?: string) => AxiosPromise > { const localVarAxiosArgs = await localVarAxiosParamCreator.createDocument( clientId, file, idempotencyKey, name, notes, options, ); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['ClientDocumentsApi.createDocument']?.[ localVarOperationServerIndex ]?.url; return (axios, basePath) => createRequestFunction( localVarAxiosArgs, globalAxios, BASE_PATH, configuration, )(axios, localVarOperationServerBasePath || basePath); }, /** * * @summary Get client document * @param {string} documentId The ID or encoded key of the client document to be returned. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getClientDocumentById( documentId: string, options?: RawAxiosRequestConfig, ): Promise< (axios?: AxiosInstance, basePath?: string) => AxiosPromise > { const localVarAxiosArgs = await localVarAxiosParamCreator.getClientDocumentById( documentId, options, ); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['ClientDocumentsApi.getClientDocumentById']?.[ localVarOperationServerIndex ]?.url; return (axios, basePath) => createRequestFunction( localVarAxiosArgs, globalAxios, BASE_PATH, configuration, )(axios, localVarOperationServerBasePath || basePath); }, /** * * @summary Download client document * @param {string} documentId The ID or encoded key of the client document to be returned. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getClientDocumentFileById( documentId: string, options?: RawAxiosRequestConfig, ): Promise< (axios?: AxiosInstance, basePath?: string) => AxiosPromise > { const localVarAxiosArgs = await localVarAxiosParamCreator.getClientDocumentFileById( documentId, options, ); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['ClientDocumentsApi.getClientDocumentFileById']?.[ localVarOperationServerIndex ]?.url; return (axios, basePath) => createRequestFunction( localVarAxiosArgs, globalAxios, BASE_PATH, configuration, )(axios, localVarOperationServerBasePath || basePath); }, /** * * @summary Get all client documents * @param {string} clientId The ID or encoded key of the client to be returned. * @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 {GetDocumentsByClientIdPaginationDetailsEnum} [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 getDocumentsByClientId( clientId: string, offset?: number, limit?: number, paginationDetails?: GetDocumentsByClientIdPaginationDetailsEnum, options?: RawAxiosRequestConfig, ): Promise< ( axios?: AxiosInstance, basePath?: string, ) => AxiosPromise> > { const localVarAxiosArgs = await localVarAxiosParamCreator.getDocumentsByClientId( clientId, offset, limit, paginationDetails, options, ); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['ClientDocumentsApi.getDocumentsByClientId']?.[ localVarOperationServerIndex ]?.url; return (axios, basePath) => createRequestFunction( localVarAxiosArgs, globalAxios, BASE_PATH, configuration, )(axios, localVarOperationServerBasePath || basePath); }, }; }; /** * ClientDocumentsApi - factory interface */ export const ClientDocumentsApiFactory = function ( configuration?: Configuration, basePath?: string, axios?: AxiosInstance, ) { const localVarFp = ClientDocumentsApiFp(configuration); return { /** * * @summary Create client document * @param {string} clientId The ID or encoded key of the client to be returned. * @param {File} file The file to be attached for a client. * @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 {string} [name] The name (title) of the attached file. * @param {string} [notes] The description of the attached file. * @param {*} [options] Override http request option. * @throws {RequiredError} */ createDocument( clientId: string, file: File, idempotencyKey?: string, name?: string, notes?: string, options?: RawAxiosRequestConfig, ): AxiosPromise { return localVarFp .createDocument(clientId, file, idempotencyKey, name, notes, options) .then((request) => request(axios, basePath)); }, /** * * @summary Get client document * @param {string} documentId The ID or encoded key of the client document to be returned. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getClientDocumentById( documentId: string, options?: RawAxiosRequestConfig, ): AxiosPromise { return localVarFp .getClientDocumentById(documentId, options) .then((request) => request(axios, basePath)); }, /** * * @summary Download client document * @param {string} documentId The ID or encoded key of the client document to be returned. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getClientDocumentFileById( documentId: string, options?: RawAxiosRequestConfig, ): AxiosPromise { return localVarFp .getClientDocumentFileById(documentId, options) .then((request) => request(axios, basePath)); }, /** * * @summary Get all client documents * @param {string} clientId The ID or encoded key of the client to be returned. * @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 {GetDocumentsByClientIdPaginationDetailsEnum} [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} */ getDocumentsByClientId( clientId: string, offset?: number, limit?: number, paginationDetails?: GetDocumentsByClientIdPaginationDetailsEnum, options?: RawAxiosRequestConfig, ): AxiosPromise> { return localVarFp .getDocumentsByClientId( clientId, offset, limit, paginationDetails, options, ) .then((request) => request(axios, basePath)); }, }; }; /** * ClientDocumentsApi - object-oriented interface */ export class ClientDocumentsApi extends BaseAPI { /** * * @summary Create client document * @param {string} clientId The ID or encoded key of the client to be returned. * @param {File} file The file to be attached for a client. * @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 {string} [name] The name (title) of the attached file. * @param {string} [notes] The description of the attached file. * @param {*} [options] Override http request option. * @throws {RequiredError} */ public createDocument( clientId: string, file: File, idempotencyKey?: string, name?: string, notes?: string, options?: RawAxiosRequestConfig, ) { return ClientDocumentsApiFp(this.configuration) .createDocument(clientId, file, idempotencyKey, name, notes, options) .then((request) => request(this.axios, this.basePath)); } /** * * @summary Get client document * @param {string} documentId The ID or encoded key of the client document to be returned. * @param {*} [options] Override http request option. * @throws {RequiredError} */ public getClientDocumentById( documentId: string, options?: RawAxiosRequestConfig, ) { return ClientDocumentsApiFp(this.configuration) .getClientDocumentById(documentId, options) .then((request) => request(this.axios, this.basePath)); } /** * * @summary Download client document * @param {string} documentId The ID or encoded key of the client document to be returned. * @param {*} [options] Override http request option. * @throws {RequiredError} */ public getClientDocumentFileById( documentId: string, options?: RawAxiosRequestConfig, ) { return ClientDocumentsApiFp(this.configuration) .getClientDocumentFileById(documentId, options) .then((request) => request(this.axios, this.basePath)); } /** * * @summary Get all client documents * @param {string} clientId The ID or encoded key of the client to be returned. * @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 {GetDocumentsByClientIdPaginationDetailsEnum} [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 getDocumentsByClientId( clientId: string, offset?: number, limit?: number, paginationDetails?: GetDocumentsByClientIdPaginationDetailsEnum, options?: RawAxiosRequestConfig, ) { return ClientDocumentsApiFp(this.configuration) .getDocumentsByClientId( clientId, offset, limit, paginationDetails, options, ) .then((request) => request(this.axios, this.basePath)); } } export const GetDocumentsByClientIdPaginationDetailsEnum = { On: 'ON', Off: 'OFF', } as const; export type GetDocumentsByClientIdPaginationDetailsEnum = (typeof GetDocumentsByClientIdPaginationDetailsEnum)[keyof typeof GetDocumentsByClientIdPaginationDetailsEnum];