From 5509f53ff75a46d549109941ecb2d05c74feb842 Mon Sep 17 00:00:00 2001 From: szekelyzol Date: Wed, 13 Nov 2024 14:02:06 +0000 Subject: [PATCH] Add new webhooks --- apivideo/api/webhooks_api.py | 2 +- apivideo/model/webhook.py | 8 ++++++++ apivideo/model/webhooks_creation_payload.py | 10 +++++++++- docs/WebhooksApi.md | 2 +- docs/WebhooksCreationPayload.md | 2 +- 5 files changed, 20 insertions(+), 4 deletions(-) diff --git a/apivideo/api/webhooks_api.py b/apivideo/api/webhooks_api.py index 43356e9..3f9651b 100644 --- a/apivideo/api/webhooks_api.py +++ b/apivideo/api/webhooks_api.py @@ -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 diff --git a/apivideo/model/webhook.py b/apivideo/model/webhook.py index 87bd4c1..40df90a 100644 --- a/apivideo/model/webhook.py +++ b/apivideo/model/webhook.py @@ -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 = { diff --git a/apivideo/model/webhooks_creation_payload.py b/apivideo/model/webhooks_creation_payload.py index 25e2156..a6249bb 100644 --- a/apivideo/model/webhooks_creation_payload.py +++ b/apivideo/model/webhooks_creation_payload.py @@ -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 = { @@ -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: diff --git a/docs/WebhooksApi.md b/docs/WebhooksApi.md index c0dfa8b..a6a7dba 100644 --- a/docs/WebhooksApi.md +++ b/docs/WebhooksApi.md @@ -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 diff --git a/docs/WebhooksCreationPayload.md b/docs/WebhooksCreationPayload.md index 1dcc703..5fef3c3 100644 --- a/docs/WebhooksCreationPayload.md +++ b/docs/WebhooksCreationPayload.md @@ -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)