UNPKG

@paciolan/cybersource-sdk

Version:
415 lines (414 loc) 23.2 kB
"use strict"; 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.SymmetricKeyManagementApi = exports.SymmetricKeyManagementApiFactory = exports.SymmetricKeyManagementApiFp = exports.SymmetricKeyManagementApiAxiosParamCreator = 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"); /** * SymmetricKeyManagementApi - axios parameter creator * @export */ const SymmetricKeyManagementApiAxiosParamCreator = function (configuration) { return { /** * Create one or more Shared-Secret Keys * @summary Create Shared-Secret Keys * @param {V2KeyssymBody} body * @param {*} [options] Override http request option. * @throws {RequiredError} */ createV2SharedSecretKeys: (body, options = {}) => __awaiter(this, void 0, void 0, function* () { // verify required parameter 'body' is not null or undefined if (body === null || body === undefined) { throw new base_1.RequiredError('body', 'Required parameter body was null or undefined when calling createV2SharedSecretKeys.'); } const localVarPath = `/kms/v2/keys-sym`; // 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: 'POST' }, baseOptions), options); const localVarHeaderParameter = {}; const localVarQueryParameter = {}; localVarHeaderParameter['Content-Type'] = 'application/json;charset=utf-8'; 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 needsSerialization = (typeof body !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== undefined ? body : {}) : (body || ""); 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, }; }), /** * Create one or more Shared-Secret Keys as per Verifi spec with 32 chars, store digest algo during key generation. * @summary Create Shared-Secret Keys as per verifi spec * @param {KeyssymVerifiBody} body * @param {string} vIcDomain domain * @param {*} [options] Override http request option. * @throws {RequiredError} */ createV2SharedSecretKeysVerifi: (body, vIcDomain, options = {}) => __awaiter(this, void 0, void 0, function* () { // verify required parameter 'body' is not null or undefined if (body === null || body === undefined) { throw new base_1.RequiredError('body', 'Required parameter body was null or undefined when calling createV2SharedSecretKeysVerifi.'); } // verify required parameter 'vIcDomain' is not null or undefined if (vIcDomain === null || vIcDomain === undefined) { throw new base_1.RequiredError('vIcDomain', 'Required parameter vIcDomain was null or undefined when calling createV2SharedSecretKeysVerifi.'); } const localVarPath = `/kms/v2/keys-sym/verifi`; // 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: 'POST' }, baseOptions), options); const localVarHeaderParameter = {}; const localVarQueryParameter = {}; if (vIcDomain !== undefined && vIcDomain !== null) { localVarHeaderParameter['v-ic-domain'] = String(vIcDomain); } localVarHeaderParameter['Content-Type'] = 'application/json;charset=utf-8'; 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 needsSerialization = (typeof body !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== undefined ? body : {}) : (body || ""); 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, }; }), /** * 'Delete one or more Symmetric keys' * @summary Delete one or more Symmetric keys * @param {KeyssymDeletesBody} body * @param {*} [options] Override http request option. * @throws {RequiredError} */ deleteBulkSymmetricKeys: (body, options = {}) => __awaiter(this, void 0, void 0, function* () { // verify required parameter 'body' is not null or undefined if (body === null || body === undefined) { throw new base_1.RequiredError('body', 'Required parameter body was null or undefined when calling deleteBulkSymmetricKeys.'); } const localVarPath = `/kms/v2/keys-sym/deletes`; // 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: 'POST' }, baseOptions), options); const localVarHeaderParameter = {}; const localVarQueryParameter = {}; localVarHeaderParameter['Content-Type'] = 'application/json;charset=utf-8'; 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 needsSerialization = (typeof body !== "string") || localVarRequestOptions.headers['Content-Type'] === 'application/json'; localVarRequestOptions.data = needsSerialization ? JSON.stringify(body !== undefined ? body : {}) : (body || ""); 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, }; }), /** * Retrieves keys details by providing the key id. * @summary Retrieves shared secret key details * @param {string} keyId Key ID. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getKeyDetails: (keyId, options = {}) => __awaiter(this, void 0, void 0, function* () { // verify required parameter 'keyId' is not null or undefined if (keyId === null || keyId === undefined) { throw new base_1.RequiredError('keyId', 'Required parameter keyId was null or undefined when calling getKeyDetails.'); } const localVarPath = `/kms/v2/keys-sym/{keyId}` .replace(`{${"keyId"}}`, encodeURIComponent(String(keyId))); // 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 = {}; 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.SymmetricKeyManagementApiAxiosParamCreator = SymmetricKeyManagementApiAxiosParamCreator; /** * SymmetricKeyManagementApi - functional programming interface * @export */ const SymmetricKeyManagementApiFp = function (configuration) { return { /** * Create one or more Shared-Secret Keys * @summary Create Shared-Secret Keys * @param {V2KeyssymBody} body * @param {*} [options] Override http request option. * @throws {RequiredError} */ createV2SharedSecretKeys(body, options) { return __awaiter(this, void 0, void 0, function* () { const localVarAxiosArgs = yield (0, exports.SymmetricKeyManagementApiAxiosParamCreator)(configuration).createV2SharedSecretKeys(body, 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); }; }); }, /** * Create one or more Shared-Secret Keys as per Verifi spec with 32 chars, store digest algo during key generation. * @summary Create Shared-Secret Keys as per verifi spec * @param {KeyssymVerifiBody} body * @param {string} vIcDomain domain * @param {*} [options] Override http request option. * @throws {RequiredError} */ createV2SharedSecretKeysVerifi(body, vIcDomain, options) { return __awaiter(this, void 0, void 0, function* () { const localVarAxiosArgs = yield (0, exports.SymmetricKeyManagementApiAxiosParamCreator)(configuration).createV2SharedSecretKeysVerifi(body, vIcDomain, 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); }; }); }, /** * 'Delete one or more Symmetric keys' * @summary Delete one or more Symmetric keys * @param {KeyssymDeletesBody} body * @param {*} [options] Override http request option. * @throws {RequiredError} */ deleteBulkSymmetricKeys(body, options) { return __awaiter(this, void 0, void 0, function* () { const localVarAxiosArgs = yield (0, exports.SymmetricKeyManagementApiAxiosParamCreator)(configuration).deleteBulkSymmetricKeys(body, 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); }; }); }, /** * Retrieves keys details by providing the key id. * @summary Retrieves shared secret key details * @param {string} keyId Key ID. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getKeyDetails(keyId, options) { return __awaiter(this, void 0, void 0, function* () { const localVarAxiosArgs = yield (0, exports.SymmetricKeyManagementApiAxiosParamCreator)(configuration).getKeyDetails(keyId, 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.SymmetricKeyManagementApiFp = SymmetricKeyManagementApiFp; /** * SymmetricKeyManagementApi - factory interface * @export */ const SymmetricKeyManagementApiFactory = function (configuration, basePath, axios) { return { /** * Create one or more Shared-Secret Keys * @summary Create Shared-Secret Keys * @param {V2KeyssymBody} body * @param {*} [options] Override http request option. * @throws {RequiredError} */ createV2SharedSecretKeys(body, options) { return __awaiter(this, void 0, void 0, function* () { return (0, exports.SymmetricKeyManagementApiFp)(configuration).createV2SharedSecretKeys(body, options).then((request) => request(axios, basePath)); }); }, /** * Create one or more Shared-Secret Keys as per Verifi spec with 32 chars, store digest algo during key generation. * @summary Create Shared-Secret Keys as per verifi spec * @param {KeyssymVerifiBody} body * @param {string} vIcDomain domain * @param {*} [options] Override http request option. * @throws {RequiredError} */ createV2SharedSecretKeysVerifi(body, vIcDomain, options) { return __awaiter(this, void 0, void 0, function* () { return (0, exports.SymmetricKeyManagementApiFp)(configuration).createV2SharedSecretKeysVerifi(body, vIcDomain, options).then((request) => request(axios, basePath)); }); }, /** * 'Delete one or more Symmetric keys' * @summary Delete one or more Symmetric keys * @param {KeyssymDeletesBody} body * @param {*} [options] Override http request option. * @throws {RequiredError} */ deleteBulkSymmetricKeys(body, options) { return __awaiter(this, void 0, void 0, function* () { return (0, exports.SymmetricKeyManagementApiFp)(configuration).deleteBulkSymmetricKeys(body, options).then((request) => request(axios, basePath)); }); }, /** * Retrieves keys details by providing the key id. * @summary Retrieves shared secret key details * @param {string} keyId Key ID. * @param {*} [options] Override http request option. * @throws {RequiredError} */ getKeyDetails(keyId, options) { return __awaiter(this, void 0, void 0, function* () { return (0, exports.SymmetricKeyManagementApiFp)(configuration).getKeyDetails(keyId, options).then((request) => request(axios, basePath)); }); }, }; }; exports.SymmetricKeyManagementApiFactory = SymmetricKeyManagementApiFactory; /** * SymmetricKeyManagementApi - object-oriented interface * @export * @class SymmetricKeyManagementApi * @extends {BaseAPI} */ class SymmetricKeyManagementApi extends base_1.BaseAPI { /** * Create one or more Shared-Secret Keys * @summary Create Shared-Secret Keys * @param {V2KeyssymBody} body * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof SymmetricKeyManagementApi */ createV2SharedSecretKeys(body, options) { return __awaiter(this, void 0, void 0, function* () { return (0, exports.SymmetricKeyManagementApiFp)(this.configuration).createV2SharedSecretKeys(body, options).then((request) => request(this.axios, options.runEnvironment != null ? `https://${options.runEnvironment}` : this.basePath)); }); } /** * Create one or more Shared-Secret Keys as per Verifi spec with 32 chars, store digest algo during key generation. * @summary Create Shared-Secret Keys as per verifi spec * @param {KeyssymVerifiBody} body * @param {string} vIcDomain domain * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof SymmetricKeyManagementApi */ createV2SharedSecretKeysVerifi(body, vIcDomain, options) { return __awaiter(this, void 0, void 0, function* () { return (0, exports.SymmetricKeyManagementApiFp)(this.configuration).createV2SharedSecretKeysVerifi(body, vIcDomain, options).then((request) => request(this.axios, options.runEnvironment != null ? `https://${options.runEnvironment}` : this.basePath)); }); } /** * 'Delete one or more Symmetric keys' * @summary Delete one or more Symmetric keys * @param {KeyssymDeletesBody} body * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof SymmetricKeyManagementApi */ deleteBulkSymmetricKeys(body, options) { return __awaiter(this, void 0, void 0, function* () { return (0, exports.SymmetricKeyManagementApiFp)(this.configuration).deleteBulkSymmetricKeys(body, options).then((request) => request(this.axios, options.runEnvironment != null ? `https://${options.runEnvironment}` : this.basePath)); }); } /** * Retrieves keys details by providing the key id. * @summary Retrieves shared secret key details * @param {string} keyId Key ID. * @param {*} [options] Override http request option. * @throws {RequiredError} * @memberof SymmetricKeyManagementApi */ getKeyDetails(keyId, options) { return __awaiter(this, void 0, void 0, function* () { return (0, exports.SymmetricKeyManagementApiFp)(this.configuration).getKeyDetails(keyId, options).then((request) => request(this.axios, options.runEnvironment != null ? `https://${options.runEnvironment}` : this.basePath)); }); } } exports.SymmetricKeyManagementApi = SymmetricKeyManagementApi;