UNPKG

@bitmovin/api-sdk

Version:

Bitmovin JS/TS API SDK

94 lines (93 loc) 3.67 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const BaseAPI_1 = require("../../../../common/BaseAPI"); const Mapper_1 = require("../../../../common/Mapper"); const CustomTagsApi_1 = require("./customTags/CustomTagsApi"); const IframeApi_1 = require("./iframe/IframeApi"); const BitmovinResponse_1 = require("../../../../models/BitmovinResponse"); const StreamInfo_1 = require("../../../../models/StreamInfo"); const PaginationResponse_1 = require("../../../../models/PaginationResponse"); const StreamInfoListQueryParams_1 = require("./StreamInfoListQueryParams"); /** * StreamsApi - object-oriented interface * @export * @class StreamsApi * @extends {BaseAPI} */ class StreamsApi extends BaseAPI_1.BaseAPI { constructor(configuration) { super(configuration); this.customTags = new CustomTagsApi_1.default(configuration); this.iframe = new IframeApi_1.default(configuration); } /** * @summary Add Variant Stream * @param {string} manifestId Id of the hls manifest. * @param {StreamInfo} streamInfo The Variant Stream to be added * @throws {BitmovinError} * @memberof StreamsApi */ create(manifestId, streamInfo) { const pathParamMap = { manifest_id: manifestId }; return this.restClient.post('/encoding/manifests/hls/{manifest_id}/streams', pathParamMap, streamInfo).then((response) => { return (0, Mapper_1.map)(response, StreamInfo_1.default); }); } /** * @summary Delete Variant Stream * @param {string} manifestId Id of the hls manifest. * @param {string} streamId Id of the variant stream. * @throws {BitmovinError} * @memberof StreamsApi */ delete(manifestId, streamId) { const pathParamMap = { manifest_id: manifestId, stream_id: streamId }; return this.restClient.delete('/encoding/manifests/hls/{manifest_id}/streams/{stream_id}', pathParamMap).then((response) => { return (0, Mapper_1.map)(response, BitmovinResponse_1.default); }); } /** * @summary Variant Stream Details * @param {string} manifestId Id of the hls manifest. * @param {string} streamId Id of the variant stream. * @throws {BitmovinError} * @memberof StreamsApi */ get(manifestId, streamId) { const pathParamMap = { manifest_id: manifestId, stream_id: streamId }; return this.restClient.get('/encoding/manifests/hls/{manifest_id}/streams/{stream_id}', pathParamMap).then((response) => { return (0, Mapper_1.map)(response, StreamInfo_1.default); }); } /** * @summary List all Variant Streams * @param {string} manifestId Id of the hls manifest. * @param {*} [queryParameters] query parameters for filtering, sorting and pagination * @throws {BitmovinError} * @memberof StreamsApi */ list(manifestId, queryParameters) { const pathParamMap = { manifest_id: manifestId }; let queryParams = {}; if (typeof queryParameters === 'function') { queryParams = queryParameters(new StreamInfoListQueryParams_1.StreamInfoListQueryParamsBuilder()).buildQueryParams(); } else if (queryParameters) { queryParams = queryParameters; } return this.restClient.get('/encoding/manifests/hls/{manifest_id}/streams', pathParamMap, queryParams).then((response) => { return new PaginationResponse_1.default(response, StreamInfo_1.default); }); } } exports.default = StreamsApi;