@airwallex/node-sdk
Version:
Airwallex Node.js SDK
80 lines • 3.88 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.AccountCapabilityApi = void 0;
const apiClient_1 = require("../../client/apiClient");
const dataParser_1 = require("../../utils/dataParser");
const accountCapabilityResponse_1 = require("../../model/accountCapabilityResponse");
const pagedFundingLimit_1 = require("../../model/pagedFundingLimit");
const requestedResponse_1 = require("../../model/requestedResponse");
class AccountCapabilityApi {
async apply(request, options = {}) {
const localVarPath = '/api/v1/account_capabilities/apply';
const { headers, timeout, responseType } = options;
let localVarHeaderParams = Object.assign({}, headers ? headers : {});
if (request === null || request === undefined) {
throw new Error('Required parameter request was null or undefined when calling apply.');
}
const data = await apiClient_1.apiClient.post(localVarPath, {
headers: localVarHeaderParams,
timeout,
responseType,
}, request);
const typeName = requestedResponse_1.RequestedResponse.discriminator;
return (0, dataParser_1.parseDataToType)(data, typeName);
}
async enable(id, request, options = {}) {
if (id === null || id === undefined) {
throw new Error('Required parameter id was null or undefined when calling enable.');
}
const localVarPath = '/api/v1/account_capabilities/{id}/enable'.replace('{' + 'id' + '}', encodeURIComponent(String(id)));
const { headers, timeout, responseType } = options;
let localVarHeaderParams = Object.assign({}, headers ? headers : {});
const data = await apiClient_1.apiClient.post(localVarPath, {
headers: localVarHeaderParams,
timeout,
responseType,
}, request);
const typeName = accountCapabilityResponse_1.AccountCapabilityResponse.discriminator;
return (0, dataParser_1.parseDataToType)(data, typeName);
}
async getFundingLimits({ ccy, pageNum, pageSize }, options = {}) {
const localVarPath = '/api/v1/account_capabilities/funding_limits';
const { headers, timeout, responseType } = options;
let localVarHeaderParams = Object.assign({}, headers ? headers : {});
let queryParams = {};
if (ccy !== undefined) {
queryParams['ccy'] = ccy;
}
if (pageNum !== undefined) {
queryParams['pageNum'] = pageNum;
}
if (pageSize !== undefined) {
queryParams['pageSize'] = pageSize;
}
const data = await apiClient_1.apiClient.get(localVarPath, {
headers: localVarHeaderParams,
params: queryParams,
timeout,
responseType,
});
const typeName = pagedFundingLimit_1.PagedFundingLimit.discriminator;
return (0, dataParser_1.parseDataToType)(data, typeName);
}
async getStatus(id, options = {}) {
if (id === null || id === undefined) {
throw new Error('Required parameter id was null or undefined when calling getStatus.');
}
const localVarPath = '/api/v1/account_capabilities/{id}'.replace('{' + 'id' + '}', encodeURIComponent(String(id)));
const { headers, timeout, responseType } = options;
let localVarHeaderParams = Object.assign({}, headers ? headers : {});
const data = await apiClient_1.apiClient.get(localVarPath, {
headers: localVarHeaderParams,
timeout,
responseType,
});
const typeName = accountCapabilityResponse_1.AccountCapabilityResponse.discriminator;
return (0, dataParser_1.parseDataToType)(data, typeName);
}
}
exports.AccountCapabilityApi = AccountCapabilityApi;
//# sourceMappingURL=accountCapabilityApi.js.map