UNPKG

@bitmovin/api-sdk

Version:

Bitmovin JS/TS API SDK

100 lines (99 loc) 4.12 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const BaseAPI_1 = require("../../../../../../common/BaseAPI"); const Mapper_1 = require("../../../../../../common/Mapper"); const CustomdataApi_1 = require("./customdata/CustomdataApi"); const BitmovinResponse_1 = require("../../../../../../models/BitmovinResponse"); const ClearKeyDrm_1 = require("../../../../../../models/ClearKeyDrm"); const PaginationResponse_1 = require("../../../../../../models/PaginationResponse"); const ClearKeyDrmListQueryParams_1 = require("./ClearKeyDrmListQueryParams"); /** * ClearkeyApi - object-oriented interface * @export * @class ClearkeyApi * @extends {BaseAPI} */ class ClearkeyApi extends BaseAPI_1.BaseAPI { constructor(configuration) { super(configuration); this.customdata = new CustomdataApi_1.default(configuration); } /** * @summary Add ClearKey DRM to an MP4 muxing * @param {string} encodingId Id of the encoding. * @param {string} muxingId Id of the MP4 muxing. * @param {ClearKeyDrm} clearKeyDrm The ClearKey DRM to be created * @throws {BitmovinError} * @memberof ClearkeyApi */ create(encodingId, muxingId, clearKeyDrm) { const pathParamMap = { encoding_id: encodingId, muxing_id: muxingId }; return this.restClient.post('/encoding/encodings/{encoding_id}/muxings/mp4/{muxing_id}/drm/clearkey', pathParamMap, clearKeyDrm).then((response) => { return (0, Mapper_1.map)(response, ClearKeyDrm_1.default); }); } /** * @summary Delete ClearKey DRM from an MP4 muxing * @param {string} encodingId Id of the encoding. * @param {string} muxingId Id of the mp4. * @param {string} drmId Id of the ClearKey DRM configuration. * @throws {BitmovinError} * @memberof ClearkeyApi */ delete(encodingId, muxingId, drmId) { const pathParamMap = { encoding_id: encodingId, muxing_id: muxingId, drm_id: drmId }; return this.restClient.delete('/encoding/encodings/{encoding_id}/muxings/mp4/{muxing_id}/drm/clearkey/{drm_id}', pathParamMap).then((response) => { return (0, Mapper_1.map)(response, BitmovinResponse_1.default); }); } /** * @summary ClearKey DRM Details of an MP4 muxing * @param {string} encodingId Id of the encoding. * @param {string} muxingId Id of the mp4. * @param {string} drmId Id of the ClearKey DRM configuration. * @throws {BitmovinError} * @memberof ClearkeyApi */ get(encodingId, muxingId, drmId) { const pathParamMap = { encoding_id: encodingId, muxing_id: muxingId, drm_id: drmId }; return this.restClient.get('/encoding/encodings/{encoding_id}/muxings/mp4/{muxing_id}/drm/clearkey/{drm_id}', pathParamMap).then((response) => { return (0, Mapper_1.map)(response, ClearKeyDrm_1.default); }); } /** * @summary List ClearKey DRMs of an MP4 muxing * @param {string} encodingId Id of the encoding. * @param {string} muxingId Id of the mp4. * @param {*} [queryParameters] query parameters for filtering, sorting and pagination * @throws {BitmovinError} * @memberof ClearkeyApi */ list(encodingId, muxingId, queryParameters) { const pathParamMap = { encoding_id: encodingId, muxing_id: muxingId }; let queryParams = {}; if (typeof queryParameters === 'function') { queryParams = queryParameters(new ClearKeyDrmListQueryParams_1.ClearKeyDrmListQueryParamsBuilder()).buildQueryParams(); } else if (queryParameters) { queryParams = queryParameters; } return this.restClient.get('/encoding/encodings/{encoding_id}/muxings/mp4/{muxing_id}/drm/clearkey', pathParamMap, queryParams).then((response) => { return new PaginationResponse_1.default(response, ClearKeyDrm_1.default); }); } } exports.default = ClearkeyApi;