@bitmovin/api-sdk
Version:
Bitmovin JS/TS API SDK
112 lines (111 loc) • 4.72 kB
JavaScript
;
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 CustomTagsApi_1 = require("./customTags/CustomTagsApi");
var IframeApi_1 = require("./iframe/IframeApi");
var BitmovinResponse_1 = require("../../../../models/BitmovinResponse");
var StreamInfo_1 = require("../../../../models/StreamInfo");
var PaginationResponse_1 = require("../../../../models/PaginationResponse");
var StreamInfoListQueryParams_1 = require("./StreamInfoListQueryParams");
/**
* StreamsApi - object-oriented interface
* @export
* @class StreamsApi
* @extends {BaseAPI}
*/
var StreamsApi = /** @class */ (function (_super) {
__extends(StreamsApi, _super);
function StreamsApi(configuration) {
var _this = _super.call(this, configuration) || this;
_this.customTags = new CustomTagsApi_1.default(configuration);
_this.iframe = new IframeApi_1.default(configuration);
return _this;
}
/**
* @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
*/
StreamsApi.prototype.create = function (manifestId, streamInfo) {
var pathParamMap = {
manifest_id: manifestId
};
return this.restClient.post('/encoding/manifests/hls/{manifest_id}/streams', pathParamMap, streamInfo).then(function (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
*/
StreamsApi.prototype.delete = function (manifestId, streamId) {
var pathParamMap = {
manifest_id: manifestId,
stream_id: streamId
};
return this.restClient.delete('/encoding/manifests/hls/{manifest_id}/streams/{stream_id}', pathParamMap).then(function (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
*/
StreamsApi.prototype.get = function (manifestId, streamId) {
var pathParamMap = {
manifest_id: manifestId,
stream_id: streamId
};
return this.restClient.get('/encoding/manifests/hls/{manifest_id}/streams/{stream_id}', pathParamMap).then(function (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
*/
StreamsApi.prototype.list = function (manifestId, queryParameters) {
var pathParamMap = {
manifest_id: manifestId
};
var 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(function (response) {
return new PaginationResponse_1.default(response, StreamInfo_1.default);
});
};
return StreamsApi;
}(BaseAPI_1.BaseAPI));
exports.default = StreamsApi;