/* tslint:disable */ /* eslint-disable */ /** * branches * 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 { Branch } from '../models'; // @ts-ignore import type { ErrorResponse } from '../models'; /** * BranchesApi - axios parameter creator */ export const BranchesApiAxiosParamCreator = function ( configuration?: Configuration, ) { return { /** * * @summary Create branch * @param {Branch} branch Branch to be created. * @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 ( branch: Branch, idempotencyKey?: string, options: RawAxiosRequestConfig = {}, ): Promise => { // verify required parameter 'branch' is not null or undefined assertParamExists('create', 'branch', branch); const localVarPath = `/branches`; // 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( branch, localVarRequestOptions, configuration, ); return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * * @summary Get branches * @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 {GetAllDetailsLevelEnum} [detailsLevel] The level of details to return: `FULL` means the full details of the object will be returned (custom field values, address, contact info, or any other related objects) and `BASIC` will return only the first level elements of the object. * @param {string} [sortBy] The criteria based on which the records will be sorted. Expected format is <field:order>, for example, sortBy = field1:ASC,field2:DESC.<br/>Only the following fields can be used: id,name, creationDate, lastModifiedDate<br/>Default sorting is done by creationDate:DESC * @param {*} [options] Override http request option. * @throws {RequiredError} */ getAll: async ( offset?: number, limit?: number, paginationDetails?: GetAllPaginationDetailsEnum, detailsLevel?: GetAllDetailsLevelEnum, sortBy?: string, options: RawAxiosRequestConfig = {}, ): Promise => { const localVarPath = `/branches`; // 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 (detailsLevel !== undefined) { localVarQueryParameter['detailsLevel'] = detailsLevel; } if (sortBy !== undefined) { localVarQueryParameter['sortBy'] = sortBy; } 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 branch * @param {string} branchId The ID or or encoded key of a branch. * @param {GetByIdDetailsLevelEnum} [detailsLevel] The level of details to return: `FULL` means the full details of the object will be returned (custom field values, address, contact info, or any other related objects) and `BASIC` will return only the first level elements of the object. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getById: async ( branchId: string, detailsLevel?: GetByIdDetailsLevelEnum, options: RawAxiosRequestConfig = {}, ): Promise => { // verify required parameter 'branchId' is not null or undefined assertParamExists('getById', 'branchId', branchId); const localVarPath = `/branches/{branchId}`.replace( `{${'branchId'}}`, encodeURIComponent(String(branchId)), ); // 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 (detailsLevel !== undefined) { localVarQueryParameter['detailsLevel'] = detailsLevel; } 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, }; }, }; }; /** * BranchesApi - functional programming interface */ export const BranchesApiFp = function (configuration?: Configuration) { const localVarAxiosParamCreator = BranchesApiAxiosParamCreator(configuration); return { /** * * @summary Create branch * @param {Branch} branch Branch to be created. * @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( branch: Branch, idempotencyKey?: string, options?: RawAxiosRequestConfig, ): Promise< (axios?: AxiosInstance, basePath?: string) => AxiosPromise > { const localVarAxiosArgs = await localVarAxiosParamCreator.create( branch, idempotencyKey, options, ); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['BranchesApi.create']?.[localVarOperationServerIndex] ?.url; return (axios, basePath) => createRequestFunction( localVarAxiosArgs, globalAxios, BASE_PATH, configuration, )(axios, localVarOperationServerBasePath || basePath); }, /** * * @summary Get branches * @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 {GetAllDetailsLevelEnum} [detailsLevel] The level of details to return: `FULL` means the full details of the object will be returned (custom field values, address, contact info, or any other related objects) and `BASIC` will return only the first level elements of the object. * @param {string} [sortBy] The criteria based on which the records will be sorted. Expected format is <field:order>, for example, sortBy = field1:ASC,field2:DESC.<br/>Only the following fields can be used: id,name, creationDate, lastModifiedDate<br/>Default sorting is done by creationDate:DESC * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getAll( offset?: number, limit?: number, paginationDetails?: GetAllPaginationDetailsEnum, detailsLevel?: GetAllDetailsLevelEnum, sortBy?: string, options?: RawAxiosRequestConfig, ): Promise< (axios?: AxiosInstance, basePath?: string) => AxiosPromise> > { const localVarAxiosArgs = await localVarAxiosParamCreator.getAll( offset, limit, paginationDetails, detailsLevel, sortBy, options, ); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['BranchesApi.getAll']?.[localVarOperationServerIndex] ?.url; return (axios, basePath) => createRequestFunction( localVarAxiosArgs, globalAxios, BASE_PATH, configuration, )(axios, localVarOperationServerBasePath || basePath); }, /** * * @summary Get branch * @param {string} branchId The ID or or encoded key of a branch. * @param {GetByIdDetailsLevelEnum} [detailsLevel] The level of details to return: `FULL` means the full details of the object will be returned (custom field values, address, contact info, or any other related objects) and `BASIC` will return only the first level elements of the object. * @param {*} [options] Override http request option. * @throws {RequiredError} */ async getById( branchId: string, detailsLevel?: GetByIdDetailsLevelEnum, options?: RawAxiosRequestConfig, ): Promise< (axios?: AxiosInstance, basePath?: string) => AxiosPromise > { const localVarAxiosArgs = await localVarAxiosParamCreator.getById( branchId, detailsLevel, options, ); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['BranchesApi.getById']?.[ localVarOperationServerIndex ]?.url; return (axios, basePath) => createRequestFunction( localVarAxiosArgs, globalAxios, BASE_PATH, configuration, )(axios, localVarOperationServerBasePath || basePath); }, }; }; /** * BranchesApi - factory interface */ export const BranchesApiFactory = function ( configuration?: Configuration, basePath?: string, axios?: AxiosInstance, ) { const localVarFp = BranchesApiFp(configuration); return { /** * * @summary Create branch * @param {Branch} branch Branch to be created. * @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( branch: Branch, idempotencyKey?: string, options?: RawAxiosRequestConfig, ): AxiosPromise { return localVarFp .create(branch, idempotencyKey, options) .then((request) => request(axios, basePath)); }, /** * * @summary Get branches * @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 {GetAllDetailsLevelEnum} [detailsLevel] The level of details to return: `FULL` means the full details of the object will be returned (custom field values, address, contact info, or any other related objects) and `BASIC` will return only the first level elements of the object. * @param {string} [sortBy] The criteria based on which the records will be sorted. Expected format is <field:order>, for example, sortBy = field1:ASC,field2:DESC.<br/>Only the following fields can be used: id,name, creationDate, lastModifiedDate<br/>Default sorting is done by creationDate:DESC * @param {*} [options] Override http request option. * @throws {RequiredError} */ getAll( offset?: number, limit?: number, paginationDetails?: GetAllPaginationDetailsEnum, detailsLevel?: GetAllDetailsLevelEnum, sortBy?: string, options?: RawAxiosRequestConfig, ): AxiosPromise> { return localVarFp .getAll(offset, limit, paginationDetails, detailsLevel, sortBy, options) .then((request) => request(axios, basePath)); }, /** * * @summary Get branch * @param {string} branchId The ID or or encoded key of a branch. * @param {GetByIdDetailsLevelEnum} [detailsLevel] The level of details to return: `FULL` means the full details of the object will be returned (custom field values, address, contact info, or any other related objects) and `BASIC` will return only the first level elements of the object. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getById( branchId: string, detailsLevel?: GetByIdDetailsLevelEnum, options?: RawAxiosRequestConfig, ): AxiosPromise { return localVarFp .getById(branchId, detailsLevel, options) .then((request) => request(axios, basePath)); }, }; }; /** * BranchesApi - object-oriented interface */ export class BranchesApi extends BaseAPI { /** * * @summary Create branch * @param {Branch} branch Branch to be created. * @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( branch: Branch, idempotencyKey?: string, options?: RawAxiosRequestConfig, ) { return BranchesApiFp(this.configuration) .create(branch, idempotencyKey, options) .then((request) => request(this.axios, this.basePath)); } /** * * @summary Get branches * @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 {GetAllDetailsLevelEnum} [detailsLevel] The level of details to return: `FULL` means the full details of the object will be returned (custom field values, address, contact info, or any other related objects) and `BASIC` will return only the first level elements of the object. * @param {string} [sortBy] The criteria based on which the records will be sorted. Expected format is <field:order>, for example, sortBy = field1:ASC,field2:DESC.<br/>Only the following fields can be used: id,name, creationDate, lastModifiedDate<br/>Default sorting is done by creationDate:DESC * @param {*} [options] Override http request option. * @throws {RequiredError} */ public getAll( offset?: number, limit?: number, paginationDetails?: GetAllPaginationDetailsEnum, detailsLevel?: GetAllDetailsLevelEnum, sortBy?: string, options?: RawAxiosRequestConfig, ) { return BranchesApiFp(this.configuration) .getAll(offset, limit, paginationDetails, detailsLevel, sortBy, options) .then((request) => request(this.axios, this.basePath)); } /** * * @summary Get branch * @param {string} branchId The ID or or encoded key of a branch. * @param {GetByIdDetailsLevelEnum} [detailsLevel] The level of details to return: `FULL` means the full details of the object will be returned (custom field values, address, contact info, or any other related objects) and `BASIC` will return only the first level elements of the object. * @param {*} [options] Override http request option. * @throws {RequiredError} */ public getById( branchId: string, detailsLevel?: GetByIdDetailsLevelEnum, options?: RawAxiosRequestConfig, ) { return BranchesApiFp(this.configuration) .getById(branchId, detailsLevel, 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 GetAllDetailsLevelEnum = { Basic: 'BASIC', Full: 'FULL', } as const; export type GetAllDetailsLevelEnum = (typeof GetAllDetailsLevelEnum)[keyof typeof GetAllDetailsLevelEnum]; export const GetByIdDetailsLevelEnum = { Basic: 'BASIC', Full: 'FULL', } as const; export type GetByIdDetailsLevelEnum = (typeof GetByIdDetailsLevelEnum)[keyof typeof GetByIdDetailsLevelEnum];