@bitmovin/api-sdk
Version:
Bitmovin JS/TS API SDK
90 lines (89 loc) • 3.76 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 ClosedCaptionsMediaInfo_1 = require("../../../../../models/ClosedCaptionsMediaInfo");
const PaginationResponse_1 = require("../../../../../models/PaginationResponse");
const ClosedCaptionsMediaInfoListQueryParams_1 = require("./ClosedCaptionsMediaInfoListQueryParams");
/**
* ClosedCaptionsApi - object-oriented interface
* @export
* @class ClosedCaptionsApi
* @extends {BaseAPI}
*/
class ClosedCaptionsApi extends BaseAPI_1.BaseAPI {
constructor(configuration) {
super(configuration);
}
/**
* @summary Add Closed Captions Media
* @param {string} manifestId Id of the hls manifest.
* @param {ClosedCaptionsMediaInfo} closedCaptionsMediaInfo The Closed Captions Media to be added
* @throws {BitmovinError}
* @memberof ClosedCaptionsApi
*/
create(manifestId, closedCaptionsMediaInfo) {
const pathParamMap = {
manifest_id: manifestId
};
return this.restClient.post('/encoding/manifests/hls/{manifest_id}/media/closed-captions', pathParamMap, closedCaptionsMediaInfo).then((response) => {
return (0, Mapper_1.map)(response, ClosedCaptionsMediaInfo_1.default);
});
}
/**
* @summary Delete Closed Captions Media
* @param {string} manifestId Id of the hls manifest.
* @param {string} mediaId Id of the closed captions media.
* @throws {BitmovinError}
* @memberof ClosedCaptionsApi
*/
delete(manifestId, mediaId) {
const pathParamMap = {
manifest_id: manifestId,
media_id: mediaId
};
return this.restClient.delete('/encoding/manifests/hls/{manifest_id}/media/closed-captions/{media_id}', pathParamMap).then((response) => {
return (0, Mapper_1.map)(response, BitmovinResponse_1.default);
});
}
/**
* @summary Closed Captions Media Details
* @param {string} manifestId Id of the hls manifest.
* @param {string} mediaId Id of the closed captions media.
* @throws {BitmovinError}
* @memberof ClosedCaptionsApi
*/
get(manifestId, mediaId) {
const pathParamMap = {
manifest_id: manifestId,
media_id: mediaId
};
return this.restClient.get('/encoding/manifests/hls/{manifest_id}/media/closed-captions/{media_id}', pathParamMap).then((response) => {
return (0, Mapper_1.map)(response, ClosedCaptionsMediaInfo_1.default);
});
}
/**
* @summary List all Closed Captions Media
* @param {string} manifestId Id of the hls manifest.
* @param {*} [queryParameters] query parameters for filtering, sorting and pagination
* @throws {BitmovinError}
* @memberof ClosedCaptionsApi
*/
list(manifestId, queryParameters) {
const pathParamMap = {
manifest_id: manifestId
};
let queryParams = {};
if (typeof queryParameters === 'function') {
queryParams = queryParameters(new ClosedCaptionsMediaInfoListQueryParams_1.ClosedCaptionsMediaInfoListQueryParamsBuilder()).buildQueryParams();
}
else if (queryParameters) {
queryParams = queryParameters;
}
return this.restClient.get('/encoding/manifests/hls/{manifest_id}/media/closed-captions', pathParamMap, queryParams).then((response) => {
return new PaginationResponse_1.default(response, ClosedCaptionsMediaInfo_1.default);
});
}
}
exports.default = ClosedCaptionsApi;