@bitmovin/api-sdk
Version:
Bitmovin JS/TS API SDK
114 lines (113 loc) • 5.75 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const BaseAPI_1 = require("../../../../../../../../common/BaseAPI");
const Mapper_1 = require("../../../../../../../../common/Mapper");
const BitmovinResponse_1 = require("../../../../../../../../models/BitmovinResponse");
const ContentProtection_1 = require("../../../../../../../../models/ContentProtection");
const PaginationResponse_1 = require("../../../../../../../../models/PaginationResponse");
const ContentProtectionListQueryParams_1 = require("./ContentProtectionListQueryParams");
/**
* ContentprotectionApi - object-oriented interface
* @export
* @class ContentprotectionApi
* @extends {BaseAPI}
*/
class ContentprotectionApi extends BaseAPI_1.BaseAPI {
constructor(configuration) {
super(configuration);
}
/**
* @summary Add Content Protection to WebM Representation
* @param {string} manifestId Id of the manifest
* @param {string} periodId Id of the period
* @param {string} adaptationsetId Id of the adaptation set
* @param {string} representationId Id of the representation
* @param {ContentProtection} contentProtection The content protection to be added to the WebM representation
* @throws {BitmovinError}
* @memberof ContentprotectionApi
*/
create(manifestId, periodId, adaptationsetId, representationId, contentProtection) {
const pathParamMap = {
manifest_id: manifestId,
period_id: periodId,
adaptationset_id: adaptationsetId,
representation_id: representationId
};
return this.restClient.post('/encoding/manifests/dash/{manifest_id}/periods/{period_id}/adaptationsets/{adaptationset_id}/representations/webm/{representation_id}/contentprotection', pathParamMap, contentProtection).then((response) => {
return (0, Mapper_1.map)(response, ContentProtection_1.default);
});
}
/**
* @summary Delete WebM Representation Content Protection
* @param {string} manifestId Id of the manifest
* @param {string} periodId Id of the period
* @param {string} adaptationsetId Id of the adaptation set
* @param {string} representationId Id of the representation
* @param {string} contentprotectionId Id of the DRM WebM content protection to be deleted
* @throws {BitmovinError}
* @memberof ContentprotectionApi
*/
delete(manifestId, periodId, adaptationsetId, representationId, contentprotectionId) {
const pathParamMap = {
manifest_id: manifestId,
period_id: periodId,
adaptationset_id: adaptationsetId,
representation_id: representationId,
contentprotection_id: contentprotectionId
};
return this.restClient.delete('/encoding/manifests/dash/{manifest_id}/periods/{period_id}/adaptationsets/{adaptationset_id}/representations/webm/{representation_id}/contentprotection/{contentprotection_id}', pathParamMap).then((response) => {
return (0, Mapper_1.map)(response, BitmovinResponse_1.default);
});
}
/**
* @summary WebM Representation Content Protection Details
* @param {string} manifestId Id of the manifest
* @param {string} periodId Id of the period
* @param {string} adaptationsetId Id of the adaptation set
* @param {string} representationId Id of the representation
* @param {string} contentprotectionId Id of the DRM WebM content protection
* @throws {BitmovinError}
* @memberof ContentprotectionApi
*/
get(manifestId, periodId, adaptationsetId, representationId, contentprotectionId) {
const pathParamMap = {
manifest_id: manifestId,
period_id: periodId,
adaptationset_id: adaptationsetId,
representation_id: representationId,
contentprotection_id: contentprotectionId
};
return this.restClient.get('/encoding/manifests/dash/{manifest_id}/periods/{period_id}/adaptationsets/{adaptationset_id}/representations/webm/{representation_id}/contentprotection/{contentprotection_id}', pathParamMap).then((response) => {
return (0, Mapper_1.map)(response, ContentProtection_1.default);
});
}
/**
* @summary List all WebM Representation Content Protections
* @param {string} manifestId Id of the manifest
* @param {string} periodId Id of the period
* @param {string} adaptationsetId Id of the adaptation set
* @param {string} representationId Id of the representation
* @param {*} [queryParameters] query parameters for filtering, sorting and pagination
* @throws {BitmovinError}
* @memberof ContentprotectionApi
*/
list(manifestId, periodId, adaptationsetId, representationId, queryParameters) {
const pathParamMap = {
manifest_id: manifestId,
period_id: periodId,
adaptationset_id: adaptationsetId,
representation_id: representationId
};
let queryParams = {};
if (typeof queryParameters === 'function') {
queryParams = queryParameters(new ContentProtectionListQueryParams_1.ContentProtectionListQueryParamsBuilder()).buildQueryParams();
}
else if (queryParameters) {
queryParams = queryParameters;
}
return this.restClient.get('/encoding/manifests/dash/{manifest_id}/periods/{period_id}/adaptationsets/{adaptationset_id}/representations/webm/{representation_id}/contentprotection', pathParamMap, queryParams).then((response) => {
return new PaginationResponse_1.default(response, ContentProtection_1.default);
});
}
}
exports.default = ContentprotectionApi;