@paciolan/cybersource-sdk
Version:
CyberSource REST API Typescript SDK
260 lines (259 loc) • 16.3 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.ReportDefinitionsApi = exports.ReportDefinitionsApiFactory = exports.ReportDefinitionsApiFp = exports.ReportDefinitionsApiAxiosParamCreator = 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");
/**
* ReportDefinitionsApi - axios parameter creator
* @export
*/
const ReportDefinitionsApiAxiosParamCreator = function (configuration) {
return {
/**
* View the attributes of an individual report type. For a list of values for reportDefinitionName, see the [Reporting Developer Guide](https://www.cybersource.com/developers/documentation/reporting_and_reconciliation/)
* @summary Get Report Definition
* @param {string} reportDefinitionName Name of the Report definition to retrieve
* @param {string} [subscriptionType] The subscription type for which report definition is required. By default the type will be CUSTOM. Valid Values: - CLASSIC - CUSTOM - STANDARD
* @param {string} [reportMimeType] The format for which the report definition is required. By default the value will be CSV. Valid Values: - application/xml - text/csv
* @param {string} [organizationId] Valid Organization Id
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getResourceInfoByReportDefinition: (reportDefinitionName, subscriptionType, reportMimeType, organizationId, options = {}) => __awaiter(this, void 0, void 0, function* () {
// verify required parameter 'reportDefinitionName' is not null or undefined
if (reportDefinitionName === null || reportDefinitionName === undefined) {
throw new base_1.RequiredError('reportDefinitionName', 'Required parameter reportDefinitionName was null or undefined when calling getResourceInfoByReportDefinition.');
}
const localVarPath = `/reporting/v3/report-definitions/{reportDefinitionName}`
.replace(`{${"reportDefinitionName"}}`, encodeURIComponent(String(reportDefinitionName)));
// 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 (subscriptionType !== undefined) {
localVarQueryParameter['subscriptionType'] = subscriptionType;
}
if (reportMimeType !== undefined) {
localVarQueryParameter['reportMimeType'] = reportMimeType;
}
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,
};
}),
/**
* View a list of supported reports and their attributes before subscribing to them.
* @summary Get Reporting Resource Information
* @param {string} [subscriptionType] Valid Values: - CLASSIC - CUSTOM - STANDARD
* @param {string} [organizationId] Valid Organization Id
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getResourceV2Info: (subscriptionType, organizationId, options = {}) => __awaiter(this, void 0, void 0, function* () {
const localVarPath = `/reporting/v3/report-definitions`;
// 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 (subscriptionType !== undefined) {
localVarQueryParameter['subscriptionType'] = subscriptionType;
}
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,
};
}),
};
};
exports.ReportDefinitionsApiAxiosParamCreator = ReportDefinitionsApiAxiosParamCreator;
/**
* ReportDefinitionsApi - functional programming interface
* @export
*/
const ReportDefinitionsApiFp = function (configuration) {
return {
/**
* View the attributes of an individual report type. For a list of values for reportDefinitionName, see the [Reporting Developer Guide](https://www.cybersource.com/developers/documentation/reporting_and_reconciliation/)
* @summary Get Report Definition
* @param {string} reportDefinitionName Name of the Report definition to retrieve
* @param {string} [subscriptionType] The subscription type for which report definition is required. By default the type will be CUSTOM. Valid Values: - CLASSIC - CUSTOM - STANDARD
* @param {string} [reportMimeType] The format for which the report definition is required. By default the value will be CSV. Valid Values: - application/xml - text/csv
* @param {string} [organizationId] Valid Organization Id
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getResourceInfoByReportDefinition(reportDefinitionName, subscriptionType, reportMimeType, organizationId, options) {
return __awaiter(this, void 0, void 0, function* () {
const localVarAxiosArgs = yield (0, exports.ReportDefinitionsApiAxiosParamCreator)(configuration).getResourceInfoByReportDefinition(reportDefinitionName, subscriptionType, reportMimeType, 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);
};
});
},
/**
* View a list of supported reports and their attributes before subscribing to them.
* @summary Get Reporting Resource Information
* @param {string} [subscriptionType] Valid Values: - CLASSIC - CUSTOM - STANDARD
* @param {string} [organizationId] Valid Organization Id
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getResourceV2Info(subscriptionType, organizationId, options) {
return __awaiter(this, void 0, void 0, function* () {
const localVarAxiosArgs = yield (0, exports.ReportDefinitionsApiAxiosParamCreator)(configuration).getResourceV2Info(subscriptionType, 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);
};
});
},
};
};
exports.ReportDefinitionsApiFp = ReportDefinitionsApiFp;
/**
* ReportDefinitionsApi - factory interface
* @export
*/
const ReportDefinitionsApiFactory = function (configuration, basePath, axios) {
return {
/**
* View the attributes of an individual report type. For a list of values for reportDefinitionName, see the [Reporting Developer Guide](https://www.cybersource.com/developers/documentation/reporting_and_reconciliation/)
* @summary Get Report Definition
* @param {string} reportDefinitionName Name of the Report definition to retrieve
* @param {string} [subscriptionType] The subscription type for which report definition is required. By default the type will be CUSTOM. Valid Values: - CLASSIC - CUSTOM - STANDARD
* @param {string} [reportMimeType] The format for which the report definition is required. By default the value will be CSV. Valid Values: - application/xml - text/csv
* @param {string} [organizationId] Valid Organization Id
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getResourceInfoByReportDefinition(reportDefinitionName, subscriptionType, reportMimeType, organizationId, options) {
return __awaiter(this, void 0, void 0, function* () {
return (0, exports.ReportDefinitionsApiFp)(configuration).getResourceInfoByReportDefinition(reportDefinitionName, subscriptionType, reportMimeType, organizationId, options).then((request) => request(axios, basePath));
});
},
/**
* View a list of supported reports and their attributes before subscribing to them.
* @summary Get Reporting Resource Information
* @param {string} [subscriptionType] Valid Values: - CLASSIC - CUSTOM - STANDARD
* @param {string} [organizationId] Valid Organization Id
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
getResourceV2Info(subscriptionType, organizationId, options) {
return __awaiter(this, void 0, void 0, function* () {
return (0, exports.ReportDefinitionsApiFp)(configuration).getResourceV2Info(subscriptionType, organizationId, options).then((request) => request(axios, basePath));
});
},
};
};
exports.ReportDefinitionsApiFactory = ReportDefinitionsApiFactory;
/**
* ReportDefinitionsApi - object-oriented interface
* @export
* @class ReportDefinitionsApi
* @extends {BaseAPI}
*/
class ReportDefinitionsApi extends base_1.BaseAPI {
/**
* View the attributes of an individual report type. For a list of values for reportDefinitionName, see the [Reporting Developer Guide](https://www.cybersource.com/developers/documentation/reporting_and_reconciliation/)
* @summary Get Report Definition
* @param {string} reportDefinitionName Name of the Report definition to retrieve
* @param {string} [subscriptionType] The subscription type for which report definition is required. By default the type will be CUSTOM. Valid Values: - CLASSIC - CUSTOM - STANDARD
* @param {string} [reportMimeType] The format for which the report definition is required. By default the value will be CSV. Valid Values: - application/xml - text/csv
* @param {string} [organizationId] Valid Organization Id
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof ReportDefinitionsApi
*/
getResourceInfoByReportDefinition(reportDefinitionName, subscriptionType, reportMimeType, organizationId, options) {
return __awaiter(this, void 0, void 0, function* () {
return (0, exports.ReportDefinitionsApiFp)(this.configuration).getResourceInfoByReportDefinition(reportDefinitionName, subscriptionType, reportMimeType, organizationId, options).then((request) => request(this.axios, options.runEnvironment != null ? `https://${options.runEnvironment}` : this.basePath));
});
}
/**
* View a list of supported reports and their attributes before subscribing to them.
* @summary Get Reporting Resource Information
* @param {string} [subscriptionType] Valid Values: - CLASSIC - CUSTOM - STANDARD
* @param {string} [organizationId] Valid Organization Id
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof ReportDefinitionsApi
*/
getResourceV2Info(subscriptionType, organizationId, options) {
return __awaiter(this, void 0, void 0, function* () {
return (0, exports.ReportDefinitionsApiFp)(this.configuration).getResourceV2Info(subscriptionType, organizationId, options).then((request) => request(this.axios, options.runEnvironment != null ? `https://${options.runEnvironment}` : this.basePath));
});
}
}
exports.ReportDefinitionsApi = ReportDefinitionsApi;