UNPKG

@bitmovin/api-sdk

Version:

Bitmovin JS/TS API SDK

102 lines (101 loc) 4.34 kB
"use strict"; 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 AnalyticsApi_1 = require("./analytics/AnalyticsApi"); var DomainsApi_1 = require("./domains/DomainsApi"); var ThirdPartyLicensingApi_1 = require("./thirdPartyLicensing/ThirdPartyLicensingApi"); var PlayerLicense_1 = require("../../models/PlayerLicense"); var PaginationResponse_1 = require("../../models/PaginationResponse"); var PlayerLicenseListQueryParams_1 = require("./PlayerLicenseListQueryParams"); /** * LicensesApi - object-oriented interface * @export * @class LicensesApi * @extends {BaseAPI} */ var LicensesApi = /** @class */ (function (_super) { __extends(LicensesApi, _super); function LicensesApi(configuration) { var _this = _super.call(this, configuration) || this; _this.analytics = new AnalyticsApi_1.default(configuration); _this.domains = new DomainsApi_1.default(configuration); _this.thirdPartyLicensing = new ThirdPartyLicensingApi_1.default(configuration); return _this; } /** * @summary Create Player License * @param {PlayerLicense} playerLicense Player License to be created * @throws {BitmovinError} * @memberof LicensesApi */ LicensesApi.prototype.create = function (playerLicense) { return this.restClient.post('/player/licenses', {}, playerLicense).then(function (response) { return (0, Mapper_1.map)(response, PlayerLicense_1.default); }); }; /** * @summary Get License * @param {string} licenseId ID of the License * @throws {BitmovinError} * @memberof LicensesApi */ LicensesApi.prototype.get = function (licenseId) { var pathParamMap = { license_id: licenseId }; return this.restClient.get('/player/licenses/{license_id}', pathParamMap).then(function (response) { return (0, Mapper_1.map)(response, PlayerLicense_1.default); }); }; /** * @summary List Player Licenses * @param {*} [queryParameters] query parameters for filtering, sorting and pagination * @throws {BitmovinError} * @memberof LicensesApi */ LicensesApi.prototype.list = function (queryParameters) { var queryParams = {}; if (typeof queryParameters === 'function') { queryParams = queryParameters(new PlayerLicenseListQueryParams_1.PlayerLicenseListQueryParamsBuilder()).buildQueryParams(); } else if (queryParameters) { queryParams = queryParameters; } return this.restClient.get('/player/licenses', {}, queryParams).then(function (response) { return new PaginationResponse_1.default(response, PlayerLicense_1.default); }); }; /** * @summary Update License * @param {string} licenseId License id * @param {PlayerLicenseUpdateRequest} playerLicenseUpdateRequest Player License details to be updated * @throws {BitmovinError} * @memberof LicensesApi */ LicensesApi.prototype.update = function (licenseId, playerLicenseUpdateRequest) { var pathParamMap = { license_id: licenseId }; return this.restClient.put('/player/licenses/{license_id}', pathParamMap, playerLicenseUpdateRequest).then(function (response) { return (0, Mapper_1.map)(response, PlayerLicense_1.default); }); }; return LicensesApi; }(BaseAPI_1.BaseAPI)); exports.default = LicensesApi;