Skip to content

Commit

Permalink
Merge pull request #108 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 b30eb19 + 5509f53 commit e7c3822
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 4 deletions.
2 changes: 1 addition & 1 deletion apivideo/api/webhooks_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def create(
):
"""Create Webhook # noqa: E501
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. # noqa: E501
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. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
Expand Down
8 changes: 8 additions & 0 deletions apivideo/model/webhook.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@ class Webhook(ModelNormal):
"""

allowed_values = {
('events',): {
'LIVE-STREAM.BROADCAST.STARTED': "live-stream.broadcast.started",
'LIVE-STREAM.BROADCAST.ENDED': "live-stream.broadcast.ended",
'VIDEO.SOURCE.RECORDED': "video.source.recorded",
'VIDEO.ENCODING.QUALITY.COMPLETED': "video.encoding.quality.completed",
'VIDEO.CAPTION.GENERATED': "video.caption.generated",
'VIDEO.SUMMARY.GENERATED': "video.summary.generated",
},
}

validations = {
Expand Down
10 changes: 9 additions & 1 deletion apivideo/model/webhooks_creation_payload.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@ class WebhooksCreationPayload(ModelNormal):
"""

allowed_values = {
('events',): {
'LIVE-STREAM.BROADCAST.STARTED': "live-stream.broadcast.started",
'LIVE-STREAM.BROADCAST.ENDED': "live-stream.broadcast.ended",
'VIDEO.SOURCE.RECORDED': "video.source.recorded",
'VIDEO.ENCODING.QUALITY.COMPLETED': "video.encoding.quality.completed",
'VIDEO.CAPTION.GENERATED': "video.caption.generated",
'VIDEO.SUMMARY.GENERATED': "video.summary.generated",
},
}

validations = {
Expand Down Expand Up @@ -101,7 +109,7 @@ def __init__(self, events, url, *args, **kwargs): # noqa: E501
"""WebhooksCreationPayload - a model defined in OpenAPI
Args:
events ([str]): 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 ([str]): An array of webhook events that you want to subscribe to.
url (str): The the url to which HTTP notifications are sent. It could be any http or https URL.
Keyword Args:
Expand Down
2 changes: 1 addition & 1 deletion docs/WebhooksApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Method | HTTP request | Description
Create Webhook

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.

### Example

Expand Down
2 changes: 1 addition & 1 deletion docs/WebhooksCreationPayload.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**events** | **[str]** | 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** | **[str]** | An array of webhook events that you want to subscribe to. |
**url** | **str** | The the url to which HTTP notifications are sent. It could be any http or https URL. |

[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
Expand Down

0 comments on commit e7c3822

Please sign in to comment.