UNPKG

@investingwolf/alpaca-broker-api

Version:
781 lines (780 loc) 39.1 kB
"use strict"; /** * Alpaca Broker API * Open brokerage accounts, enable commission-free trading, and manage the ongoing user experience with Alpaca Broker API * * The version of the OpenAPI document: 1.0.0 * * * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). * https://openapi-generator.tech * Do not edit the class manually. */ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.FundingApi = exports.FundingApiApiKeys = void 0; const request_1 = __importDefault(require("request")); const models_1 = require("../model/models"); const models_2 = require("../model/models"); const apis_1 = require("./apis"); let defaultBasePath = 'https://broker-api.sandbox.alpaca.markets/v1'; // =============================================== // This file is autogenerated - Please do not edit // =============================================== var FundingApiApiKeys; (function (FundingApiApiKeys) { })(FundingApiApiKeys = exports.FundingApiApiKeys || (exports.FundingApiApiKeys = {})); class FundingApi { constructor(basePathOrUsername, password, basePath) { this._basePath = defaultBasePath; this._defaultHeaders = {}; this._useQuerystring = false; this.authentications = { 'default': new models_1.VoidAuth(), 'BasicAuth': new models_2.HttpBasicAuth(), }; this.interceptors = []; if (password) { this.username = basePathOrUsername; this.password = password; if (basePath) { this.basePath = basePath; } } else { if (basePathOrUsername) { this.basePath = basePathOrUsername; } } } set useQuerystring(value) { this._useQuerystring = value; } set basePath(basePath) { this._basePath = basePath; } set defaultHeaders(defaultHeaders) { this._defaultHeaders = defaultHeaders; } get defaultHeaders() { return this._defaultHeaders; } get basePath() { return this._basePath; } setDefaultAuthentication(auth) { this.authentications.default = auth; } setApiKey(key, value) { this.authentications[FundingApiApiKeys[key]].apiKey = value; } set username(username) { this.authentications.BasicAuth.username = username; } set password(password) { this.authentications.BasicAuth.password = password; } addInterceptor(interceptor) { this.interceptors.push(interceptor); } /** * * @summary Delete an existing ACH relationship * @param accountId Account identifier. * @param achRelationshipId ACH relationship identifier */ deleteAchRelationship(accountId, achRelationshipId, options = { headers: {} }) { return __awaiter(this, void 0, void 0, function* () { const localVarPath = this.basePath + '/accounts/{account_id}/ach_relationships/{ach_relationship_id}' .replace('{' + 'account_id' + '}', encodeURIComponent(String(accountId))) .replace('{' + 'ach_relationship_id' + '}', encodeURIComponent(String(achRelationshipId))); let localVarQueryParameters = {}; let localVarHeaderParams = Object.assign({}, this._defaultHeaders); const produces = ['application/json']; // give precedence to 'application/json' if (produces.indexOf('application/json') >= 0) { localVarHeaderParams.Accept = 'application/json'; } else { localVarHeaderParams.Accept = produces.join(','); } let localVarFormParams = {}; // verify required parameter 'accountId' is not null or undefined if (accountId === null || accountId === undefined) { throw new Error('Required parameter accountId was null or undefined when calling deleteAchRelationship.'); } // verify required parameter 'achRelationshipId' is not null or undefined if (achRelationshipId === null || achRelationshipId === undefined) { throw new Error('Required parameter achRelationshipId was null or undefined when calling deleteAchRelationship.'); } Object.assign(localVarHeaderParams, options.headers); let localVarUseFormData = false; let localVarRequestOptions = { method: 'DELETE', qs: localVarQueryParameters, headers: localVarHeaderParams, uri: localVarPath, useQuerystring: this._useQuerystring, json: true, }; let authenticationPromise = Promise.resolve(); if (this.authentications.BasicAuth.username && this.authentications.BasicAuth.password) { authenticationPromise = authenticationPromise.then(() => this.authentications.BasicAuth.applyToRequest(localVarRequestOptions)); } authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); let interceptorPromise = authenticationPromise; for (const interceptor of this.interceptors) { interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); } return interceptorPromise.then(() => { if (Object.keys(localVarFormParams).length) { if (localVarUseFormData) { localVarRequestOptions.formData = localVarFormParams; } else { localVarRequestOptions.form = localVarFormParams; } } return new Promise((resolve, reject) => { request_1.default(localVarRequestOptions, (error, response, body) => { if (error) { reject(error); } else { if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { resolve({ response: response, body: body }); } else { reject(new apis_1.HttpError(response, body, response.statusCode)); } } }); }); }); }); } /** * * @summary Delete a Bank Relationship for an account * @param accountId Account identifier. * @param bankId */ deleteRecipientBank(accountId, bankId, options = { headers: {} }) { return __awaiter(this, void 0, void 0, function* () { const localVarPath = this.basePath + '/accounts/{account_id}/recipient_banks/{bank_id}' .replace('{' + 'account_id' + '}', encodeURIComponent(String(accountId))) .replace('{' + 'bank_id' + '}', encodeURIComponent(String(bankId))); let localVarQueryParameters = {}; let localVarHeaderParams = Object.assign({}, this._defaultHeaders); let localVarFormParams = {}; // verify required parameter 'accountId' is not null or undefined if (accountId === null || accountId === undefined) { throw new Error('Required parameter accountId was null or undefined when calling deleteRecipientBank.'); } // verify required parameter 'bankId' is not null or undefined if (bankId === null || bankId === undefined) { throw new Error('Required parameter bankId was null or undefined when calling deleteRecipientBank.'); } Object.assign(localVarHeaderParams, options.headers); let localVarUseFormData = false; let localVarRequestOptions = { method: 'DELETE', qs: localVarQueryParameters, headers: localVarHeaderParams, uri: localVarPath, useQuerystring: this._useQuerystring, json: true, }; let authenticationPromise = Promise.resolve(); if (this.authentications.BasicAuth.username && this.authentications.BasicAuth.password) { authenticationPromise = authenticationPromise.then(() => this.authentications.BasicAuth.applyToRequest(localVarRequestOptions)); } authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); let interceptorPromise = authenticationPromise; for (const interceptor of this.interceptors) { interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); } return interceptorPromise.then(() => { if (Object.keys(localVarFormParams).length) { if (localVarUseFormData) { localVarRequestOptions.formData = localVarFormParams; } else { localVarRequestOptions.form = localVarFormParams; } } return new Promise((resolve, reject) => { request_1.default(localVarRequestOptions, (error, response, body) => { if (error) { reject(error); } else { if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { resolve({ response: response, body: body }); } else { reject(new apis_1.HttpError(response, body, response.statusCode)); } } }); }); }); }); } /** * * @summary Request to close a transfer * @param accountId * @param transferId */ deleteTransfer(accountId, transferId, options = { headers: {} }) { return __awaiter(this, void 0, void 0, function* () { const localVarPath = this.basePath + '/accounts/{account_id}/transfers/{transfer_id}' .replace('{' + 'account_id' + '}', encodeURIComponent(String(accountId))) .replace('{' + 'transfer_id' + '}', encodeURIComponent(String(transferId))); let localVarQueryParameters = {}; let localVarHeaderParams = Object.assign({}, this._defaultHeaders); const produces = ['application/json']; // give precedence to 'application/json' if (produces.indexOf('application/json') >= 0) { localVarHeaderParams.Accept = 'application/json'; } else { localVarHeaderParams.Accept = produces.join(','); } let localVarFormParams = {}; // verify required parameter 'accountId' is not null or undefined if (accountId === null || accountId === undefined) { throw new Error('Required parameter accountId was null or undefined when calling deleteTransfer.'); } // verify required parameter 'transferId' is not null or undefined if (transferId === null || transferId === undefined) { throw new Error('Required parameter transferId was null or undefined when calling deleteTransfer.'); } Object.assign(localVarHeaderParams, options.headers); let localVarUseFormData = false; let localVarRequestOptions = { method: 'DELETE', qs: localVarQueryParameters, headers: localVarHeaderParams, uri: localVarPath, useQuerystring: this._useQuerystring, json: true, }; let authenticationPromise = Promise.resolve(); if (this.authentications.BasicAuth.username && this.authentications.BasicAuth.password) { authenticationPromise = authenticationPromise.then(() => this.authentications.BasicAuth.applyToRequest(localVarRequestOptions)); } authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); let interceptorPromise = authenticationPromise; for (const interceptor of this.interceptors) { interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); } return interceptorPromise.then(() => { if (Object.keys(localVarFormParams).length) { if (localVarUseFormData) { localVarRequestOptions.formData = localVarFormParams; } else { localVarRequestOptions.form = localVarFormParams; } } return new Promise((resolve, reject) => { request_1.default(localVarRequestOptions, (error, response, body) => { if (error) { reject(error); } else { if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { resolve({ response: response, body: body }); } else { reject(new apis_1.HttpError(response, body, response.statusCode)); } } }); }); }); }); } /** * * @summary Retrieve ACH Relationships for an account * @param accountId Account identifier. * @param statuses Comma-separated status values */ getAchRelationships(accountId, statuses, options = { headers: {} }) { return __awaiter(this, void 0, void 0, function* () { const localVarPath = this.basePath + '/accounts/{account_id}/ach_relationships' .replace('{' + 'account_id' + '}', encodeURIComponent(String(accountId))); let localVarQueryParameters = {}; let localVarHeaderParams = Object.assign({}, this._defaultHeaders); const produces = ['application/json']; // give precedence to 'application/json' if (produces.indexOf('application/json') >= 0) { localVarHeaderParams.Accept = 'application/json'; } else { localVarHeaderParams.Accept = produces.join(','); } let localVarFormParams = {}; // verify required parameter 'accountId' is not null or undefined if (accountId === null || accountId === undefined) { throw new Error('Required parameter accountId was null or undefined when calling getAchRelationships.'); } if (statuses !== undefined) { localVarQueryParameters['statuses'] = models_1.ObjectSerializer.serialize(statuses, "string"); } Object.assign(localVarHeaderParams, options.headers); let localVarUseFormData = false; let localVarRequestOptions = { method: 'GET', qs: localVarQueryParameters, headers: localVarHeaderParams, uri: localVarPath, useQuerystring: this._useQuerystring, json: true, }; let authenticationPromise = Promise.resolve(); if (this.authentications.BasicAuth.username && this.authentications.BasicAuth.password) { authenticationPromise = authenticationPromise.then(() => this.authentications.BasicAuth.applyToRequest(localVarRequestOptions)); } authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); let interceptorPromise = authenticationPromise; for (const interceptor of this.interceptors) { interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); } return interceptorPromise.then(() => { if (Object.keys(localVarFormParams).length) { if (localVarUseFormData) { localVarRequestOptions.formData = localVarFormParams; } else { localVarRequestOptions.form = localVarFormParams; } } return new Promise((resolve, reject) => { request_1.default(localVarRequestOptions, (error, response, body) => { if (error) { reject(error); } else { body = models_1.ObjectSerializer.deserialize(body, "Array<ACHRelationshipResource>"); if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { resolve({ response: response, body: body }); } else { reject(new apis_1.HttpError(response, body, response.statusCode)); } } }); }); }); }); } /** * * @summary Retrieve bank relationships for an account * @param accountId * @param status * @param bankName */ getRecipientBanks(accountId, status, bankName, options = { headers: {} }) { return __awaiter(this, void 0, void 0, function* () { const localVarPath = this.basePath + '/accounts/{account_id}/recipient_banks' .replace('{' + 'account_id' + '}', encodeURIComponent(String(accountId))); let localVarQueryParameters = {}; let localVarHeaderParams = Object.assign({}, this._defaultHeaders); const produces = ['application/json']; // give precedence to 'application/json' if (produces.indexOf('application/json') >= 0) { localVarHeaderParams.Accept = 'application/json'; } else { localVarHeaderParams.Accept = produces.join(','); } let localVarFormParams = {}; // verify required parameter 'accountId' is not null or undefined if (accountId === null || accountId === undefined) { throw new Error('Required parameter accountId was null or undefined when calling getRecipientBanks.'); } if (status !== undefined) { localVarQueryParameters['status'] = models_1.ObjectSerializer.serialize(status, "string"); } if (bankName !== undefined) { localVarQueryParameters['bank_name'] = models_1.ObjectSerializer.serialize(bankName, "string"); } Object.assign(localVarHeaderParams, options.headers); let localVarUseFormData = false; let localVarRequestOptions = { method: 'GET', qs: localVarQueryParameters, headers: localVarHeaderParams, uri: localVarPath, useQuerystring: this._useQuerystring, json: true, }; let authenticationPromise = Promise.resolve(); if (this.authentications.BasicAuth.username && this.authentications.BasicAuth.password) { authenticationPromise = authenticationPromise.then(() => this.authentications.BasicAuth.applyToRequest(localVarRequestOptions)); } authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); let interceptorPromise = authenticationPromise; for (const interceptor of this.interceptors) { interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); } return interceptorPromise.then(() => { if (Object.keys(localVarFormParams).length) { if (localVarUseFormData) { localVarRequestOptions.formData = localVarFormParams; } else { localVarRequestOptions.form = localVarFormParams; } } return new Promise((resolve, reject) => { request_1.default(localVarRequestOptions, (error, response, body) => { if (error) { reject(error); } else { body = models_1.ObjectSerializer.deserialize(body, "Array<BankResource>"); if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { resolve({ response: response, body: body }); } else { reject(new apis_1.HttpError(response, body, response.statusCode)); } } }); }); }); }); } /** * You can filter requested transfers by values such as direction and status. * @summary Return a list of transfers for an account. * @param accountId * @param direction * @param limit * @param offset */ getTransfers(accountId, direction, limit, offset, options = { headers: {} }) { return __awaiter(this, void 0, void 0, function* () { const localVarPath = this.basePath + '/accounts/{account_id}/transfers' .replace('{' + 'account_id' + '}', encodeURIComponent(String(accountId))); let localVarQueryParameters = {}; let localVarHeaderParams = Object.assign({}, this._defaultHeaders); const produces = ['application/json']; // give precedence to 'application/json' if (produces.indexOf('application/json') >= 0) { localVarHeaderParams.Accept = 'application/json'; } else { localVarHeaderParams.Accept = produces.join(','); } let localVarFormParams = {}; // verify required parameter 'accountId' is not null or undefined if (accountId === null || accountId === undefined) { throw new Error('Required parameter accountId was null or undefined when calling getTransfers.'); } if (direction !== undefined) { localVarQueryParameters['direction'] = models_1.ObjectSerializer.serialize(direction, "'INCOMING' | 'OUTGOING'"); } if (limit !== undefined) { localVarQueryParameters['limit'] = models_1.ObjectSerializer.serialize(limit, "number"); } if (offset !== undefined) { localVarQueryParameters['offset'] = models_1.ObjectSerializer.serialize(offset, "number"); } Object.assign(localVarHeaderParams, options.headers); let localVarUseFormData = false; let localVarRequestOptions = { method: 'GET', qs: localVarQueryParameters, headers: localVarHeaderParams, uri: localVarPath, useQuerystring: this._useQuerystring, json: true, }; let authenticationPromise = Promise.resolve(); if (this.authentications.BasicAuth.username && this.authentications.BasicAuth.password) { authenticationPromise = authenticationPromise.then(() => this.authentications.BasicAuth.applyToRequest(localVarRequestOptions)); } authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); let interceptorPromise = authenticationPromise; for (const interceptor of this.interceptors) { interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); } return interceptorPromise.then(() => { if (Object.keys(localVarFormParams).length) { if (localVarUseFormData) { localVarRequestOptions.formData = localVarFormParams; } else { localVarRequestOptions.form = localVarFormParams; } } return new Promise((resolve, reject) => { request_1.default(localVarRequestOptions, (error, response, body) => { if (error) { reject(error); } else { body = models_1.ObjectSerializer.deserialize(body, "Array<TransferResource>"); if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { resolve({ response: response, body: body }); } else { reject(new apis_1.HttpError(response, body, response.statusCode)); } } }); }); }); }); } /** * * @summary Create an ACH Relationship * @param accountId Account identifier. * @param aCHRelationshipData */ postAchRelationship(accountId, aCHRelationshipData, options = { headers: {} }) { return __awaiter(this, void 0, void 0, function* () { const localVarPath = this.basePath + '/accounts/{account_id}/ach_relationships' .replace('{' + 'account_id' + '}', encodeURIComponent(String(accountId))); let localVarQueryParameters = {}; let localVarHeaderParams = Object.assign({}, this._defaultHeaders); const produces = ['application/json']; // give precedence to 'application/json' if (produces.indexOf('application/json') >= 0) { localVarHeaderParams.Accept = 'application/json'; } else { localVarHeaderParams.Accept = produces.join(','); } let localVarFormParams = {}; // verify required parameter 'accountId' is not null or undefined if (accountId === null || accountId === undefined) { throw new Error('Required parameter accountId was null or undefined when calling postAchRelationship.'); } // verify required parameter 'aCHRelationshipData' is not null or undefined if (aCHRelationshipData === null || aCHRelationshipData === undefined) { throw new Error('Required parameter aCHRelationshipData was null or undefined when calling postAchRelationship.'); } Object.assign(localVarHeaderParams, options.headers); let localVarUseFormData = false; let localVarRequestOptions = { method: 'POST', qs: localVarQueryParameters, headers: localVarHeaderParams, uri: localVarPath, useQuerystring: this._useQuerystring, json: true, body: models_1.ObjectSerializer.serialize(aCHRelationshipData, "ACHRelationshipData") }; let authenticationPromise = Promise.resolve(); if (this.authentications.BasicAuth.username && this.authentications.BasicAuth.password) { authenticationPromise = authenticationPromise.then(() => this.authentications.BasicAuth.applyToRequest(localVarRequestOptions)); } authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); let interceptorPromise = authenticationPromise; for (const interceptor of this.interceptors) { interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); } return interceptorPromise.then(() => { if (Object.keys(localVarFormParams).length) { if (localVarUseFormData) { localVarRequestOptions.formData = localVarFormParams; } else { localVarRequestOptions.form = localVarFormParams; } } return new Promise((resolve, reject) => { request_1.default(localVarRequestOptions, (error, response, body) => { if (error) { reject(error); } else { body = models_1.ObjectSerializer.deserialize(body, "ACHRelationshipResource"); if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { resolve({ response: response, body: body }); } else { reject(new apis_1.HttpError(response, body, response.statusCode)); } } }); }); }); }); } /** * * @summary Create a Bank Relationship for an account * @param accountId Account identifier. * @param bankData */ postRecipientBank(accountId, bankData, options = { headers: {} }) { return __awaiter(this, void 0, void 0, function* () { const localVarPath = this.basePath + '/accounts/{account_id}/recipient_banks' .replace('{' + 'account_id' + '}', encodeURIComponent(String(accountId))); let localVarQueryParameters = {}; let localVarHeaderParams = Object.assign({}, this._defaultHeaders); const produces = ['application/json']; // give precedence to 'application/json' if (produces.indexOf('application/json') >= 0) { localVarHeaderParams.Accept = 'application/json'; } else { localVarHeaderParams.Accept = produces.join(','); } let localVarFormParams = {}; // verify required parameter 'accountId' is not null or undefined if (accountId === null || accountId === undefined) { throw new Error('Required parameter accountId was null or undefined when calling postRecipientBank.'); } // verify required parameter 'bankData' is not null or undefined if (bankData === null || bankData === undefined) { throw new Error('Required parameter bankData was null or undefined when calling postRecipientBank.'); } Object.assign(localVarHeaderParams, options.headers); let localVarUseFormData = false; let localVarRequestOptions = { method: 'POST', qs: localVarQueryParameters, headers: localVarHeaderParams, uri: localVarPath, useQuerystring: this._useQuerystring, json: true, body: models_1.ObjectSerializer.serialize(bankData, "BankData") }; let authenticationPromise = Promise.resolve(); if (this.authentications.BasicAuth.username && this.authentications.BasicAuth.password) { authenticationPromise = authenticationPromise.then(() => this.authentications.BasicAuth.applyToRequest(localVarRequestOptions)); } authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); let interceptorPromise = authenticationPromise; for (const interceptor of this.interceptors) { interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); } return interceptorPromise.then(() => { if (Object.keys(localVarFormParams).length) { if (localVarUseFormData) { localVarRequestOptions.formData = localVarFormParams; } else { localVarRequestOptions.form = localVarFormParams; } } return new Promise((resolve, reject) => { request_1.default(localVarRequestOptions, (error, response, body) => { if (error) { reject(error); } else { body = models_1.ObjectSerializer.deserialize(body, "BankResource"); if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { resolve({ response: response, body: body }); } else { reject(new apis_1.HttpError(response, body, response.statusCode)); } } }); }); }); }); } /** * This operation allows you to fund an account with virtual money in the sandbox environment. * @summary Request a new transfer * @param accountId * @param transferData */ postTransfer(accountId, transferData, options = { headers: {} }) { return __awaiter(this, void 0, void 0, function* () { const localVarPath = this.basePath + '/accounts/{account_id}/transfers' .replace('{' + 'account_id' + '}', encodeURIComponent(String(accountId))); let localVarQueryParameters = {}; let localVarHeaderParams = Object.assign({}, this._defaultHeaders); const produces = ['application/json']; // give precedence to 'application/json' if (produces.indexOf('application/json') >= 0) { localVarHeaderParams.Accept = 'application/json'; } else { localVarHeaderParams.Accept = produces.join(','); } let localVarFormParams = {}; // verify required parameter 'accountId' is not null or undefined if (accountId === null || accountId === undefined) { throw new Error('Required parameter accountId was null or undefined when calling postTransfer.'); } // verify required parameter 'transferData' is not null or undefined if (transferData === null || transferData === undefined) { throw new Error('Required parameter transferData was null or undefined when calling postTransfer.'); } Object.assign(localVarHeaderParams, options.headers); let localVarUseFormData = false; let localVarRequestOptions = { method: 'POST', qs: localVarQueryParameters, headers: localVarHeaderParams, uri: localVarPath, useQuerystring: this._useQuerystring, json: true, body: models_1.ObjectSerializer.serialize(transferData, "TransferData") }; let authenticationPromise = Promise.resolve(); if (this.authentications.BasicAuth.username && this.authentications.BasicAuth.password) { authenticationPromise = authenticationPromise.then(() => this.authentications.BasicAuth.applyToRequest(localVarRequestOptions)); } authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions)); let interceptorPromise = authenticationPromise; for (const interceptor of this.interceptors) { interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions)); } return interceptorPromise.then(() => { if (Object.keys(localVarFormParams).length) { if (localVarUseFormData) { localVarRequestOptions.formData = localVarFormParams; } else { localVarRequestOptions.form = localVarFormParams; } } return new Promise((resolve, reject) => { request_1.default(localVarRequestOptions, (error, response, body) => { if (error) { reject(error); } else { body = models_1.ObjectSerializer.deserialize(body, "TransferResource"); if (response.statusCode && response.statusCode >= 200 && response.statusCode <= 299) { resolve({ response: response, body: body }); } else { reject(new apis_1.HttpError(response, body, response.statusCode)); } } }); }); }); }); } } exports.FundingApi = FundingApi;