/* tslint:disable */ /* eslint-disable */ /** * deposits/transactions * 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 { DepositTransactionInput } from '../models'; // @ts-ignore import type { ErrorResponse } from '../models'; // @ts-ignore import type { WithdrawalDepositTransactionInput } from '../models'; /** * DepositTransactionAsyncApi - axios parameter creator */ export const DepositTransactionAsyncApiAxiosParamCreator = function ( configuration?: Configuration, ) { return { /** * * @summary Create deposit transaction * @param {string} depositAccountId The ID or encoded key of the deposit that the transaction will be created for. * @param {DepositTransactionInput} depositTransactionInput Represents the information needed to create a deposit transaction. * @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} */ makeDepositAsync: async ( depositAccountId: string, depositTransactionInput: DepositTransactionInput, idempotencyKey?: string, options: RawAxiosRequestConfig = {}, ): Promise => { // verify required parameter 'depositAccountId' is not null or undefined assertParamExists( 'makeDepositAsync', 'depositAccountId', depositAccountId, ); // verify required parameter 'depositTransactionInput' is not null or undefined assertParamExists( 'makeDepositAsync', 'depositTransactionInput', depositTransactionInput, ); const localVarPath = `/deposits/{depositAccountId}/transactions/deposits`.replace( `{${'depositAccountId'}}`, encodeURIComponent(String(depositAccountId)), ); // 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( depositTransactionInput, localVarRequestOptions, configuration, ); return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, /** * * @summary Create withdrawal transaction * @param {string} depositAccountId The ID or encoded key of the deposit that the transaction will be created for. * @param {WithdrawalDepositTransactionInput} withdrawalDepositTransactionInput Represents the information for a withdrawal transaction. * @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} */ makeWithdrawalAsync: async ( depositAccountId: string, withdrawalDepositTransactionInput: WithdrawalDepositTransactionInput, idempotencyKey?: string, options: RawAxiosRequestConfig = {}, ): Promise => { // verify required parameter 'depositAccountId' is not null or undefined assertParamExists( 'makeWithdrawalAsync', 'depositAccountId', depositAccountId, ); // verify required parameter 'withdrawalDepositTransactionInput' is not null or undefined assertParamExists( 'makeWithdrawalAsync', 'withdrawalDepositTransactionInput', withdrawalDepositTransactionInput, ); const localVarPath = `/deposits/{depositAccountId}/transactions/withdrawals`.replace( `{${'depositAccountId'}}`, encodeURIComponent(String(depositAccountId)), ); // 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( withdrawalDepositTransactionInput, localVarRequestOptions, configuration, ); return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, }; }; /** * DepositTransactionAsyncApi - functional programming interface */ export const DepositTransactionAsyncApiFp = function ( configuration?: Configuration, ) { const localVarAxiosParamCreator = DepositTransactionAsyncApiAxiosParamCreator(configuration); return { /** * * @summary Create deposit transaction * @param {string} depositAccountId The ID or encoded key of the deposit that the transaction will be created for. * @param {DepositTransactionInput} depositTransactionInput Represents the information needed to create a deposit transaction. * @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 makeDepositAsync( depositAccountId: string, depositTransactionInput: DepositTransactionInput, idempotencyKey?: string, options?: RawAxiosRequestConfig, ): Promise< (axios?: AxiosInstance, basePath?: string) => AxiosPromise > { const localVarAxiosArgs = await localVarAxiosParamCreator.makeDepositAsync( depositAccountId, depositTransactionInput, idempotencyKey, options, ); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['DepositTransactionAsyncApi.makeDepositAsync']?.[ localVarOperationServerIndex ]?.url; return (axios, basePath) => createRequestFunction( localVarAxiosArgs, globalAxios, BASE_PATH, configuration, )(axios, localVarOperationServerBasePath || basePath); }, /** * * @summary Create withdrawal transaction * @param {string} depositAccountId The ID or encoded key of the deposit that the transaction will be created for. * @param {WithdrawalDepositTransactionInput} withdrawalDepositTransactionInput Represents the information for a withdrawal transaction. * @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 makeWithdrawalAsync( depositAccountId: string, withdrawalDepositTransactionInput: WithdrawalDepositTransactionInput, idempotencyKey?: string, options?: RawAxiosRequestConfig, ): Promise< (axios?: AxiosInstance, basePath?: string) => AxiosPromise > { const localVarAxiosArgs = await localVarAxiosParamCreator.makeWithdrawalAsync( depositAccountId, withdrawalDepositTransactionInput, idempotencyKey, options, ); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['DepositTransactionAsyncApi.makeWithdrawalAsync']?.[ localVarOperationServerIndex ]?.url; return (axios, basePath) => createRequestFunction( localVarAxiosArgs, globalAxios, BASE_PATH, configuration, )(axios, localVarOperationServerBasePath || basePath); }, }; }; /** * DepositTransactionAsyncApi - factory interface */ export const DepositTransactionAsyncApiFactory = function ( configuration?: Configuration, basePath?: string, axios?: AxiosInstance, ) { const localVarFp = DepositTransactionAsyncApiFp(configuration); return { /** * * @summary Create deposit transaction * @param {string} depositAccountId The ID or encoded key of the deposit that the transaction will be created for. * @param {DepositTransactionInput} depositTransactionInput Represents the information needed to create a deposit transaction. * @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} */ makeDepositAsync( depositAccountId: string, depositTransactionInput: DepositTransactionInput, idempotencyKey?: string, options?: RawAxiosRequestConfig, ): AxiosPromise { return localVarFp .makeDepositAsync( depositAccountId, depositTransactionInput, idempotencyKey, options, ) .then((request) => request(axios, basePath)); }, /** * * @summary Create withdrawal transaction * @param {string} depositAccountId The ID or encoded key of the deposit that the transaction will be created for. * @param {WithdrawalDepositTransactionInput} withdrawalDepositTransactionInput Represents the information for a withdrawal transaction. * @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} */ makeWithdrawalAsync( depositAccountId: string, withdrawalDepositTransactionInput: WithdrawalDepositTransactionInput, idempotencyKey?: string, options?: RawAxiosRequestConfig, ): AxiosPromise { return localVarFp .makeWithdrawalAsync( depositAccountId, withdrawalDepositTransactionInput, idempotencyKey, options, ) .then((request) => request(axios, basePath)); }, }; }; /** * DepositTransactionAsyncApi - object-oriented interface */ export class DepositTransactionAsyncApi extends BaseAPI { /** * * @summary Create deposit transaction * @param {string} depositAccountId The ID or encoded key of the deposit that the transaction will be created for. * @param {DepositTransactionInput} depositTransactionInput Represents the information needed to create a deposit transaction. * @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 makeDepositAsync( depositAccountId: string, depositTransactionInput: DepositTransactionInput, idempotencyKey?: string, options?: RawAxiosRequestConfig, ) { return DepositTransactionAsyncApiFp(this.configuration) .makeDepositAsync( depositAccountId, depositTransactionInput, idempotencyKey, options, ) .then((request) => request(this.axios, this.basePath)); } /** * * @summary Create withdrawal transaction * @param {string} depositAccountId The ID or encoded key of the deposit that the transaction will be created for. * @param {WithdrawalDepositTransactionInput} withdrawalDepositTransactionInput Represents the information for a withdrawal transaction. * @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 makeWithdrawalAsync( depositAccountId: string, withdrawalDepositTransactionInput: WithdrawalDepositTransactionInput, idempotencyKey?: string, options?: RawAxiosRequestConfig, ) { return DepositTransactionAsyncApiFp(this.configuration) .makeWithdrawalAsync( depositAccountId, withdrawalDepositTransactionInput, idempotencyKey, options, ) .then((request) => request(this.axios, this.basePath)); } }