Skip to content

Commit 5d3ce1a

Browse files
Merge pull request #237 from apivideo/add-new-webhooks
Add new webhooks
2 parents 487d279 + 57babf9 commit 5d3ce1a

File tree

7 files changed

+61
-13
lines changed

7 files changed

+61
-13
lines changed

docs/api/WebhooksApi.md

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,17 @@ All URIs are relative to *https://ws.api.video*
1616

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

19-
* ```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.
19+
* `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.
2020

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

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

25-
* ```video.source.recorded``` This event occurs when a live stream is recorded and submitted for encoding.
25+
* `video.source.recorded` This event occurs when a live stream is recorded and submitted for encoding.
26+
27+
* `video.caption.generated` This event occurs when an automatic caption has been generated.
28+
29+
* `video.summary.generated` This event occurs when an automatic summary has been generated.
2630

2731
### Parameters
2832

docs/model/Webhook.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,22 @@ Name | Type | Description | Notes
77
------------ | ------------- | ------------- | -------------
88
**webhookId** | **string** | A unique identifier of the webhook you subscribed to. | [optional]
99
**createdAt** | **Date** | The time and date when you created this webhook subscription, in ATOM UTC format. | [optional]
10-
**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]
10+
**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]
1111
**url** | **string** | The URL where the API sends the webhook. | [optional]
1212
**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]
1313

1414

1515

16+
## Enum: Array<WebhookEventsEnum>
17+
18+
Name | Value
19+
---- | -----
20+
LiveStreamBroadcastStarted | 'live-stream.broadcast.started'
21+
LiveStreamBroadcastEnded | 'live-stream.broadcast.ended'
22+
VideoSourceRecorded | 'video.source.recorded'
23+
VideoEncodingQualityCompleted | 'video.encoding.quality.completed'
24+
VideoCaptionGenerated | 'video.caption.generated'
25+
VideoSummaryGenerated | 'video.summary.generated'
26+
27+
28+

docs/model/WebhooksCreationPayload.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,21 @@
55

66
Name | Type | Description | Notes
77
------------ | ------------- | ------------- | -------------
8-
**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. |
8+
**events** | [**Array<WebhooksCreationPayloadEventsEnum>**](#Array<WebhooksCreationPayloadEventsEnum>) | An array of webhook events that you want to subscribe to. |
99
**url** | **string** | The the url to which HTTP notifications are sent. It could be any http or https URL. |
1010

1111

1212

13+
## Enum: Array<WebhooksCreationPayloadEventsEnum>
14+
15+
Name | Value
16+
---- | -----
17+
LiveStreamBroadcastStarted | 'live-stream.broadcast.started'
18+
LiveStreamBroadcastEnded | 'live-stream.broadcast.ended'
19+
VideoSourceRecorded | 'video.source.recorded'
20+
VideoEncodingQualityCompleted | 'video.encoding.quality.completed'
21+
VideoCaptionGenerated | 'video.caption.generated'
22+
VideoSummaryGenerated | 'video.summary.generated'
23+
24+
25+

src/ObjectSerializer.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,8 @@ const enumsMap: Set<string> = new Set<string>([
135135
'VideoStatusIngestStatusEnum',
136136
'VideoUpdatePayloadLanguageEnum',
137137
'VideoUpdatePayloadTranscriptSummaryAttributesEnum',
138+
'WebhookEventsEnum',
139+
'WebhooksCreationPayloadEventsEnum',
138140
]);
139141

140142
const typeMap: { [index: string]: any } = {

src/api/WebhooksApi.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export default class WebhooksApi {
2727
}
2828

2929
/**
30-
* 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.
30+
* 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.
3131
* Create Webhook
3232
* @param webhooksCreationPayload
3333
*/
@@ -40,7 +40,7 @@ export default class WebhooksApi {
4040
}
4141

4242
/**
43-
* 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.
43+
* 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.
4444
* Create Webhook
4545
* @param webhooksCreationPayload
4646
*/

src/model/Webhook.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export default class Webhook {
2323
/**
2424
* A list of events that you subscribed to. When these events occur, the API triggers a webhook call to the URL you provided.
2525
*/
26-
'events'?: Array<string>;
26+
'events'?: Array<WebhookEventsEnum>;
2727
/**
2828
* The URL where the API sends the webhook.
2929
*/
@@ -51,7 +51,7 @@ export default class Webhook {
5151
{
5252
name: 'events',
5353
baseName: 'events',
54-
type: 'Array<string>',
54+
type: 'Array<WebhookEventsEnum>',
5555
format: '',
5656
},
5757
{
@@ -72,3 +72,11 @@ export default class Webhook {
7272
return Webhook.attributeTypeMap;
7373
}
7474
}
75+
76+
export type WebhookEventsEnum =
77+
| 'live-stream.broadcast.started'
78+
| 'live-stream.broadcast.ended'
79+
| 'video.source.recorded'
80+
| 'video.encoding.quality.completed'
81+
| 'video.caption.generated'
82+
| 'video.summary.generated';

src/model/WebhooksCreationPayload.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ import AttributeType from './AttributeType.js';
1313

1414
export default class WebhooksCreationPayload {
1515
/**
16-
* 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.
16+
* An array of webhook events that you want to subscribe to.
1717
*/
18-
'events': Array<string>;
18+
'events': Array<WebhooksCreationPayloadEventsEnum>;
1919
/**
2020
* The the url to which HTTP notifications are sent. It could be any http or https URL.
2121
*/
@@ -27,7 +27,7 @@ export default class WebhooksCreationPayload {
2727
{
2828
name: 'events',
2929
baseName: 'events',
30-
type: 'Array<string>',
30+
type: 'Array<WebhooksCreationPayloadEventsEnum>',
3131
format: '',
3232
},
3333
{
@@ -42,3 +42,11 @@ export default class WebhooksCreationPayload {
4242
return WebhooksCreationPayload.attributeTypeMap;
4343
}
4444
}
45+
46+
export type WebhooksCreationPayloadEventsEnum =
47+
| 'live-stream.broadcast.started'
48+
| 'live-stream.broadcast.ended'
49+
| 'video.source.recorded'
50+
| 'video.encoding.quality.completed'
51+
| 'video.caption.generated'
52+
| 'video.summary.generated';

0 commit comments

Comments
 (0)