UNPKG

@bitmovin/api-sdk

Version:

Bitmovin JS/TS API SDK

84 lines (83 loc) 3.28 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const BaseAPI_1 = require("../../common/BaseAPI"); const Mapper_1 = require("../../common/Mapper"); const AnalyticsApi_1 = require("./analytics/AnalyticsApi"); const DomainsApi_1 = require("./domains/DomainsApi"); const ThirdPartyLicensingApi_1 = require("./thirdPartyLicensing/ThirdPartyLicensingApi"); const PlayerLicense_1 = require("../../models/PlayerLicense"); const PaginationResponse_1 = require("../../models/PaginationResponse"); const PlayerLicenseListQueryParams_1 = require("./PlayerLicenseListQueryParams"); /** * LicensesApi - object-oriented interface * @export * @class LicensesApi * @extends {BaseAPI} */ class LicensesApi extends BaseAPI_1.BaseAPI { constructor(configuration) { super(configuration); this.analytics = new AnalyticsApi_1.default(configuration); this.domains = new DomainsApi_1.default(configuration); this.thirdPartyLicensing = new ThirdPartyLicensingApi_1.default(configuration); } /** * @summary Create Player License * @param {PlayerLicense} playerLicense Player License to be created * @throws {BitmovinError} * @memberof LicensesApi */ create(playerLicense) { return this.restClient.post('/player/licenses', {}, playerLicense).then((response) => { return (0, Mapper_1.map)(response, PlayerLicense_1.default); }); } /** * @summary Get License * @param {string} licenseId ID of the License * @throws {BitmovinError} * @memberof LicensesApi */ get(licenseId) { const pathParamMap = { license_id: licenseId }; return this.restClient.get('/player/licenses/{license_id}', pathParamMap).then((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 */ list(queryParameters) { let 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((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 */ update(licenseId, playerLicenseUpdateRequest) { const pathParamMap = { license_id: licenseId }; return this.restClient.put('/player/licenses/{license_id}', pathParamMap, playerLicenseUpdateRequest).then((response) => { return (0, Mapper_1.map)(response, PlayerLicense_1.default); }); } } exports.default = LicensesApi;