@bitmovin/api-sdk
Version:
Bitmovin JS/TS API SDK
98 lines (97 loc) • 4.02 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 ActionsApi_1 = require("./actions/ActionsApi");
var BitmovinResponse_1 = require("../../../models/BitmovinResponse");
var StreamKey_1 = require("../../../models/StreamKey");
var PaginationResponse_1 = require("../../../models/PaginationResponse");
var StreamKeyListQueryParams_1 = require("./StreamKeyListQueryParams");
/**
* StreamKeysApi - object-oriented interface
* @export
* @class StreamKeysApi
* @extends {BaseAPI}
*/
var StreamKeysApi = /** @class */ (function (_super) {
__extends(StreamKeysApi, _super);
function StreamKeysApi(configuration) {
var _this = _super.call(this, configuration) || this;
_this.actions = new ActionsApi_1.default(configuration);
return _this;
}
/**
* @summary Create new stream key
* @param {StreamKey} streamKey The stream key to be created
* @throws {BitmovinError}
* @memberof StreamKeysApi
*/
StreamKeysApi.prototype.create = function (streamKey) {
return this.restClient.post('/encoding/live/stream-keys', {}, streamKey).then(function (response) {
return (0, Mapper_1.map)(response, StreamKey_1.default);
});
};
/**
* @summary Delete Stream Key
* @param {string} streamKeyId Id of the stream key
* @throws {BitmovinError}
* @memberof StreamKeysApi
*/
StreamKeysApi.prototype.delete = function (streamKeyId) {
var pathParamMap = {
stream_key_id: streamKeyId
};
return this.restClient.delete('/encoding/live/stream-keys/{stream_key_id}', pathParamMap).then(function (response) {
return (0, Mapper_1.map)(response, BitmovinResponse_1.default);
});
};
/**
* @summary Stream Key details
* @param {string} streamKeyId Id of the stream key
* @throws {BitmovinError}
* @memberof StreamKeysApi
*/
StreamKeysApi.prototype.get = function (streamKeyId) {
var pathParamMap = {
stream_key_id: streamKeyId
};
return this.restClient.get('/encoding/live/stream-keys/{stream_key_id}', pathParamMap).then(function (response) {
return (0, Mapper_1.map)(response, StreamKey_1.default);
});
};
/**
* @summary List Stream Keys
* @param {*} [queryParameters] query parameters for filtering, sorting and pagination
* @throws {BitmovinError}
* @memberof StreamKeysApi
*/
StreamKeysApi.prototype.list = function (queryParameters) {
var queryParams = {};
if (typeof queryParameters === 'function') {
queryParams = queryParameters(new StreamKeyListQueryParams_1.StreamKeyListQueryParamsBuilder()).buildQueryParams();
}
else if (queryParameters) {
queryParams = queryParameters;
}
return this.restClient.get('/encoding/live/stream-keys', {}, queryParams).then(function (response) {
return new PaginationResponse_1.default(response, StreamKey_1.default);
});
};
return StreamKeysApi;
}(BaseAPI_1.BaseAPI));
exports.default = StreamKeysApi;