UNPKG

@bitmovin/api-sdk

Version:

Bitmovin JS/TS API SDK

100 lines (99 loc) 3.78 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const BaseAPI_1 = require("../../../../common/BaseAPI"); const Mapper_1 = require("../../../../common/Mapper"); const CustomdataApi_1 = require("./customdata/CustomdataApi"); const Bif_1 = require("../../../../models/Bif"); const BitmovinResponse_1 = require("../../../../models/BitmovinResponse"); const PaginationResponse_1 = require("../../../../models/PaginationResponse"); const BifListQueryParams_1 = require("./BifListQueryParams"); /** * BifsApi - object-oriented interface * @export * @class BifsApi * @extends {BaseAPI} */ class BifsApi extends BaseAPI_1.BaseAPI { constructor(configuration) { super(configuration); this.customdata = new CustomdataApi_1.default(configuration); } /** * @summary Add a Roku Bif file * @param {string} encodingId Id of the encoding. * @param {string} streamId Id of the stream. * @param {Bif} bif The Roku Bif file to be added * @throws {BitmovinError} * @memberof BifsApi */ create(encodingId, streamId, bif) { const pathParamMap = { encoding_id: encodingId, stream_id: streamId }; return this.restClient.post('/encoding/encodings/{encoding_id}/streams/{stream_id}/bifs', pathParamMap, bif).then((response) => { return (0, Mapper_1.map)(response, Bif_1.default); }); } /** * @summary Delete Bif * @param {string} encodingId Id of the encoding. * @param {string} streamId Id of the stream. * @param {string} bifId Id of the Bif. * @throws {BitmovinError} * @memberof BifsApi */ delete(encodingId, streamId, bifId) { const pathParamMap = { encoding_id: encodingId, stream_id: streamId, bif_id: bifId }; return this.restClient.delete('/encoding/encodings/{encoding_id}/streams/{stream_id}/bifs/{bif_id}', pathParamMap).then((response) => { return (0, Mapper_1.map)(response, BitmovinResponse_1.default); }); } /** * @summary Bif Details * @param {string} encodingId Id of the encoding. * @param {string} streamId Id of the stream. * @param {string} bifId Id of the Bif configuration. * @throws {BitmovinError} * @memberof BifsApi */ get(encodingId, streamId, bifId) { const pathParamMap = { encoding_id: encodingId, stream_id: streamId, bif_id: bifId }; return this.restClient.get('/encoding/encodings/{encoding_id}/streams/{stream_id}/bifs/{bif_id}', pathParamMap).then((response) => { return (0, Mapper_1.map)(response, Bif_1.default); }); } /** * @summary List Bifs * @param {string} encodingId Id of the encoding. * @param {string} streamId Id of the stream. * @param {*} [queryParameters] query parameters for filtering, sorting and pagination * @throws {BitmovinError} * @memberof BifsApi */ list(encodingId, streamId, queryParameters) { const pathParamMap = { encoding_id: encodingId, stream_id: streamId }; let queryParams = {}; if (typeof queryParameters === 'function') { queryParams = queryParameters(new BifListQueryParams_1.BifListQueryParamsBuilder()).buildQueryParams(); } else if (queryParameters) { queryParams = queryParameters; } return this.restClient.get('/encoding/encodings/{encoding_id}/streams/{stream_id}/bifs', pathParamMap, queryParams).then((response) => { return new PaginationResponse_1.default(response, Bif_1.default); }); } } exports.default = BifsApi;