UNPKG

@bitmovin/api-sdk

Version:

Bitmovin JS/TS API SDK

79 lines (78 loc) 2.98 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const BaseAPI_1 = require("../../../common/BaseAPI"); const Mapper_1 = require("../../../common/Mapper"); const RegionsApi_1 = require("./regions/RegionsApi"); const AkamaiAccount_1 = require("../../../models/AkamaiAccount"); const PaginationResponse_1 = require("../../../models/PaginationResponse"); const AkamaiAccountListQueryParams_1 = require("./AkamaiAccountListQueryParams"); /** * AkamaiApi - object-oriented interface * @export * @class AkamaiApi * @extends {BaseAPI} */ class AkamaiApi extends BaseAPI_1.BaseAPI { constructor(configuration) { super(configuration); this.regions = new RegionsApi_1.default(configuration); } /** * @summary Add Akamai account * @param {AkamaiAccount} akamaiAccount The Akamai account to be added * @throws {BitmovinError} * @memberof AkamaiApi */ create(akamaiAccount) { return this.restClient.post('/encoding/infrastructure/akamai', {}, akamaiAccount).then((response) => { return (0, Mapper_1.map)(response, AkamaiAccount_1.default); }); } /** * @summary Delete Akamai account * @param {string} infrastructureId Id of the Akamai account * @throws {BitmovinError} * @memberof AkamaiApi */ delete(infrastructureId) { const pathParamMap = { infrastructure_id: infrastructureId }; return this.restClient.delete('/encoding/infrastructure/akamai/{infrastructure_id}', pathParamMap).then((response) => { return (0, Mapper_1.map)(response, AkamaiAccount_1.default); }); } /** * @summary Akamai account details * @param {string} infrastructureId Id of the Akamai account * @throws {BitmovinError} * @memberof AkamaiApi */ get(infrastructureId) { const pathParamMap = { infrastructure_id: infrastructureId }; return this.restClient.get('/encoding/infrastructure/akamai/{infrastructure_id}', pathParamMap).then((response) => { return (0, Mapper_1.map)(response, AkamaiAccount_1.default); }); } /** * @summary List Akamai accounts * @param {*} [queryParameters] query parameters for filtering, sorting and pagination * @throws {BitmovinError} * @memberof AkamaiApi */ list(queryParameters) { let queryParams = {}; if (typeof queryParameters === 'function') { queryParams = queryParameters(new AkamaiAccountListQueryParams_1.AkamaiAccountListQueryParamsBuilder()).buildQueryParams(); } else if (queryParameters) { queryParams = queryParameters; } return this.restClient.get('/encoding/infrastructure/akamai', {}, queryParams).then((response) => { return new PaginationResponse_1.default(response, AkamaiAccount_1.default); }); } } exports.default = AkamaiApi;