Skip to content

Commit

Permalink
Merge pull request #237 from apivideo/add-new-webhooks
Browse files Browse the repository at this point in the history
Add new webhooks
  • Loading branch information
bot-api-video authored Nov 13, 2024
2 parents 487d279 + 57babf9 commit 5d3ce1a
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 13 deletions.
12 changes: 8 additions & 4 deletions docs/api/WebhooksApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,17 @@ All URIs are relative to *https://ws.api.video*

Webhooks can push notifications to your server, rather than polling api.video for changes. We currently offer four events:

* ```video.encoding.quality.completed``` Occurs when a new video is uploaded into your account, it will be encoded into several different HLS and mp4 qualities. When each version is encoded, your webhook will get a notification. It will look like ```{ "type": "video.encoding.quality.completed", "emittedAt": "2021-01-29T16:46:25.217+01:00", "videoId": "viXXXXXXXX", "encoding": "hls", "quality": "720p"} ```. This request says that the 720p HLS encoding was completed.
* `video.encoding.quality.completed` Occurs when a new video is uploaded into your account, it will be encoded into several different HLS and mp4 qualities. When each version is encoded, your webhook will get a notification. It will look like ```{ "type": "video.encoding.quality.completed", "emittedAt": "2021-01-29T16:46:25.217+01:00", "videoId": "viXXXXXXXX", "encoding": "hls", "quality": "720p"} ```. This request says that the 720p HLS encoding was completed.

* ```live-stream.broadcast.started``` When a live stream begins broadcasting, the broadcasting parameter changes from false to true, and this webhook fires.
* `live-stream.broadcast.started` When a live stream begins broadcasting, the broadcasting parameter changes from false to true, and this webhook fires.

* ```live-stream.broadcast.ended``` This event fires when a live stream has finished broadcasting.
* `live-stream.broadcast.ended` This event fires when a live stream has finished broadcasting.

* ```video.source.recorded``` This event occurs when a live stream is recorded and submitted for encoding.
* `video.source.recorded` This event occurs when a live stream is recorded and submitted for encoding.

* `video.caption.generated` This event occurs when an automatic caption has been generated.

* `video.summary.generated` This event occurs when an automatic summary has been generated.

### Parameters

