UNPKG

@bitmovin/api-sdk

Version:

Bitmovin JS/TS API SDK

168 lines (167 loc) 7.35 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 CustomdataApi_1 = require("./customdata/CustomdataApi"); var BitmovinResponse_1 = require("../../../../../models/BitmovinResponse"); var Webhook_1 = require("../../../../../models/Webhook"); var PaginationResponse_1 = require("../../../../../models/PaginationResponse"); var WebhookListQueryParams_1 = require("./WebhookListQueryParams"); var WebhookListByEncodingIdQueryParams_1 = require("./WebhookListByEncodingIdQueryParams"); /** * ErrorApi - object-oriented interface * @export * @class ErrorApi * @extends {BaseAPI} */ var ErrorApi = /** @class */ (function (_super) { __extends(ErrorApi, _super); function ErrorApi(configuration) { var _this = _super.call(this, configuration) || this; _this.customdata = new CustomdataApi_1.default(configuration); return _this; } /** * @summary Add 'Encoding Error' Webhook * @param {Webhook} webhook The 'Encoding Error' Webhook to be added. * @throws {BitmovinError} * @memberof ErrorApi */ ErrorApi.prototype.create = function (webhook) { return this.restClient.post('/notifications/webhooks/encoding/encodings/error', {}, webhook).then(function (response) { return (0, Mapper_1.map)(response, Webhook_1.default); }); }; /** * @summary Add Error Webhook for a specific Encoding * @param {string} encodingId Id of the encoding * @param {Webhook} webhook The 'Encoding Error' Webhook to be added. A maximum number of 5 webhooks per Encoding is allowed * @throws {BitmovinError} * @memberof ErrorApi */ ErrorApi.prototype.createByEncodingId = function (encodingId, webhook) { var pathParamMap = { encoding_id: encodingId }; return this.restClient.post('/notifications/webhooks/encoding/encodings/{encoding_id}/error', pathParamMap, webhook).then(function (response) { return (0, Mapper_1.map)(response, Webhook_1.default); }); }; /** * @summary Delete 'Encoding Error' Webhook for a specific Encoding * @param {string} encodingId Id of the encoding * @param {string} webhookId Id of the webhook * @throws {BitmovinError} * @memberof ErrorApi */ ErrorApi.prototype.deleteByEncodingIdAndWebhookId = function (encodingId, webhookId) { var pathParamMap = { encoding_id: encodingId, webhook_id: webhookId }; return this.restClient.delete('/notifications/webhooks/encoding/encodings/{encoding_id}/error/{webhook_id}', pathParamMap).then(function (response) { return (0, Mapper_1.map)(response, BitmovinResponse_1.default); }); }; /** * @summary Delete 'Encoding Error' Webhook * @param {string} webhookId Id of the webhook * @throws {BitmovinError} * @memberof ErrorApi */ ErrorApi.prototype.deleteByWebhookId = function (webhookId) { var pathParamMap = { webhook_id: webhookId }; return this.restClient.delete('/notifications/webhooks/encoding/encodings/error/{webhook_id}', pathParamMap).then(function (response) { return (0, Mapper_1.map)(response, BitmovinResponse_1.default); }); }; /** * @summary 'Encoding Error' Webhook Details for a specific Encoding * @param {string} encodingId Id of the encoding * @param {string} webhookId Id of the webhook * @throws {BitmovinError} * @memberof ErrorApi */ ErrorApi.prototype.getByEncodingIdAndWebhookId = function (encodingId, webhookId) { var pathParamMap = { encoding_id: encodingId, webhook_id: webhookId }; return this.restClient.get('/notifications/webhooks/encoding/encodings/{encoding_id}/error/{webhook_id}', pathParamMap).then(function (response) { return (0, Mapper_1.map)(response, Webhook_1.default); }); }; /** * @summary 'Encoding Error' Webhook Details * @param {string} webhookId Id of the webhook * @throws {BitmovinError} * @memberof ErrorApi */ ErrorApi.prototype.getByWebhookId = function (webhookId) { var pathParamMap = { webhook_id: webhookId }; return this.restClient.get('/notifications/webhooks/encoding/encodings/error/{webhook_id}', pathParamMap).then(function (response) { return (0, Mapper_1.map)(response, Webhook_1.default); }); }; /** * @summary List 'Encoding Error' Webhooks * @param {*} [queryParameters] query parameters for filtering, sorting and pagination * @throws {BitmovinError} * @memberof ErrorApi */ ErrorApi.prototype.list = function (queryParameters) { var queryParams = {}; if (typeof queryParameters === 'function') { queryParams = queryParameters(new WebhookListQueryParams_1.WebhookListQueryParamsBuilder()).buildQueryParams(); } else if (queryParameters) { queryParams = queryParameters; } return this.restClient.get('/notifications/webhooks/encoding/encodings/error', {}, queryParams).then(function (response) { return new PaginationResponse_1.default(response, Webhook_1.default); }); }; /** * @summary List 'Encoding Error' Webhooks for a specific Encoding * @param {string} encodingId Id of the encoding * @param {*} [queryParameters] query parameters for filtering, sorting and pagination * @throws {BitmovinError} * @memberof ErrorApi */ ErrorApi.prototype.listByEncodingId = function (encodingId, queryParameters) { var pathParamMap = { encoding_id: encodingId }; var queryParams = {}; if (typeof queryParameters === 'function') { queryParams = queryParameters(new WebhookListByEncodingIdQueryParams_1.WebhookListByEncodingIdQueryParamsBuilder()).buildQueryParams(); } else if (queryParameters) { queryParams = queryParameters; } return this.restClient.get('/notifications/webhooks/encoding/encodings/{encoding_id}/error', pathParamMap, queryParams).then(function (response) { return new PaginationResponse_1.default(response, Webhook_1.default); }); }; return ErrorApi; }(BaseAPI_1.BaseAPI)); exports.default = ErrorApi;