@paciolan/cybersource-sdk
Version:
CyberSource REST API Typescript SDK
203 lines (202 loc) • 13.2 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.KeyManagementApi = exports.KeyManagementApiFactory = exports.KeyManagementApiFp = exports.KeyManagementApiAxiosParamCreator = 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");
/**
* KeyManagementApi - axios parameter creator
* @export
*/
const KeyManagementApiAxiosParamCreator = function (configuration) {
return {
/**
* Search one or more Keys
* @summary Search Keys
* @param {number} [offset] This allows you to specify the page offset from the resulting list resultset you want the records to be returned
* @param {number} [limit] This allows you to specify the total number of records to be returned off the resulting list resultset
* @param {string} [sort] This allows you to specify a comma separated list of fields in the order which the resulting list resultset must be sorted.
* @param {Array<string>} [organizationIds] List of Orgaization Ids to search. The maximum size of the organization Ids list is 1. The maximum length of Organization Id is 30.
* @param {Array<string>} [keyIds] List of Key Ids to search. The maximum size of the Key Ids list is 1
* @param {Array<string>} [keyTypes] Key Type, Possible values - certificate, password, pgp and scmp_api. When Key Type is provided atleast one more filter needs to be provided
* @param {Date} [expirationStartDate] Expiry Filter Start Date. When Expiration Date filter is provided, atleast one more filter needs to be provided
* @param {Date} [expirationEndDate] Expiry Filter End Date. When Expiration Date filter is provided, atleast one more filter needs to be provided
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
searchKeys: (offset, limit, sort, organizationIds, keyIds, keyTypes, expirationStartDate, expirationEndDate, options = {}) => __awaiter(this, void 0, void 0, function* () {
const localVarPath = `/kms/v2/keys`;
// 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 (offset !== undefined) {
localVarQueryParameter['offset'] = offset;
}
if (limit !== undefined) {
localVarQueryParameter['limit'] = limit;
}
if (sort !== undefined) {
localVarQueryParameter['sort'] = sort;
}
if (organizationIds) {
localVarQueryParameter['organizationIds'] = organizationIds.join(base_1.COLLECTION_FORMATS.csv);
}
if (keyIds) {
localVarQueryParameter['keyIds'] = keyIds.join(base_1.COLLECTION_FORMATS.csv);
}
if (keyTypes) {
localVarQueryParameter['keyTypes'] = keyTypes.join(base_1.COLLECTION_FORMATS.csv);
}
if (expirationStartDate !== undefined) {
localVarQueryParameter['expirationStartDate'] = (expirationStartDate instanceof Date) ?
expirationStartDate.toISOString() :
expirationStartDate;
}
if (expirationEndDate !== undefined) {
localVarQueryParameter['expirationEndDate'] = (expirationEndDate instanceof Date) ?
expirationEndDate.toISOString() :
expirationEndDate;
}
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.KeyManagementApiAxiosParamCreator = KeyManagementApiAxiosParamCreator;
/**
* KeyManagementApi - functional programming interface
* @export
*/
const KeyManagementApiFp = function (configuration) {
return {
/**
* Search one or more Keys
* @summary Search Keys
* @param {number} [offset] This allows you to specify the page offset from the resulting list resultset you want the records to be returned
* @param {number} [limit] This allows you to specify the total number of records to be returned off the resulting list resultset
* @param {string} [sort] This allows you to specify a comma separated list of fields in the order which the resulting list resultset must be sorted.
* @param {Array<string>} [organizationIds] List of Orgaization Ids to search. The maximum size of the organization Ids list is 1. The maximum length of Organization Id is 30.
* @param {Array<string>} [keyIds] List of Key Ids to search. The maximum size of the Key Ids list is 1
* @param {Array<string>} [keyTypes] Key Type, Possible values - certificate, password, pgp and scmp_api. When Key Type is provided atleast one more filter needs to be provided
* @param {Date} [expirationStartDate] Expiry Filter Start Date. When Expiration Date filter is provided, atleast one more filter needs to be provided
* @param {Date} [expirationEndDate] Expiry Filter End Date. When Expiration Date filter is provided, atleast one more filter needs to be provided
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
searchKeys(offset, limit, sort, organizationIds, keyIds, keyTypes, expirationStartDate, expirationEndDate, options) {
return __awaiter(this, void 0, void 0, function* () {
const localVarAxiosArgs = yield (0, exports.KeyManagementApiAxiosParamCreator)(configuration).searchKeys(offset, limit, sort, organizationIds, keyIds, keyTypes, expirationStartDate, expirationEndDate, 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.KeyManagementApiFp = KeyManagementApiFp;
/**
* KeyManagementApi - factory interface
* @export
*/
const KeyManagementApiFactory = function (configuration, basePath, axios) {
return {
/**
* Search one or more Keys
* @summary Search Keys
* @param {number} [offset] This allows you to specify the page offset from the resulting list resultset you want the records to be returned
* @param {number} [limit] This allows you to specify the total number of records to be returned off the resulting list resultset
* @param {string} [sort] This allows you to specify a comma separated list of fields in the order which the resulting list resultset must be sorted.
* @param {Array<string>} [organizationIds] List of Orgaization Ids to search. The maximum size of the organization Ids list is 1. The maximum length of Organization Id is 30.
* @param {Array<string>} [keyIds] List of Key Ids to search. The maximum size of the Key Ids list is 1
* @param {Array<string>} [keyTypes] Key Type, Possible values - certificate, password, pgp and scmp_api. When Key Type is provided atleast one more filter needs to be provided
* @param {Date} [expirationStartDate] Expiry Filter Start Date. When Expiration Date filter is provided, atleast one more filter needs to be provided
* @param {Date} [expirationEndDate] Expiry Filter End Date. When Expiration Date filter is provided, atleast one more filter needs to be provided
* @param {*} [options] Override http request option.
* @throws {RequiredError}
*/
searchKeys(offset, limit, sort, organizationIds, keyIds, keyTypes, expirationStartDate, expirationEndDate, options) {
return __awaiter(this, void 0, void 0, function* () {
return (0, exports.KeyManagementApiFp)(configuration).searchKeys(offset, limit, sort, organizationIds, keyIds, keyTypes, expirationStartDate, expirationEndDate, options).then((request) => request(axios, basePath));
});
},
};
};
exports.KeyManagementApiFactory = KeyManagementApiFactory;
/**
* KeyManagementApi - object-oriented interface
* @export
* @class KeyManagementApi
* @extends {BaseAPI}
*/
class KeyManagementApi extends base_1.BaseAPI {
/**
* Search one or more Keys
* @summary Search Keys
* @param {number} [offset] This allows you to specify the page offset from the resulting list resultset you want the records to be returned
* @param {number} [limit] This allows you to specify the total number of records to be returned off the resulting list resultset
* @param {string} [sort] This allows you to specify a comma separated list of fields in the order which the resulting list resultset must be sorted.
* @param {Array<string>} [organizationIds] List of Orgaization Ids to search. The maximum size of the organization Ids list is 1. The maximum length of Organization Id is 30.
* @param {Array<string>} [keyIds] List of Key Ids to search. The maximum size of the Key Ids list is 1
* @param {Array<string>} [keyTypes] Key Type, Possible values - certificate, password, pgp and scmp_api. When Key Type is provided atleast one more filter needs to be provided
* @param {Date} [expirationStartDate] Expiry Filter Start Date. When Expiration Date filter is provided, atleast one more filter needs to be provided
* @param {Date} [expirationEndDate] Expiry Filter End Date. When Expiration Date filter is provided, atleast one more filter needs to be provided
* @param {*} [options] Override http request option.
* @throws {RequiredError}
* @memberof KeyManagementApi
*/
searchKeys(offset, limit, sort, organizationIds, keyIds, keyTypes, expirationStartDate, expirationEndDate, options) {
return __awaiter(this, void 0, void 0, function* () {
return (0, exports.KeyManagementApiFp)(this.configuration).searchKeys(offset, limit, sort, organizationIds, keyIds, keyTypes, expirationStartDate, expirationEndDate, options).then((request) => request(this.axios, options.runEnvironment != null ? `https://${options.runEnvironment}` : this.basePath));
});
}
}
exports.KeyManagementApi = KeyManagementApi;