/* tslint:disable */ /* eslint-disable */ /** * fundingsources * 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 { DepositTransaction } from '../models'; // @ts-ignore import type { ErrorResponse } from '../models'; // @ts-ignore import type { SellFundingSourceAction } from '../models'; /** * FundingSourcesApi - axios parameter creator */ export const FundingSourcesApiAxiosParamCreator = function ( configuration?: Configuration, ) { return { /** * * @summary Performs the sell of a funding share owned by an investor. Investors can sell the total share or only a part of the investment. In case of a partial sale, multiple operations can be performed until the entire investment is sold. For the seller, money will be deposited in the funding account, for the buyers money will be withdrawn from provided accounts. * @param {string} fundingSourceId Id/Encoded key of the funding source * @param {SellFundingSourceAction} sellFundingSourceAction List of purchases containing details about buyer, price, amount * @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} */ sell: async ( fundingSourceId: string, sellFundingSourceAction: SellFundingSourceAction, idempotencyKey?: string, options: RawAxiosRequestConfig = {}, ): Promise => { // verify required parameter 'fundingSourceId' is not null or undefined assertParamExists('sell', 'fundingSourceId', fundingSourceId); // verify required parameter 'sellFundingSourceAction' is not null or undefined assertParamExists( 'sell', 'sellFundingSourceAction', sellFundingSourceAction, ); const localVarPath = `/fundingsources/{fundingSourceId}:sell`.replace( `{${'fundingSourceId'}}`, encodeURIComponent(String(fundingSourceId)), ); // 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( sellFundingSourceAction, localVarRequestOptions, configuration, ); return { url: toPathString(localVarUrlObj), options: localVarRequestOptions, }; }, }; }; /** * FundingSourcesApi - functional programming interface */ export const FundingSourcesApiFp = function (configuration?: Configuration) { const localVarAxiosParamCreator = FundingSourcesApiAxiosParamCreator(configuration); return { /** * * @summary Performs the sell of a funding share owned by an investor. Investors can sell the total share or only a part of the investment. In case of a partial sale, multiple operations can be performed until the entire investment is sold. For the seller, money will be deposited in the funding account, for the buyers money will be withdrawn from provided accounts. * @param {string} fundingSourceId Id/Encoded key of the funding source * @param {SellFundingSourceAction} sellFundingSourceAction List of purchases containing details about buyer, price, amount * @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 sell( fundingSourceId: string, sellFundingSourceAction: SellFundingSourceAction, idempotencyKey?: string, options?: RawAxiosRequestConfig, ): Promise< ( axios?: AxiosInstance, basePath?: string, ) => AxiosPromise> > { const localVarAxiosArgs = await localVarAxiosParamCreator.sell( fundingSourceId, sellFundingSourceAction, idempotencyKey, options, ); const localVarOperationServerIndex = configuration?.serverIndex ?? 0; const localVarOperationServerBasePath = operationServerMap['FundingSourcesApi.sell']?.[ localVarOperationServerIndex ]?.url; return (axios, basePath) => createRequestFunction( localVarAxiosArgs, globalAxios, BASE_PATH, configuration, )(axios, localVarOperationServerBasePath || basePath); }, }; }; /** * FundingSourcesApi - factory interface */ export const FundingSourcesApiFactory = function ( configuration?: Configuration, basePath?: string, axios?: AxiosInstance, ) { const localVarFp = FundingSourcesApiFp(configuration); return { /** * * @summary Performs the sell of a funding share owned by an investor. Investors can sell the total share or only a part of the investment. In case of a partial sale, multiple operations can be performed until the entire investment is sold. For the seller, money will be deposited in the funding account, for the buyers money will be withdrawn from provided accounts. * @param {string} fundingSourceId Id/Encoded key of the funding source * @param {SellFundingSourceAction} sellFundingSourceAction List of purchases containing details about buyer, price, amount * @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} */ sell( fundingSourceId: string, sellFundingSourceAction: SellFundingSourceAction, idempotencyKey?: string, options?: RawAxiosRequestConfig, ): AxiosPromise> { return localVarFp .sell(fundingSourceId, sellFundingSourceAction, idempotencyKey, options) .then((request) => request(axios, basePath)); }, }; }; /** * FundingSourcesApi - object-oriented interface */ export class FundingSourcesApi extends BaseAPI { /** * * @summary Performs the sell of a funding share owned by an investor. Investors can sell the total share or only a part of the investment. In case of a partial sale, multiple operations can be performed until the entire investment is sold. For the seller, money will be deposited in the funding account, for the buyers money will be withdrawn from provided accounts. * @param {string} fundingSourceId Id/Encoded key of the funding source * @param {SellFundingSourceAction} sellFundingSourceAction List of purchases containing details about buyer, price, amount * @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 sell( fundingSourceId: string, sellFundingSourceAction: SellFundingSourceAction, idempotencyKey?: string, options?: RawAxiosRequestConfig, ) { return FundingSourcesApiFp(this.configuration) .sell(fundingSourceId, sellFundingSourceAction, idempotencyKey, options) .then((request) => request(this.axios, this.basePath)); } }