@airwallex/node-sdk
Version:
Airwallex Node.js SDK
186 lines • 9.42 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.AccountsApi = void 0;
const apiClient_1 = require("../../client/apiClient");
const dataParser_1 = require("../../utils/dataParser");
const accountResApiDto_1 = require("../../model/accountResApiDto");
const accountWalletInfoDto_1 = require("../../model/accountWalletInfoDto");
const amendmentResApiDto_1 = require("../../model/amendmentResApiDto");
const pagedQueryResultDtoOfAccountResApiDto_1 = require("../../model/pagedQueryResultDtoOfAccountResApiDto");
class AccountsApi {
async agreeToTermsAndConditions(id, termsAndConditions, options = {}) {
if (id === null || id === undefined) {
throw new Error('Required parameter id was null or undefined when calling agreeToTermsAndConditions.');
}
const localVarPath = '/api/v1/accounts/{id}/terms_and_conditions/agree'.replace('{' + 'id' + '}', encodeURIComponent(String(id)));
const { headers, timeout, responseType } = options;
let localVarHeaderParams = Object.assign({}, headers ? headers : {});
if (termsAndConditions === null || termsAndConditions === undefined) {
throw new Error('Required parameter termsAndConditions was null or undefined when calling agreeToTermsAndConditions.');
}
const data = await apiClient_1.apiClient.post(localVarPath, {
headers: localVarHeaderParams,
timeout,
responseType,
}, termsAndConditions);
const typeName = accountResApiDto_1.AccountResApiDto.discriminator;
return (0, dataParser_1.parseDataToType)(data, typeName);
}
async createAmendment(request, options = {}) {
const localVarPath = '/api/v1/account/amendments/create';
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 createAmendment.');
}
const data = await apiClient_1.apiClient.post(localVarPath, {
headers: localVarHeaderParams,
timeout,
responseType,
}, request);
const typeName = amendmentResApiDto_1.AmendmentResApiDto.discriminator;
return (0, dataParser_1.parseDataToType)(data, typeName);
}
async createNewAccount(account, options = {}) {
const localVarPath = '/api/v1/accounts/create';
const { headers, timeout, responseType } = options;
let localVarHeaderParams = Object.assign({}, headers ? headers : {});
if (account === null || account === undefined) {
throw new Error('Required parameter account was null or undefined when calling createNewAccount.');
}
const data = await apiClient_1.apiClient.post(localVarPath, {
headers: localVarHeaderParams,
timeout,
responseType,
}, account);
const typeName = accountResApiDto_1.AccountResApiDto.discriminator;
return (0, dataParser_1.parseDataToType)(data, typeName);
}
async getAccountByOpenId(id, options = {}) {
if (id === null || id === undefined) {
throw new Error('Required parameter id was null or undefined when calling getAccountByOpenId.');
}
const localVarPath = '/api/v1/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 = accountResApiDto_1.AccountResApiDto.discriminator;
return (0, dataParser_1.parseDataToType)(data, typeName);
}
async getAccountWalletInfo(options = {}) {
const localVarPath = '/api/v1/account/wallet_info';
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 = accountWalletInfoDto_1.AccountWalletInfoDto.discriminator;
return (0, dataParser_1.parseDataToType)(data, typeName);
}
async getAmendment(amendment_id, options = {}) {
if (amendment_id === null || amendment_id === undefined) {
throw new Error('Required parameter amendment_id was null or undefined when calling getAmendment.');
}
const localVarPath = '/api/v1/account/amendments/{amendment_id}'.replace('{' + 'amendment_id' + '}', encodeURIComponent(String(amendment_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 = amendmentResApiDto_1.AmendmentResApiDto.discriminator;
return (0, dataParser_1.parseDataToType)(data, typeName);
}
async getConnectedAccounts({ account_status, email, from_created_at, identifier, metadata, page_num, page_size, to_created_at }, options = {}) {
const localVarPath = '/api/v1/accounts';
const { headers, timeout, responseType } = options;
let localVarHeaderParams = Object.assign({}, headers ? headers : {});
let queryParams = {};
if (account_status !== undefined) {
queryParams['account_status'] = account_status;
}
if (email !== undefined) {
queryParams['email'] = email;
}
if (from_created_at !== undefined) {
queryParams['from_created_at'] = from_created_at;
}
if (identifier !== undefined) {
queryParams['identifier'] = identifier;
}
if (metadata !== undefined) {
queryParams['metadata'] = metadata;
}
if (page_num !== undefined) {
queryParams['page_num'] = page_num;
}
if (page_size !== undefined) {
queryParams['page_size'] = page_size;
}
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 = pagedQueryResultDtoOfAccountResApiDto_1.PagedQueryResultDtoOfAccountResApiDto.discriminator;
return (0, dataParser_1.parseDataToType)(data, typeName);
}
async getCurrentAccount(options = {}) {
const localVarPath = '/api/v1/account';
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 = accountResApiDto_1.AccountResApiDto.discriminator;
return (0, dataParser_1.parseDataToType)(data, typeName);
}
async submitAccount(id, options = {}) {
if (id === null || id === undefined) {
throw new Error('Required parameter id was null or undefined when calling submitAccount.');
}
const localVarPath = '/api/v1/accounts/{id}/submit'.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 = accountResApiDto_1.AccountResApiDto.discriminator;
return (0, dataParser_1.parseDataToType)(data, typeName);
}
async updateAccount(id, accountUpdateDetailDto, options = {}) {
if (id === null || id === undefined) {
throw new Error('Required parameter id was null or undefined when calling updateAccount.');
}
const localVarPath = '/api/v1/accounts/{id}/update'.replace('{' + 'id' + '}', encodeURIComponent(String(id)));
const { headers, timeout, responseType } = options;
let localVarHeaderParams = Object.assign({}, headers ? headers : {});
if (accountUpdateDetailDto === null || accountUpdateDetailDto === undefined) {
throw new Error('Required parameter accountUpdateDetailDto was null or undefined when calling updateAccount.');
}
const data = await apiClient_1.apiClient.post(localVarPath, {
headers: localVarHeaderParams,
timeout,
responseType,
}, accountUpdateDetailDto);
const typeName = accountResApiDto_1.AccountResApiDto.discriminator;
return (0, dataParser_1.parseDataToType)(data, typeName);
}
}
exports.AccountsApi = AccountsApi;
//# sourceMappingURL=accountsApi.js.map