@airwallex/node-sdk
Version:
Airwallex Node.js SDK
226 lines • 11.6 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.CoreResourcesLinkedAccountsApi = void 0;
const apiClient_1 = require("../../client/apiClient");
const dataParser_1 = require("../../utils/dataParser");
const linkedAccountAuthResponseDto_1 = require("../../model/linkedAccountAuthResponseDto");
const linkedAccountDto_1 = require("../../model/linkedAccountDto");
const mandateDto_1 = require("../../model/mandateDto");
const pagedBalancesResultDto_1 = require("../../model/pagedBalancesResultDto");
const pagedLinkedAccountDto_1 = require("../../model/pagedLinkedAccountDto");
class CoreResourcesLinkedAccountsApi {
async auth(request, options = {}) {
const localVarPath = '/api/v1/linked_accounts/auth';
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 auth.');
}
const data = await apiClient_1.apiClient.post(localVarPath, {
headers: localVarHeaderParams,
timeout,
responseType,
}, request);
const typeName = linkedAccountAuthResponseDto_1.LinkedAccountAuthResponseDto.discriminator;
return (0, dataParser_1.parseDataToType)(data, typeName);
}
async balances(id, options = {}) {
if (id === null || id === undefined) {
throw new Error('Required parameter id was null or undefined when calling balances.');
}
const localVarPath = '/api/v1/linked_accounts/{id}/balances'.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 = pagedBalancesResultDto_1.PagedBalancesResultDto.discriminator;
return (0, dataParser_1.parseDataToType)(data, typeName);
}
async completeAuth(id, request, options = {}) {
if (id === null || id === undefined) {
throw new Error('Required parameter id was null or undefined when calling completeAuth.');
}
const localVarPath = '/api/v1/linked_accounts/{id}/complete_auth'.replace('{' + 'id' + '}', encodeURIComponent(String(id)));
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 completeAuth.');
}
const data = await apiClient_1.apiClient.post(localVarPath, {
headers: localVarHeaderParams,
timeout,
responseType,
}, request);
const typeName = 'boolean';
return (0, dataParser_1.parseDataToType)(data, typeName);
}
async confirmOneAccount(id, request, options = {}) {
if (id === null || id === undefined) {
throw new Error('Required parameter id was null or undefined when calling confirmOneAccount.');
}
const localVarPath = '/api/v1/linked_accounts/{id}/confirm'.replace('{' + 'id' + '}', encodeURIComponent(String(id)));
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 confirmOneAccount.');
}
const data = await apiClient_1.apiClient.post(localVarPath, {
headers: localVarHeaderParams,
timeout,
responseType,
}, request);
const typeName = 'object';
return (0, dataParser_1.parseDataToType)(data, typeName);
}
async create(laCreateDto, options = {}) {
const localVarPath = '/api/v1/linked_accounts/create';
const { headers, timeout, responseType } = options;
let localVarHeaderParams = Object.assign({}, headers ? headers : {});
if (laCreateDto === null || laCreateDto === undefined) {
throw new Error('Required parameter laCreateDto was null or undefined when calling create.');
}
const data = await apiClient_1.apiClient.post(localVarPath, {
headers: localVarHeaderParams,
timeout,
responseType,
}, laCreateDto);
const typeName = linkedAccountDto_1.LinkedAccountDto.discriminator;
return (0, dataParser_1.parseDataToType)(data, typeName);
}
async findById(id, options = {}) {
if (id === null || id === undefined) {
throw new Error('Required parameter id was null or undefined when calling findById.');
}
const localVarPath = '/api/v1/linked_accounts/{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 = linkedAccountDto_1.LinkedAccountDto.discriminator;
return (0, dataParser_1.parseDataToType)(data, typeName);
}
async findList({ country_code, from_created_at, page_num, page_size, status, to_created_at }, options = {}) {
const localVarPath = '/api/v1/linked_accounts';
const { headers, timeout, responseType } = options;
let localVarHeaderParams = Object.assign({}, headers ? headers : {});
let queryParams = {};
if (country_code !== undefined) {
queryParams['country_code'] = country_code;
}
if (from_created_at !== undefined) {
queryParams['from_created_at'] = from_created_at;
}
if (page_num !== undefined) {
queryParams['page_num'] = page_num;
}
if (page_size !== undefined) {
queryParams['page_size'] = page_size;
}
if (status !== undefined) {
queryParams['status'] = status;
}
if (to_created_at !== undefined) {
queryParams['to_created_at'] = to_created_at;
}
const data = await apiClient_1.apiClient.get(localVarPath, {
headers: localVarHeaderParams,
params: queryParams,
timeout,
responseType,
});
const typeName = pagedLinkedAccountDto_1.PagedLinkedAccountDto.discriminator;
return (0, dataParser_1.parseDataToType)(data, typeName);
}
async getMandate(id, options = {}) {
if (id === null || id === undefined) {
throw new Error('Required parameter id was null or undefined when calling getMandate.');
}
const localVarPath = '/api/v1/linked_accounts/{id}/mandate'.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 = mandateDto_1.MandateDto.discriminator;
return (0, dataParser_1.parseDataToType)(data, typeName);
}
async reAuth(id, request, options = {}) {
if (id === null || id === undefined) {
throw new Error('Required parameter id was null or undefined when calling reAuth.');
}
const localVarPath = '/api/v1/linked_accounts/{id}/auth'.replace('{' + 'id' + '}', encodeURIComponent(String(id)));
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 reAuth.');
}
const data = await apiClient_1.apiClient.post(localVarPath, {
headers: localVarHeaderParams,
timeout,
responseType,
}, request);
const typeName = linkedAccountAuthResponseDto_1.LinkedAccountAuthResponseDto.discriminator;
return (0, dataParser_1.parseDataToType)(data, typeName);
}
async suspend(id, options = {}) {
if (id === null || id === undefined) {
throw new Error('Required parameter id was null or undefined when calling suspend.');
}
const localVarPath = '/api/v1/linked_accounts/{id}/suspend'.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,
});
const typeName = 'boolean';
return (0, dataParser_1.parseDataToType)(data, typeName);
}
async updateMandate(id, mandate, options = {}) {
if (id === null || id === undefined) {
throw new Error('Required parameter id was null or undefined when calling updateMandate.');
}
const localVarPath = '/api/v1/linked_accounts/{id}/mandate'.replace('{' + 'id' + '}', encodeURIComponent(String(id)));
const { headers, timeout, responseType } = options;
let localVarHeaderParams = Object.assign({}, headers ? headers : {});
if (mandate === null || mandate === undefined) {
throw new Error('Required parameter mandate was null or undefined when calling updateMandate.');
}
const data = await apiClient_1.apiClient.post(localVarPath, {
headers: localVarHeaderParams,
timeout,
responseType,
}, mandate);
const typeName = mandateDto_1.MandateDto.discriminator;
return (0, dataParser_1.parseDataToType)(data, typeName);
}
async verifyMicroDeposits(id, verifyMicroDepositsDto, options = {}) {
if (id === null || id === undefined) {
throw new Error('Required parameter id was null or undefined when calling verifyMicroDeposits.');
}
const localVarPath = '/api/v1/linked_accounts/{id}/verify_microdeposits'.replace('{' + 'id' + '}', encodeURIComponent(String(id)));
const { headers, timeout, responseType } = options;
let localVarHeaderParams = Object.assign({}, headers ? headers : {});
if (verifyMicroDepositsDto === null || verifyMicroDepositsDto === undefined) {
throw new Error('Required parameter verifyMicroDepositsDto was null or undefined when calling verifyMicroDeposits.');
}
const data = await apiClient_1.apiClient.post(localVarPath, {
headers: localVarHeaderParams,
timeout,
responseType,
}, verifyMicroDepositsDto);
const typeName = linkedAccountDto_1.LinkedAccountDto.discriminator;
return (0, dataParser_1.parseDataToType)(data, typeName);
}
}
exports.CoreResourcesLinkedAccountsApi = CoreResourcesLinkedAccountsApi;
//# sourceMappingURL=coreResourcesLinkedAccountsApi.js.map