@airwallex/node-sdk
Version:
Airwallex Node.js SDK
76 lines • 3.64 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.RiskRequestForInformationRFIApi = void 0;
const apiClient_1 = require("../../client/apiClient");
const dataParser_1 = require("../../utils/dataParser");
const pagedRfiSessionQueryResultDto_1 = require("../../model/pagedRfiSessionQueryResultDto");
const rfiSessionDto_1 = require("../../model/rfiSessionDto");
class RiskRequestForInformationRFIApi {
async getRfiSession(id, options = {}) {
if (id === null || id === undefined) {
throw new Error('Required parameter id was null or undefined when calling getRfiSession.');
}
const localVarPath = '/api/v1/rfis/{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 = rfiSessionDto_1.RfiSessionDto.discriminator;
return (0, dataParser_1.parseDataToType)(data, typeName);
}
async listRfiSessionsByAccount({ end_created_at, from_created_at, page, page_size, statuses, types }, options = {}) {
const localVarPath = '/api/v1/rfis';
const { headers, timeout, responseType } = options;
let localVarHeaderParams = Object.assign({}, headers ? headers : {});
let queryParams = {};
if (end_created_at !== undefined) {
queryParams['end_created_at'] = end_created_at;
}
if (from_created_at !== undefined) {
queryParams['from_created_at'] = from_created_at;
}
if (page !== undefined) {
queryParams['page'] = page;
}
if (page_size !== undefined) {
queryParams['page_size'] = page_size;
}
if (statuses !== undefined) {
queryParams['statuses'] = statuses;
}
if (types !== undefined) {
queryParams['types'] = types;
}
const data = await apiClient_1.apiClient.get(localVarPath, {
headers: localVarHeaderParams,
params: queryParams,
timeout,
responseType,
});
const typeName = pagedRfiSessionQueryResultDto_1.PagedRfiSessionQueryResultDto.discriminator;
return (0, dataParser_1.parseDataToType)(data, typeName);
}
async respondRfiSession(id, responseDTO, options = {}) {
if (id === null || id === undefined) {
throw new Error('Required parameter id was null or undefined when calling respondRfiSession.');
}
const localVarPath = '/api/v1/rfis/{id}/respond'.replace('{' + 'id' + '}', encodeURIComponent(String(id)));
const { headers, timeout, responseType } = options;
let localVarHeaderParams = Object.assign({}, headers ? headers : {});
if (responseDTO === null || responseDTO === undefined) {
throw new Error('Required parameter responseDTO was null or undefined when calling respondRfiSession.');
}
const data = await apiClient_1.apiClient.post(localVarPath, {
headers: localVarHeaderParams,
timeout,
responseType,
}, responseDTO);
const typeName = rfiSessionDto_1.RfiSessionDto.discriminator;
return (0, dataParser_1.parseDataToType)(data, typeName);
}
}
exports.RiskRequestForInformationRFIApi = RiskRequestForInformationRFIApi;
//# sourceMappingURL=riskRequestForInformationRFIApi.js.map