UNPKG

@bitmovin/api-sdk

Version:

Bitmovin JS/TS API SDK

94 lines (93 loc) 3.65 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const BaseAPI_1 = require("../../../../common/BaseAPI"); const Mapper_1 = require("../../../../common/Mapper"); const CustomXmlElementsApi_1 = require("./customXmlElements/CustomXmlElementsApi"); const AdaptationsetsApi_1 = require("./adaptationsets/AdaptationsetsApi"); const BitmovinResponse_1 = require("../../../../models/BitmovinResponse"); const Period_1 = require("../../../../models/Period"); const PaginationResponse_1 = require("../../../../models/PaginationResponse"); const PeriodListQueryParams_1 = require("./PeriodListQueryParams"); /** * PeriodsApi - object-oriented interface * @export * @class PeriodsApi * @extends {BaseAPI} */ class PeriodsApi extends BaseAPI_1.BaseAPI { constructor(configuration) { super(configuration); this.customXmlElements = new CustomXmlElementsApi_1.default(configuration); this.adaptationsets = new AdaptationsetsApi_1.default(configuration); } /** * @summary Add Period * @param {string} manifestId Id of the manifest * @param {Period} period The Period to be added to the manifest * @throws {BitmovinError} * @memberof PeriodsApi */ create(manifestId, period) { const pathParamMap = { manifest_id: manifestId }; return this.restClient.post('/encoding/manifests/dash/{manifest_id}/periods', pathParamMap, period).then((response) => { return (0, Mapper_1.map)(response, Period_1.default); }); } /** * @summary Delete Period * @param {string} manifestId Id of the manifest * @param {string} periodId Id of the period to be deleted * @throws {BitmovinError} * @memberof PeriodsApi */ delete(manifestId, periodId) { const pathParamMap = { manifest_id: manifestId, period_id: periodId }; return this.restClient.delete('/encoding/manifests/dash/{manifest_id}/periods/{period_id}', pathParamMap).then((response) => { return (0, Mapper_1.map)(response, BitmovinResponse_1.default); }); } /** * @summary Period Details * @param {string} manifestId Id of the manifest * @param {string} periodId Id of the period * @throws {BitmovinError} * @memberof PeriodsApi */ get(manifestId, periodId) { const pathParamMap = { manifest_id: manifestId, period_id: periodId }; return this.restClient.get('/encoding/manifests/dash/{manifest_id}/periods/{period_id}', pathParamMap).then((response) => { return (0, Mapper_1.map)(response, Period_1.default); }); } /** * @summary List all Periods * @param {string} manifestId Id of the manifest * @param {*} [queryParameters] query parameters for filtering, sorting and pagination * @throws {BitmovinError} * @memberof PeriodsApi */ list(manifestId, queryParameters) { const pathParamMap = { manifest_id: manifestId }; let queryParams = {}; if (typeof queryParameters === 'function') { queryParams = queryParameters(new PeriodListQueryParams_1.PeriodListQueryParamsBuilder()).buildQueryParams(); } else if (queryParameters) { queryParams = queryParameters; } return this.restClient.get('/encoding/manifests/dash/{manifest_id}/periods', pathParamMap, queryParams).then((response) => { return new PaginationResponse_1.default(response, Period_1.default); }); } } exports.default = PeriodsApi;