@bitmovin/api-sdk
Version:
Bitmovin JS/TS API SDK
74 lines (73 loc) • 5.37 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const BaseAPI_1 = require("../../../../../common/BaseAPI");
const Mapper_1 = require("../../../../../common/Mapper");
const BitmovinResponse_1 = require("../../../../../models/BitmovinResponse");
const WebhookNotificationWithStreamConditions_1 = require("../../../../../models/WebhookNotificationWithStreamConditions");
/**
* EncodingStatusChangedApi - object-oriented interface
* @export
* @class EncodingStatusChangedApi
* @extends {BaseAPI}
*/
class EncodingStatusChangedApi extends BaseAPI_1.BaseAPI {
constructor(configuration) {
super(configuration);
}
/**
* @summary Add Encoding Changed Webhook Notification (All Encodings)
* @param {WebhookNotificationWithStreamConditionsRequest} webhookNotificationWithStreamConditionsRequest The webhook notifications object. For conditions, following attributes are possible: 'type': 'Input file download', 'Input file analysis', 'Per-Title analysis', 'Encoding', 'Progressive Muxing' 'progress': number in range of 0-100 'status': 'RUNNING', 'FINISHED', 'ERROR' Examples: To only get notified about the encoding process, create a Condition object and set attribute='type', value='Encoding', operator=EQUAL To only get notified if a workflow step is finished, create a Condition object and set attribute='status', value='FINISHED', operator=EQUAL To only get notified if a workflow step is over 50%, create a Condition object and set attribute='progress', value='50', operator=GREATER_THAN
* @throws {BitmovinError}
* @memberof EncodingStatusChangedApi
*/
create(webhookNotificationWithStreamConditionsRequest) {
return this.restClient.post('/notifications/webhooks/encoding/encodings/encoding-status-changed', {}, webhookNotificationWithStreamConditionsRequest).then((response) => {
return (0, Mapper_1.map)(response, WebhookNotificationWithStreamConditions_1.default);
});
}
/**
* @summary Add Encoding Changed Webhook Notification (Specific Encoding)
* @param {string} encodingId Id of the encoding resource
* @param {WebhookNotificationWithStreamConditionsRequest} webhookNotificationWithStreamConditionsRequest The webhook notifications object. For conditions, following attributes are possible: 'type': 'Input file download', 'Input file analysis', 'Per-Title analysis', 'Encoding', 'Progressive Muxing' 'progress': number in range of 0-100 'status': 'RUNNING', 'FINISHED', 'ERROR' Examples: To only get notified about the encoding process, create a Condition object and set attribute='type', value='Encoding', operator=EQUAL To only get notified if a workflow step is finished, create a Condition object and set attribute='status', value='FINISHED', operator=EQUAL To only get notified if a workflow step is over 50%, create a Condition object and set attribute='progress', value='50', operator=GREATER_THAN
* @throws {BitmovinError}
* @memberof EncodingStatusChangedApi
*/
createByEncodingId(encodingId, webhookNotificationWithStreamConditionsRequest) {
const pathParamMap = {
encoding_id: encodingId
};
return this.restClient.post('/notifications/webhooks/encoding/encodings/{encoding_id}/encoding-status-changed', pathParamMap, webhookNotificationWithStreamConditionsRequest).then((response) => {
return (0, Mapper_1.map)(response, WebhookNotificationWithStreamConditions_1.default);
});
}
/**
* @summary Delete Encoding Status Changed Webhook
* @param {string} notificationId Id of the webhook
* @throws {BitmovinError}
* @memberof EncodingStatusChangedApi
*/
deleteByWebhookId(notificationId) {
const pathParamMap = {
notification_id: notificationId
};
return this.restClient.delete('/notifications/webhooks/encoding/encodings/encoding-status-changed/{notification_id}', pathParamMap).then((response) => {
return (0, Mapper_1.map)(response, BitmovinResponse_1.default);
});
}
/**
* @summary Replace Encoding Status Changed Webhook Notification
* @param {string} notificationId Id of the webhook notification
* @param {WebhookNotificationWithStreamConditionsRequest} webhookNotificationWithStreamConditionsRequest The webhook notification with the updated values
* @throws {BitmovinError}
* @memberof EncodingStatusChangedApi
*/
update(notificationId, webhookNotificationWithStreamConditionsRequest) {
const pathParamMap = {
notification_id: notificationId
};
return this.restClient.put('/notifications/webhooks/encoding/encodings/encoding-status-changed/{notification_id}', pathParamMap, webhookNotificationWithStreamConditionsRequest).then((response) => {
return (0, Mapper_1.map)(response, WebhookNotificationWithStreamConditions_1.default);
});
}
}
exports.default = EncodingStatusChangedApi;