@bitmovin/api-sdk
Version:
Bitmovin JS/TS API SDK
143 lines (142 loc) • 6.23 kB
JavaScript
;
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 WebhooksApi_1 = require("./webhooks/WebhooksApi");
var StatesApi_1 = require("./states/StatesApi");
var EmailsApi_1 = require("./emails/EmailsApi");
var BitmovinResponse_1 = require("../models/BitmovinResponse");
var Notification_1 = require("../models/Notification");
var NotificationStateEntry_1 = require("../models/NotificationStateEntry");
var PaginationResponse_1 = require("../models/PaginationResponse");
var NotificationListQueryParams_1 = require("./NotificationListQueryParams");
var NotificationStateEntryListByNotificationIdQueryParams_1 = require("./NotificationStateEntryListByNotificationIdQueryParams");
/**
* NotificationsApi - object-oriented interface
* @export
* @class NotificationsApi
* @extends {BaseAPI}
*/
var NotificationsApi = /** @class */ (function (_super) {
__extends(NotificationsApi, _super);
function NotificationsApi(configuration) {
var _this = _super.call(this, configuration) || this;
_this.webhooks = new WebhooksApi_1.default(configuration);
_this.states = new StatesApi_1.default(configuration);
_this.emails = new EmailsApi_1.default(configuration);
return _this;
}
/**
* @summary Delete Notification
* @param {string} notificationId Id of the notification
* @throws {BitmovinError}
* @memberof NotificationsApi
*/
NotificationsApi.prototype.delete = function (notificationId) {
var pathParamMap = {
notification_id: notificationId
};
return this.restClient.delete('/notifications/{notification_id}', pathParamMap).then(function (response) {
return (0, Mapper_1.map)(response, BitmovinResponse_1.default);
});
};
/**
* @summary Get Notification
* @param {string} notificationId Id of the notification
* @throws {BitmovinError}
* @memberof NotificationsApi
*/
NotificationsApi.prototype.get = function (notificationId) {
var pathParamMap = {
notification_id: notificationId
};
return this.restClient.get('/notifications/{notification_id}', pathParamMap).then(function (response) {
return (0, Mapper_1.map)(response, Notification_1.default);
});
};
/**
* @summary List Notifications
* @param {*} [queryParameters] query parameters for filtering, sorting and pagination
* @throws {BitmovinError}
* @memberof NotificationsApi
*/
NotificationsApi.prototype.list = function (queryParameters) {
var queryParams = {};
if (typeof queryParameters === 'function') {
queryParams = queryParameters(new NotificationListQueryParams_1.NotificationListQueryParamsBuilder()).buildQueryParams();
}
else if (queryParameters) {
queryParams = queryParameters;
}
return this.restClient.get('/notifications', {}, queryParams).then(function (response) {
return new PaginationResponse_1.default(response, Notification_1.default);
});
};
/**
* @summary List Notification State History (All Resources)
* @param {string} notificationId Id of the notification
* @param {*} [queryParameters] query parameters for filtering, sorting and pagination
* @throws {BitmovinError}
* @memberof NotificationsApi
*/
NotificationsApi.prototype.listByNotificationId = function (notificationId, queryParameters) {
var pathParamMap = {
notification_id: notificationId
};
var queryParams = {};
if (typeof queryParameters === 'function') {
queryParams = queryParameters(new NotificationStateEntryListByNotificationIdQueryParams_1.NotificationStateEntryListByNotificationIdQueryParamsBuilder()).buildQueryParams();
}
else if (queryParameters) {
queryParams = queryParameters;
}
return this.restClient.get('/notifications/{notification_id}/states', pathParamMap, queryParams).then(function (response) {
return new PaginationResponse_1.default(response, NotificationStateEntry_1.default);
});
};
/**
* @summary Mute Notification
* @param {string} notificationId Id of the notification
* @throws {BitmovinError}
* @memberof NotificationsApi
*/
NotificationsApi.prototype.mute = function (notificationId) {
var pathParamMap = {
notification_id: notificationId
};
return this.restClient.post('/notifications/{notification_id}/mute', pathParamMap).then(function (response) {
return (0, Mapper_1.map)(response, BitmovinResponse_1.default);
});
};
/**
* @summary Unmute Notification
* @param {string} notificationId Id of the notification
* @throws {BitmovinError}
* @memberof NotificationsApi
*/
NotificationsApi.prototype.unmute = function (notificationId) {
var pathParamMap = {
notification_id: notificationId
};
return this.restClient.post('/notifications/{notification_id}/unmute', pathParamMap).then(function (response) {
return (0, Mapper_1.map)(response, BitmovinResponse_1.default);
});
};
return NotificationsApi;
}(BaseAPI_1.BaseAPI));
exports.default = NotificationsApi;