UNPKG

@bitmovin/api-sdk

Version:

Bitmovin JS/TS API SDK

80 lines (79 loc) 3.38 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 CdnApi_1 = require("./cdn/CdnApi"); var DailyApi_1 = require("./daily/DailyApi"); var EncodingsApi_1 = require("./encodings/EncodingsApi"); var LabelsApi_1 = require("./labels/LabelsApi"); var Statistics_1 = require("../../models/Statistics"); var PaginationResponse_1 = require("../../models/PaginationResponse"); var StatisticsListQueryParams_1 = require("./StatisticsListQueryParams"); /** * StatisticsApi - object-oriented interface * @export * @class StatisticsApi * @extends {BaseAPI} */ var StatisticsApi = /** @class */ (function (_super) { __extends(StatisticsApi, _super); function StatisticsApi(configuration) { var _this = _super.call(this, configuration) || this; _this.cdn = new CdnApi_1.default(configuration); _this.daily = new DailyApi_1.default(configuration); _this.encodings = new EncodingsApi_1.default(configuration); _this.labels = new LabelsApi_1.default(configuration); return _this; } /** * @summary Show Overall Statistics * @throws {BitmovinError} * @memberof StatisticsApi */ StatisticsApi.prototype.get = function () { return this.restClient.get('/encoding/statistics', {}).then(function (response) { return (0, Mapper_1.map)(response, Statistics_1.default); }); }; /** * @summary Show Overall Statistics Within Specific Dates * @param {Date} from Start date, format: yyyy-MM-dd * @param {Date} to End date, format: yyyy-MM-dd * @param {*} [queryParameters] query parameters for filtering, sorting and pagination * @throws {BitmovinError} * @memberof StatisticsApi */ StatisticsApi.prototype.list = function (from, to, queryParameters) { var pathParamMap = { from: from, to: to }; var queryParams = {}; if (typeof queryParameters === 'function') { queryParams = queryParameters(new StatisticsListQueryParams_1.StatisticsListQueryParamsBuilder()).buildQueryParams(); } else if (queryParameters) { queryParams = queryParameters; } return this.restClient.get('/encoding/statistics/{from}/{to}', pathParamMap, queryParams).then(function (response) { return new PaginationResponse_1.default(response, Statistics_1.default); }); }; return StatisticsApi; }(BaseAPI_1.BaseAPI)); exports.default = StatisticsApi;