UNPKG

@bitmovin/api-sdk

Version:

Bitmovin JS/TS API SDK

112 lines (111 loc) 4.7 kB
"use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var BaseAPI_1 = require("../../../../common/BaseAPI"); var Mapper_1 = require("../../../../common/Mapper"); var CustomXmlElementsApi_1 = require("./customXmlElements/CustomXmlElementsApi"); var AdaptationsetsApi_1 = require("./adaptationsets/AdaptationsetsApi"); var BitmovinResponse_1 = require("../../../../models/BitmovinResponse"); var Period_1 = require("../../../../models/Period"); var PaginationResponse_1 = require("../../../../models/PaginationResponse"); var PeriodListQueryParams_1 = require("./PeriodListQueryParams"); /** * PeriodsApi - object-oriented interface * @export * @class PeriodsApi * @extends {BaseAPI} */ var PeriodsApi = /** @class */ (function (_super) { __extends(PeriodsApi, _super); function PeriodsApi(configuration) { var _this = _super.call(this, configuration) || this; _this.customXmlElements = new CustomXmlElementsApi_1.default(configuration); _this.adaptationsets = new AdaptationsetsApi_1.default(configuration); return _this; } /** * @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 */ PeriodsApi.prototype.create = function (manifestId, period) { var pathParamMap = { manifest_id: manifestId }; return this.restClient.post('/encoding/manifests/dash/{manifest_id}/periods', pathParamMap, period).then(function (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 */ PeriodsApi.prototype.delete = function (manifestId, periodId) { var pathParamMap = { manifest_id: manifestId, period_id: periodId }; return this.restClient.delete('/encoding/manifests/dash/{manifest_id}/periods/{period_id}', pathParamMap).then(function (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 */ PeriodsApi.prototype.get = function (manifestId, periodId) { var pathParamMap = { manifest_id: manifestId, period_id: periodId }; return this.restClient.get('/encoding/manifests/dash/{manifest_id}/periods/{period_id}', pathParamMap).then(function (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 */ PeriodsApi.prototype.list = function (manifestId, queryParameters) { var pathParamMap = { manifest_id: manifestId }; var 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(function (response) { return new PaginationResponse_1.default(response, Period_1.default); }); }; return PeriodsApi; }(BaseAPI_1.BaseAPI)); exports.default = PeriodsApi;