@bitmovin/api-sdk
Version:
Bitmovin JS/TS API SDK
114 lines (113 loc) • 4.64 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 StopApi_1 = require("./stop/StopApi");
var StartApi_1 = require("./start/StartApi");
var StreamsLiveResponse_1 = require("../../models/StreamsLiveResponse");
var PaginationResponse_1 = require("../../models/PaginationResponse");
var StreamsLiveResponseListQueryParams_1 = require("./StreamsLiveResponseListQueryParams");
/**
* LiveApi - object-oriented interface
* @export
* @class LiveApi
* @extends {BaseAPI}
*/
var LiveApi = /** @class */ (function (_super) {
__extends(LiveApi, _super);
function LiveApi(configuration) {
var _this = _super.call(this, configuration) || this;
_this.stop = new StopApi_1.default(configuration);
_this.start = new StartApi_1.default(configuration);
return _this;
}
/**
* @summary Create new live stream
* @param {StreamsLiveCreateRequest} streamsLiveCreateRequest Create a new stream.
* @throws {BitmovinError}
* @memberof LiveApi
*/
LiveApi.prototype.create = function (streamsLiveCreateRequest) {
return this.restClient.post('/streams/live', {}, streamsLiveCreateRequest).then(function (response) {
return (0, Mapper_1.map)(response, StreamsLiveResponse_1.default);
});
};
/**
* @summary Delete Stream
* @param {string} streamId Id of the stream.
* @throws {BitmovinError}
* @memberof LiveApi
*/
LiveApi.prototype.delete = function (streamId) {
var pathParamMap = {
stream_id: streamId
};
return this.restClient.delete('/streams/live/{stream_id}', pathParamMap).then(function (response) {
return (0, Mapper_1.map)(response);
});
};
/**
* @summary Get live stream by id
* @param {string} streamId Id of the stream.
* @throws {BitmovinError}
* @memberof LiveApi
*/
LiveApi.prototype.get = function (streamId) {
var pathParamMap = {
stream_id: streamId
};
return this.restClient.get('/streams/live/{stream_id}', pathParamMap).then(function (response) {
return (0, Mapper_1.map)(response, StreamsLiveResponse_1.default);
});
};
/**
* @summary Get paginated list of live streams
* @param {*} [queryParameters] query parameters for filtering, sorting and pagination
* @throws {BitmovinError}
* @memberof LiveApi
*/
LiveApi.prototype.list = function (queryParameters) {
var queryParams = {};
if (typeof queryParameters === 'function') {
queryParams = queryParameters(new StreamsLiveResponseListQueryParams_1.StreamsLiveResponseListQueryParamsBuilder()).buildQueryParams();
}
else if (queryParameters) {
queryParams = queryParameters;
}
return this.restClient.get('/streams/live', {}, queryParams).then(function (response) {
return new PaginationResponse_1.default(response, StreamsLiveResponse_1.default);
});
};
/**
* @summary Partially update live stream by id
* @param {string} streamId Id of the stream.
* @param {StreamsLiveUpdateRequest} streamsLiveUpdateRequest Stream fields to update.
* @throws {BitmovinError}
* @memberof LiveApi
*/
LiveApi.prototype.patchStreamsLive = function (streamId, streamsLiveUpdateRequest) {
var pathParamMap = {
stream_id: streamId
};
return this.restClient.patch('/streams/live/{stream_id}', pathParamMap, streamsLiveUpdateRequest).then(function (response) {
return (0, Mapper_1.map)(response, StreamsLiveResponse_1.default);
});
};
return LiveApi;
}(BaseAPI_1.BaseAPI));
exports.default = LiveApi;