@paciolan/cybersource-sdk
Version:
CyberSource REST API Typescript SDK
272 lines (271 loc) • 16.5 kB
JavaScript
;
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.SecureFileShareApi = exports.SecureFileShareApiFactory = exports.SecureFileShareApiFp = exports.SecureFileShareApiAxiosParamCreator = void 0;
/* tslint:disable */
/* eslint-disable */
/**
* CyberSource Merged Spec
* All CyberSource API specs merged together. These are available at https://developer.cybersource.com/api/reference/api-reference.html
*
* OpenAPI spec version: 0.0.1
*
*
* NOTE: This class is auto generated by the swagger code generator program.
* https://github.com/swagger-api/swagger-codegen.git
* Do not edit the class manually.
*/
const axios_1 = __importDefault(require("axios"));
const AuthenticationHeader_1 = require("../authentication/core/AuthenticationHeader");
// Some imports not used depending on template conditions
// @ts-ignore
const base_1 = require("../base");
/**
* SecureFileShareApi - axios parameter creator
* @export
*/
const SecureFileShareApiAxiosParamCreator = function (configuration) {
return {
/**
* Download a file for the given file identifier
* @summary Download a File with File Identifier
* @param {string} fileId Unique identifier for each file
* @param {string} [organizationId] Valid Cybersource Organization Id
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getFile: (fileId, organizationId, options = {}) => __awaiter(this, void 0, void 0, function* () {
// verify required parameter 'fileId' is not null or undefined
if (fileId === null || fileId === undefined) {
throw new base_1.RequiredError('fileId', 'Required parameter fileId was null or undefined when calling getFile.');
}
const localVarPath = `/sfs/v1/files/{fileId}`
.replace(`{${"fileId"}}`, encodeURIComponent(String(fileId)));
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, 'https://example.com');
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
if (organizationId !== undefined) {
localVarQueryParameter['organizationId'] = organizationId;
}
const query = new URLSearchParams(localVarUrlObj.search);
for (const key in localVarQueryParameter) {
query.set(key, localVarQueryParameter[key]);
}
for (const key in options.params) {
query.set(key, options.params[key]);
}
localVarUrlObj.search = (new URLSearchParams(query)).toString();
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
const authHeader = new AuthenticationHeader_1.AuthenticationHeader();
authHeader.setConfiguration(Object.assign(Object.assign({}, configuration), options));
localVarRequestOptions.headers = authHeader.callAuthenticationHeader(localVarRequestOptions.method, localVarPath, localVarRequestOptions.data, localVarRequestOptions.headers);
return {
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
options: localVarRequestOptions,
};
}),
/**
* Get list of files and it's information of them available inside the report directory
* @summary Get List of Files
* @param {string} startDate Valid start date in **ISO 8601 format** Please refer the following link to know more about ISO 8601 format.[Rfc Date Format](https://xml2rfc.tools.ietf.org/public/rfc/html/rfc3339.html#anchor14) **Example date format:** - yyyy-MM-dd
* @param {string} endDate Valid end date in **ISO 8601 format** Please refer the following link to know more about ISO 8601 format.[Rfc Date Format](https://xml2rfc.tools.ietf.org/public/rfc/html/rfc3339.html#anchor14) **Example date format:** - yyyy-MM-dd
* @param {string} [organizationId] Valid Cybersource Organization Id
* @param {string} [name] **Tailored to searches for specific files with in given Date range** example : MyTransactionDetailreport.xml
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getFileDetail: (startDate, endDate, organizationId, name, options = {}) => __awaiter(this, void 0, void 0, function* () {
// verify required parameter 'startDate' is not null or undefined
if (startDate === null || startDate === undefined) {
throw new base_1.RequiredError('startDate', 'Required parameter startDate was null or undefined when calling getFileDetail.');
}
// verify required parameter 'endDate' is not null or undefined
if (endDate === null || endDate === undefined) {
throw new base_1.RequiredError('endDate', 'Required parameter endDate was null or undefined when calling getFileDetail.');
}
const localVarPath = `/sfs/v1/file-details`;
// use dummy base URL string because the URL constructor only accepts absolute URLs.
const localVarUrlObj = new URL(localVarPath, 'https://example.com');
let baseOptions;
if (configuration) {
baseOptions = configuration.baseOptions;
}
const localVarRequestOptions = Object.assign(Object.assign({ method: 'GET' }, baseOptions), options);
const localVarHeaderParameter = {};
const localVarQueryParameter = {};
if (startDate !== undefined) {
localVarQueryParameter['startDate'] = (startDate instanceof Date) ?
startDate.toISOString().substr(0, 10) :
startDate;
}
if (endDate !== undefined) {
localVarQueryParameter['endDate'] = (endDate instanceof Date) ?
endDate.toISOString().substr(0, 10) :
endDate;
}
if (organizationId !== undefined) {
localVarQueryParameter['organizationId'] = organizationId;
}
if (name !== undefined) {
localVarQueryParameter['name'] = name;
}
const query = new URLSearchParams(localVarUrlObj.search);
for (const key in localVarQueryParameter) {
query.set(key, localVarQueryParameter[key]);
}
for (const key in options.params) {
query.set(key, options.params[key]);
}
localVarUrlObj.search = (new URLSearchParams(query)).toString();
let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
localVarRequestOptions.headers = Object.assign(Object.assign(Object.assign({}, localVarHeaderParameter), headersFromBaseOptions), options.headers);
const authHeader = new AuthenticationHeader_1.AuthenticationHeader();
authHeader.setConfiguration(Object.assign(Object.assign({}, configuration), options));
localVarRequestOptions.headers = authHeader.callAuthenticationHeader(localVarRequestOptions.method, localVarPath, localVarRequestOptions.data, localVarRequestOptions.headers);
return {
url: localVarUrlObj.pathname + localVarUrlObj.search + localVarUrlObj.hash,
options: localVarRequestOptions,
};
}),
};
};
exports.SecureFileShareApiAxiosParamCreator = SecureFileShareApiAxiosParamCreator;
/**
* SecureFileShareApi - functional programming interface
* @export
*/
const SecureFileShareApiFp = function (configuration) {
return {
/**
* Download a file for the given file identifier
* @summary Download a File with File Identifier
* @param {string} fileId Unique identifier for each file
* @param {string} [organizationId] Valid Cybersource Organization Id
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getFile(fileId, organizationId, options) {
return __awaiter(this, void 0, void 0, function* () {
const localVarAxiosArgs = yield (0, exports.SecureFileShareApiAxiosParamCreator)(configuration).getFile(fileId, organizationId, options);
return (axios = axios_1.default, basePath = base_1.BASE_PATH) => {
const axiosRequestArgs = Object.assign(Object.assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
return axios.request(axiosRequestArgs);
};
});
},
/**
* Get list of files and it's information of them available inside the report directory
* @summary Get List of Files
* @param {string} startDate Valid start date in **ISO 8601 format** Please refer the following link to know more about ISO 8601 format.[Rfc Date Format](https://xml2rfc.tools.ietf.org/public/rfc/html/rfc3339.html#anchor14) **Example date format:** - yyyy-MM-dd
* @param {string} endDate Valid end date in **ISO 8601 format** Please refer the following link to know more about ISO 8601 format.[Rfc Date Format](https://xml2rfc.tools.ietf.org/public/rfc/html/rfc3339.html#anchor14) **Example date format:** - yyyy-MM-dd
* @param {string} [organizationId] Valid Cybersource Organization Id
* @param {string} [name] **Tailored to searches for specific files with in given Date range** example : MyTransactionDetailreport.xml
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getFileDetail(startDate, endDate, organizationId, name, options) {
return __awaiter(this, void 0, void 0, function* () {
const localVarAxiosArgs = yield (0, exports.SecureFileShareApiAxiosParamCreator)(configuration).getFileDetail(startDate, endDate, organizationId, name, options);
return (axios = axios_1.default, basePath = base_1.BASE_PATH) => {
const axiosRequestArgs = Object.assign(Object.assign({}, localVarAxiosArgs.options), { url: basePath + localVarAxiosArgs.url });
return axios.request(axiosRequestArgs);
};
});
},
};
};
exports.SecureFileShareApiFp = SecureFileShareApiFp;
/**
* SecureFileShareApi - factory interface
* @export
*/
const SecureFileShareApiFactory = function (configuration, basePath, axios) {
return {
/**
* Download a file for the given file identifier
* @summary Download a File with File Identifier
* @param {string} fileId Unique identifier for each file
* @param {string} [organizationId] Valid Cybersource Organization Id
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getFile(fileId, organizationId, options) {
return __awaiter(this, void 0, void 0, function* () {
return (0, exports.SecureFileShareApiFp)(configuration).getFile(fileId, organizationId, options).then((request) => request(axios, basePath));
});
},
/**
* Get list of files and it's information of them available inside the report directory
* @summary Get List of Files
* @param {string} startDate Valid start date in **ISO 8601 format** Please refer the following link to know more about ISO 8601 format.[Rfc Date Format](https://xml2rfc.tools.ietf.org/public/rfc/html/rfc3339.html#anchor14) **Example date format:** - yyyy-MM-dd
* @param {string} endDate Valid end date in **ISO 8601 format** Please refer the following link to know more about ISO 8601 format.[Rfc Date Format](https://xml2rfc.tools.ietf.org/public/rfc/html/rfc3339.html#anchor14) **Example date format:** - yyyy-MM-dd
* @param {string} [organizationId] Valid Cybersource Organization Id
* @param {string} [name] **Tailored to searches for specific files with in given Date range** example : MyTransactionDetailreport.xml
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getFileDetail(startDate, endDate, organizationId, name, options) {
return __awaiter(this, void 0, void 0, function* () {
return (0, exports.SecureFileShareApiFp)(configuration).getFileDetail(startDate, endDate, organizationId, name, options).then((request) => request(axios, basePath));
});
},
};
};
exports.SecureFileShareApiFactory = SecureFileShareApiFactory;
/**
* SecureFileShareApi - object-oriented interface
* @export
* @class SecureFileShareApi
* @extends {BaseAPI}
*/
class SecureFileShareApi extends base_1.BaseAPI {
/**
* Download a file for the given file identifier
* @summary Download a File with File Identifier
* @param {string} fileId Unique identifier for each file
* @param {string} [organizationId] Valid Cybersource Organization Id
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof SecureFileShareApi
*/
getFile(fileId, organizationId, options) {
return __awaiter(this, void 0, void 0, function* () {
return (0, exports.SecureFileShareApiFp)(this.configuration).getFile(fileId, organizationId, options).then((request) => request(this.axios, options.runEnvironment != null ? `https://${options.runEnvironment}` : this.basePath));
});
}
/**
* Get list of files and it's information of them available inside the report directory
* @summary Get List of Files
* @param {string} startDate Valid start date in **ISO 8601 format** Please refer the following link to know more about ISO 8601 format.[Rfc Date Format](https://xml2rfc.tools.ietf.org/public/rfc/html/rfc3339.html#anchor14) **Example date format:** - yyyy-MM-dd
* @param {string} endDate Valid end date in **ISO 8601 format** Please refer the following link to know more about ISO 8601 format.[Rfc Date Format](https://xml2rfc.tools.ietf.org/public/rfc/html/rfc3339.html#anchor14) **Example date format:** - yyyy-MM-dd
* @param {string} [organizationId] Valid Cybersource Organization Id
* @param {string} [name] **Tailored to searches for specific files with in given Date range** example : MyTransactionDetailreport.xml
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof SecureFileShareApi
*/
getFileDetail(startDate, endDate, organizationId, name, options) {
return __awaiter(this, void 0, void 0, function* () {
return (0, exports.SecureFileShareApiFp)(this.configuration).getFileDetail(startDate, endDate, organizationId, name, options).then((request) => request(this.axios, options.runEnvironment != null ? `https://${options.runEnvironment}` : this.basePath));
});
}
}
exports.SecureFileShareApi = SecureFileShareApi;