@airwallex/node-sdk
Version:
Airwallex Node.js SDK
212 lines • 10.7 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.ContactBeneficiariesApi = void 0;
const apiClient_1 = require("../../client/apiClient");
const dataParser_1 = require("../../utils/dataParser");
const apiSchemaResponse_1 = require("../../model/apiSchemaResponse");
const beneficiaryContactDto_1 = require("../../model/beneficiaryContactDto");
const financialInstitutionResponse_1 = require("../../model/financialInstitutionResponse");
const formSchemaResponse_1 = require("../../model/formSchemaResponse");
const pagedQueryResultDtoOfBeneficiaryContactDto_1 = require("../../model/pagedQueryResultDtoOfBeneficiaryContactDto");
const schemaResult_1 = require("../../model/schemaResult");
class ContactBeneficiariesApi {
async apiSchema(request, options = {}) {
const localVarPath = '/api/v1/beneficiary_api_schemas/generate';
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 = apiSchemaResponse_1.ApiSchemaResponse.discriminator;
return (0, dataParser_1.parseDataToType)(data, typeName);
}
async createBeneficiary(beneficiaryContactRequest, options = {}) {
const localVarPath = '/api/v1/beneficiaries/create';
const { headers, timeout, responseType } = options;
let localVarHeaderParams = Object.assign({}, headers ? headers : {});
if (beneficiaryContactRequest === null || beneficiaryContactRequest === undefined) {
throw new Error('Required parameter beneficiaryContactRequest was null or undefined when calling createBeneficiary.');
}
const data = await apiClient_1.apiClient.post(localVarPath, {
headers: localVarHeaderParams,
timeout,
responseType,
}, beneficiaryContactRequest);
const typeName = beneficiaryContactDto_1.BeneficiaryContactDto.discriminator;
return (0, dataParser_1.parseDataToType)(data, typeName);
}
async delete(id, options = {}) {
if (id === null || id === undefined) {
throw new Error('Required parameter id was null or undefined when calling delete.');
}
const localVarPath = '/api/v1/beneficiaries/{id}/delete'.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 formSchema(request, options = {}) {
const localVarPath = '/api/v1/beneficiary_form_schemas/generate';
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 = formSchemaResponse_1.FormSchemaResponse.discriminator;
return (0, dataParser_1.parseDataToType)(data, typeName);
}
async getBeneficiaries({ bank_account_number, company_name, entity_type, from_date, name, nick_name, page_num, page_size, to_date, type }, options = {}) {
const localVarPath = '/api/v1/beneficiaries';
const { headers, timeout, responseType } = options;
let localVarHeaderParams = Object.assign({}, headers ? headers : {});
let queryParams = {};
if (bank_account_number !== undefined) {
queryParams['bank_account_number'] = bank_account_number;
}
if (company_name !== undefined) {
queryParams['company_name'] = company_name;
}
if (entity_type !== undefined) {
queryParams['entity_type'] = entity_type;
}
if (from_date !== undefined) {
queryParams['from_date'] = from_date;
}
if (name !== undefined) {
queryParams['name'] = name;
}
if (nick_name !== undefined) {
queryParams['nick_name'] = nick_name;
}
if (page_num !== undefined) {
queryParams['page_num'] = page_num;
}
if (page_size !== undefined) {
queryParams['page_size'] = page_size;
}
if (to_date !== undefined) {
queryParams['to_date'] = to_date;
}
if (type !== undefined) {
queryParams['type'] = type;
}
const data = await apiClient_1.apiClient.get(localVarPath, {
headers: localVarHeaderParams,
params: queryParams,
timeout,
responseType,
});
const typeName = pagedQueryResultDtoOfBeneficiaryContactDto_1.PagedQueryResultDtoOfBeneficiaryContactDto.discriminator;
return (0, dataParser_1.parseDataToType)(data, typeName);
}
async getBeneficiarySchema(createBeneficiarySchemaRequestRaw, options = {}) {
const localVarPath = '/api/v1/beneficiaries/schema';
const { headers, timeout, responseType } = options;
let localVarHeaderParams = Object.assign({}, headers ? headers : {});
if (createBeneficiarySchemaRequestRaw === null || createBeneficiarySchemaRequestRaw === undefined) {
throw new Error('Required parameter createBeneficiarySchemaRequestRaw was null or undefined when calling getBeneficiarySchema.');
}
const data = await apiClient_1.apiClient.post(localVarPath, {
headers: localVarHeaderParams,
timeout,
responseType,
}, createBeneficiarySchemaRequestRaw);
const typeName = schemaResult_1.SchemaResult.discriminator;
return (0, dataParser_1.parseDataToType)(data, typeName);
}
async getBeneficiary(id, options = {}) {
if (id === null || id === undefined) {
throw new Error('Required parameter id was null or undefined when calling getBeneficiary.');
}
const localVarPath = '/api/v1/beneficiaries/{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 = beneficiaryContactDto_1.BeneficiaryContactDto.discriminator;
return (0, dataParser_1.parseDataToType)(data, typeName);
}
async supportBanks({ account_currency, bank_country_code, bank_identifier, entity_type, keyword, local_clearing_system, transfer_method }, options = {}) {
const localVarPath = '/api/v1/beneficiary_form_schemas/supported_financial_institutions';
const { headers, timeout, responseType } = options;
let localVarHeaderParams = Object.assign({}, headers ? headers : {});
localVarHeaderParams['headers'] = headers;
let queryParams = {};
if (account_currency !== undefined) {
queryParams['account_currency'] = account_currency;
}
if (bank_country_code !== undefined) {
queryParams['bank_country_code'] = bank_country_code;
}
if (bank_identifier !== undefined) {
queryParams['bank_identifier'] = bank_identifier;
}
if (entity_type !== undefined) {
queryParams['entity_type'] = entity_type;
}
if (keyword !== undefined) {
queryParams['keyword'] = keyword;
}
if (local_clearing_system !== undefined) {
queryParams['local_clearing_system'] = local_clearing_system;
}
if (transfer_method !== undefined) {
queryParams['transfer_method'] = transfer_method;
}
const data = await apiClient_1.apiClient.get(localVarPath, {
headers: localVarHeaderParams,
params: queryParams,
timeout,
responseType,
});
const typeName = financialInstitutionResponse_1.FinancialInstitutionResponse.discriminator;
return (0, dataParser_1.parseDataToType)(data, typeName);
}
async updateBeneficiary(id, beneficiaryContactRequest, options = {}) {
if (id === null || id === undefined) {
throw new Error('Required parameter id was null or undefined when calling updateBeneficiary.');
}
const localVarPath = '/api/v1/beneficiaries/{id}/update'.replace('{' + 'id' + '}', encodeURIComponent(String(id)));
const { headers, timeout, responseType } = options;
let localVarHeaderParams = Object.assign({}, headers ? headers : {});
if (beneficiaryContactRequest === null || beneficiaryContactRequest === undefined) {
throw new Error('Required parameter beneficiaryContactRequest was null or undefined when calling updateBeneficiary.');
}
const data = await apiClient_1.apiClient.post(localVarPath, {
headers: localVarHeaderParams,
timeout,
responseType,
}, beneficiaryContactRequest);
const typeName = beneficiaryContactDto_1.BeneficiaryContactDto.discriminator;
return (0, dataParser_1.parseDataToType)(data, typeName);
}
async validateBeneficiaryRequest(beneficiaryContactRequest, options = {}) {
const localVarPath = '/api/v1/beneficiaries/validate';
const { headers, timeout, responseType } = options;
let localVarHeaderParams = Object.assign({}, headers ? headers : {});
if (beneficiaryContactRequest === null || beneficiaryContactRequest === undefined) {
throw new Error('Required parameter beneficiaryContactRequest was null or undefined when calling validateBeneficiaryRequest.');
}
const data = await apiClient_1.apiClient.post(localVarPath, {
headers: localVarHeaderParams,
timeout,
responseType,
}, beneficiaryContactRequest);
const typeName = 'object';
return (0, dataParser_1.parseDataToType)(data, typeName);
}
}
exports.ContactBeneficiariesApi = ContactBeneficiariesApi;
//# sourceMappingURL=contactBeneficiariesApi.js.map