@adyen/api-library
Version:
The Adyen API Library for NodeJS enables you to work with Adyen APIs.
95 lines • 5.51 kB
JavaScript
;
/*
* The version of the OpenAPI document: v3
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit this class manually.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.AllowedOriginsCompanyLevelApi = void 0;
const getJsonResponse_1 = __importDefault(require("../../helpers/getJsonResponse"));
const service_1 = __importDefault(require("../../service"));
const resource_1 = __importDefault(require("../resource"));
const objectSerializer_1 = require("../../typings/management/objectSerializer");
/**
* API handler for AllowedOriginsCompanyLevelApi
*/
class AllowedOriginsCompanyLevelApi extends service_1.default {
constructor(client) {
super(client);
this.API_BASEPATH = "https://management-test.adyen.com/v3";
this.baseUrl = this.createBaseUrl(this.API_BASEPATH);
}
/**
* @summary Create an allowed origin
* @param companyId {@link string } The unique identifier of the company account.
* @param apiCredentialId {@link string } Unique identifier of the API credential.
* @param allowedOrigin {@link AllowedOrigin }
* @param requestOptions {@link IRequest.Options }
* @return {@link AllowedOrigin }
*/
async createAllowedOrigin(companyId, apiCredentialId, allowedOrigin, requestOptions) {
const endpoint = `${this.baseUrl}/companies/{companyId}/apiCredentials/{apiCredentialId}/allowedOrigins`
.replace("{" + "companyId" + "}", encodeURIComponent(String(companyId)))
.replace("{" + "apiCredentialId" + "}", encodeURIComponent(String(apiCredentialId)));
const resource = new resource_1.default(this, endpoint);
const request = objectSerializer_1.ObjectSerializer.serialize(allowedOrigin, "AllowedOrigin");
const response = await (0, getJsonResponse_1.default)(resource, request, { ...requestOptions, method: "POST" });
return objectSerializer_1.ObjectSerializer.deserialize(response, "AllowedOrigin");
}
/**
* @summary Delete an allowed origin
* @param companyId {@link string } The unique identifier of the company account.
* @param apiCredentialId {@link string } Unique identifier of the API credential.
* @param originId {@link string } Unique identifier of the allowed origin.
* @param requestOptions {@link IRequest.Options }
* @return {@link void }
*/
async deleteAllowedOrigin(companyId, apiCredentialId, originId, requestOptions) {
const endpoint = `${this.baseUrl}/companies/{companyId}/apiCredentials/{apiCredentialId}/allowedOrigins/{originId}`
.replace("{" + "companyId" + "}", encodeURIComponent(String(companyId)))
.replace("{" + "apiCredentialId" + "}", encodeURIComponent(String(apiCredentialId)))
.replace("{" + "originId" + "}", encodeURIComponent(String(originId)));
const resource = new resource_1.default(this, endpoint);
await (0, getJsonResponse_1.default)(resource, "", { ...requestOptions, method: "DELETE" });
}
/**
* @summary Get an allowed origin
* @param companyId {@link string } The unique identifier of the company account.
* @param apiCredentialId {@link string } Unique identifier of the API credential.
* @param originId {@link string } Unique identifier of the allowed origin.
* @param requestOptions {@link IRequest.Options }
* @return {@link AllowedOrigin }
*/
async getAllowedOrigin(companyId, apiCredentialId, originId, requestOptions) {
const endpoint = `${this.baseUrl}/companies/{companyId}/apiCredentials/{apiCredentialId}/allowedOrigins/{originId}`
.replace("{" + "companyId" + "}", encodeURIComponent(String(companyId)))
.replace("{" + "apiCredentialId" + "}", encodeURIComponent(String(apiCredentialId)))
.replace("{" + "originId" + "}", encodeURIComponent(String(originId)));
const resource = new resource_1.default(this, endpoint);
const response = await (0, getJsonResponse_1.default)(resource, "", { ...requestOptions, method: "GET" });
return objectSerializer_1.ObjectSerializer.deserialize(response, "AllowedOrigin");
}
/**
* @summary Get a list of allowed origins
* @param companyId {@link string } The unique identifier of the company account.
* @param apiCredentialId {@link string } Unique identifier of the API credential.
* @param requestOptions {@link IRequest.Options }
* @return {@link AllowedOriginsResponse }
*/
async listAllowedOrigins(companyId, apiCredentialId, requestOptions) {
const endpoint = `${this.baseUrl}/companies/{companyId}/apiCredentials/{apiCredentialId}/allowedOrigins`
.replace("{" + "companyId" + "}", encodeURIComponent(String(companyId)))
.replace("{" + "apiCredentialId" + "}", encodeURIComponent(String(apiCredentialId)));
const resource = new resource_1.default(this, endpoint);
const response = await (0, getJsonResponse_1.default)(resource, "", { ...requestOptions, method: "GET" });
return objectSerializer_1.ObjectSerializer.deserialize(response, "AllowedOriginsResponse");
}
}
exports.AllowedOriginsCompanyLevelApi = AllowedOriginsCompanyLevelApi;
//# sourceMappingURL=allowedOriginsCompanyLevelApi.js.map