Expand Down
15 changes: 14 additions & 1 deletion docs/model/Webhook.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,22 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**webhookId** | **string** | A unique identifier of the webhook you subscribed to. | [optional]
**createdAt** | **Date** | The time and date when you created this webhook subscription, in ATOM UTC format. | [optional]
**events** | **Array<string>** | A list of events that you subscribed to. When these events occur, the API triggers a webhook call to the URL you provided. | [optional]
**events** | [**Array<WebhookEventsEnum>**](#Array<WebhookEventsEnum>) | A list of events that you subscribed to. When these events occur, the API triggers a webhook call to the URL you provided. | [optional]
**url** | **string** | The URL where the API sends the webhook. | [optional]
**signatureSecret** | **string** | A secret key for the webhook you subscribed to. You can use it to verify the origin of the webhook call that you receive. | [optional]



## Enum: Array<WebhookEventsEnum>

Name | Value
---- | -----
LiveStreamBroadcastStarted | 'live-stream.broadcast.started'
LiveStreamBroadcastEnded | 'live-stream.broadcast.ended'
VideoSourceRecorded | 'video.source.recorded'
VideoEncodingQualityCompleted | 'video.encoding.quality.completed'
VideoCaptionGenerated | 'video.caption.generated'
VideoSummaryGenerated | 'video.summary.generated'



15 changes: 14 additions & 1 deletion docs/model/WebhooksCreationPayload.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,21 @@

Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**events** | **Array<string>** | A list of the webhooks that you are subscribing to. There are Currently four webhook options: * ```video.encoding.quality.completed``` Occurs when a new video is uploaded into your account, it will be encoded into several different HLS and mp4 qualities. When each version is encoded, your webhook will get a notification. It will look like ```{ \\\"type\\\": \\\"video.encoding.quality.completed\\\", \\\"emittedAt\\\": \\\"2021-01-29T16:46:25.217+01:00\\\", \\\"videoId\\\": \\\"viXXXXXXXX\\\", \\\"encoding\\\": \\\"hls\\\", \\\"quality\\\": \\\"720p\\\"} ```. This request says that the 720p HLS encoding was completed. * ```live-stream.broadcast.started``` When a live stream begins broadcasting, the broadcasting parameter changes from false to true, and this webhook fires. * ```live-stream.broadcast.ended``` This event fires when a live stream has finished broadcasting. * ```video.source.recorded``` Occurs when a live stream is recorded and submitted for encoding. |
**events** | [**Array<WebhooksCreationPayloadEventsEnum>**](#Array<WebhooksCreationPayloadEventsEnum>) | An array of webhook events that you want to subscribe to. |
**url** | **string** | The the url to which HTTP notifications are sent. It could be any http or https URL. |



## Enum: Array<WebhooksCreationPayloadEventsEnum>

Name | Value
---- | -----
LiveStreamBroadcastStarted | 'live-stream.broadcast.started'
LiveStreamBroadcastEnded | 'live-stream.broadcast.ended'
VideoSourceRecorded | 'video.source.recorded'
VideoEncodingQualityCompleted | 'video.encoding.quality.completed'
VideoCaptionGenerated | 'video.caption.generated'
VideoSummaryGenerated | 'video.summary.generated'



2 changes: 2 additions & 0 deletions src/ObjectSerializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,8 @@ const enumsMap: Set<string> = new Set<string>([
'VideoStatusIngestStatusEnum',
'VideoUpdatePayloadLanguageEnum',
'VideoUpdatePayloadTranscriptSummaryAttributesEnum',
'WebhookEventsEnum',
'WebhooksCreationPayloadEventsEnum',
]);

const typeMap: { [index: string]: any } = {
Expand Down
4 changes: 2 additions & 2 deletions src/api/WebhooksApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default class WebhooksApi {
}

/**
* Webhooks can push notifications to your server, rather than polling api.video for changes. We currently offer four events: * ```video.encoding.quality.completed``` Occurs when a new video is uploaded into your account, it will be encoded into several different HLS and mp4 qualities. When each version is encoded, your webhook will get a notification. It will look like ```{ \"type\": \"video.encoding.quality.completed\", \"emittedAt\": \"2021-01-29T16:46:25.217+01:00\", \"videoId\": \"viXXXXXXXX\", \"encoding\": \"hls\", \"quality\": \"720p\"} ```. This request says that the 720p HLS encoding was completed. * ```live-stream.broadcast.started``` When a live stream begins broadcasting, the broadcasting parameter changes from false to true, and this webhook fires. * ```live-stream.broadcast.ended``` This event fires when a live stream has finished broadcasting. * ```video.source.recorded``` This event occurs when a live stream is recorded and submitted for encoding.
* Webhooks can push notifications to your server, rather than polling api.video for changes. We currently offer four events: * `video.encoding.quality.completed` Occurs when a new video is uploaded into your account, it will be encoded into several different HLS and mp4 qualities. When each version is encoded, your webhook will get a notification. It will look like ```{ \"type\": \"video.encoding.quality.completed\", \"emittedAt\": \"2021-01-29T16:46:25.217+01:00\", \"videoId\": \"viXXXXXXXX\", \"encoding\": \"hls\", \"quality\": \"720p\"} ```. This request says that the 720p HLS encoding was completed. * `live-stream.broadcast.started` When a live stream begins broadcasting, the broadcasting parameter changes from false to true, and this webhook fires. * `live-stream.broadcast.ended` This event fires when a live stream has finished broadcasting. * `video.source.recorded` This event occurs when a live stream is recorded and submitted for encoding. * `video.caption.generated` This event occurs when an automatic caption has been generated. * `video.summary.generated` This event occurs when an automatic summary has been generated.
* Create Webhook
* @param webhooksCreationPayload
*/
Expand All @@ -40,7 +40,7 @@ export default class WebhooksApi {
}

/**
* Webhooks can push notifications to your server, rather than polling api.video for changes. We currently offer four events: * ```video.encoding.quality.completed``` Occurs when a new video is uploaded into your account, it will be encoded into several different HLS and mp4 qualities. When each version is encoded, your webhook will get a notification. It will look like ```{ \"type\": \"video.encoding.quality.completed\", \"emittedAt\": \"2021-01-29T16:46:25.217+01:00\", \"videoId\": \"viXXXXXXXX\", \"encoding\": \"hls\", \"quality\": \"720p\"} ```. This request says that the 720p HLS encoding was completed. * ```live-stream.broadcast.started``` When a live stream begins broadcasting, the broadcasting parameter changes from false to true, and this webhook fires. * ```live-stream.broadcast.ended``` This event fires when a live stream has finished broadcasting. * ```video.source.recorded``` This event occurs when a live stream is recorded and submitted for encoding.
* Webhooks can push notifications to your server, rather than polling api.video for changes. We currently offer four events: * `video.encoding.quality.completed` Occurs when a new video is uploaded into your account, it will be encoded into several different HLS and mp4 qualities. When each version is encoded, your webhook will get a notification. It will look like ```{ \"type\": \"video.encoding.quality.completed\", \"emittedAt\": \"2021-01-29T16:46:25.217+01:00\", \"videoId\": \"viXXXXXXXX\", \"encoding\": \"hls\", \"quality\": \"720p\"} ```. This request says that the 720p HLS encoding was completed. * `live-stream.broadcast.started` When a live stream begins broadcasting, the broadcasting parameter changes from false to true, and this webhook fires. * `live-stream.broadcast.ended` This event fires when a live stream has finished broadcasting. * `video.source.recorded` This event occurs when a live stream is recorded and submitted for encoding. * `video.caption.generated` This event occurs when an automatic caption has been generated. * `video.summary.generated` This event occurs when an automatic summary has been generated.
* Create Webhook
* @param webhooksCreationPayload
*/
Expand Down
12 changes: 10 additions & 2 deletions src/model/Webhook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default class Webhook {
/**
* A list of events that you subscribed to. When these events occur, the API triggers a webhook call to the URL you provided.
*/
'events'?: Array<string>;
'events'?: Array<WebhookEventsEnum>;
/**
* The URL where the API sends the webhook.
*/
Expand Down Expand Up @@ -51,7 +51,7 @@ export default class Webhook {
{
name: 'events',
baseName: 'events',
type: 'Array<string>',
type: 'Array<WebhookEventsEnum>',
format: '',
},
{
Expand All @@ -72,3 +72,11 @@ export default class Webhook {
return Webhook.attributeTypeMap;
}
}

export type WebhookEventsEnum =
| 'live-stream.broadcast.started'
| 'live-stream.broadcast.ended'
| 'video.source.recorded'
| 'video.encoding.quality.completed'
| 'video.caption.generated'
| 'video.summary.generated';
14 changes: 11 additions & 3 deletions src/model/WebhooksCreationPayload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ import AttributeType from './AttributeType.js';

export default class WebhooksCreationPayload {
/**
* A list of the webhooks that you are subscribing to. There are Currently four webhook options: * ```video.encoding.quality.completed``` Occurs when a new video is uploaded into your account, it will be encoded into several different HLS and mp4 qualities. When each version is encoded, your webhook will get a notification. It will look like ```{ \\\"type\\\": \\\"video.encoding.quality.completed\\\", \\\"emittedAt\\\": \\\"2021-01-29T16:46:25.217+01:00\\\", \\\"videoId\\\": \\\"viXXXXXXXX\\\", \\\"encoding\\\": \\\"hls\\\", \\\"quality\\\": \\\"720p\\\"} ```. This request says that the 720p HLS encoding was completed. * ```live-stream.broadcast.started``` When a live stream begins broadcasting, the broadcasting parameter changes from false to true, and this webhook fires. * ```live-stream.broadcast.ended``` This event fires when a live stream has finished broadcasting. * ```video.source.recorded``` Occurs when a live stream is recorded and submitted for encoding.
* An array of webhook events that you want to subscribe to.
*/
'events': Array<string>;
'events': Array<WebhooksCreationPayloadEventsEnum>;
/**
* The the url to which HTTP notifications are sent. It could be any http or https URL.
*/
Expand All @@ -27,7 +27,7 @@ export default class WebhooksCreationPayload {
{
name: 'events',
baseName: 'events',
type: 'Array<string>',
type: 'Array<WebhooksCreationPayloadEventsEnum>',
format: '',
},
{
Expand All @@ -42,3 +42,11 @@ export default class WebhooksCreationPayload {
return WebhooksCreationPayload.attributeTypeMap;
}
}

export type WebhooksCreationPayloadEventsEnum =
| 'live-stream.broadcast.started'
| 'live-stream.broadcast.ended'
| 'video.source.recorded'
| 'video.encoding.quality.completed'
| 'video.caption.generated'
| 'video.summary.generated';

0 comments on commit 5d3ce1a

Please sign in to comment.