diff --git a/CHANGELOG.md b/CHANGELOG.md index a4cb875..3610a1a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ # Changelog All changes to this project will be documented in this file. +## [1.4.4] - 2024-10-08 +- Add transcript feature + ## [1.4.3] - 2024-09-30 - Add /tags API endpoint diff --git a/apivideo/__init__.py b/apivideo/__init__.py index 4b0a82c..37ba0d7 100644 --- a/apivideo/__init__.py +++ b/apivideo/__init__.py @@ -9,7 +9,7 @@ """ -__version__ = "1.4.3" +__version__ = "1.4.4" # import ApiVideoClient from apivideo.auth_api_client import AuthenticatedApiClient diff --git a/apivideo/api_client.py b/apivideo/api_client.py index c30360a..e1e34dc 100644 --- a/apivideo/api_client.py +++ b/apivideo/api_client.py @@ -75,7 +75,7 @@ def __init__(self, configuration=None, header_name=None, header_value=None, self.default_headers[header_name] = header_value self.cookie = cookie - self.default_headers['AV-Origin-Client'] = "python:1.4.3" + self.default_headers['AV-Origin-Client'] = "python:1.4.4" def __enter__(self): return self diff --git a/apivideo/configuration.py b/apivideo/configuration.py index 4f8fdf3..f17217d 100644 --- a/apivideo/configuration.py +++ b/apivideo/configuration.py @@ -391,7 +391,7 @@ def to_debug_report(self): "OS: {env}\n"\ "Python Version: {pyversion}\n"\ "Version of the API: 1\n"\ - "SDK Package Version: 1.4.3".\ + "SDK Package Version: 1.4.4".\ format(env=sys.platform, pyversion=sys.version) def get_host_settings(self): diff --git a/apivideo/model/video.py b/apivideo/model/video.py index d972a5b..3d3ce4e 100644 --- a/apivideo/model/video.py +++ b/apivideo/model/video.py @@ -59,6 +59,11 @@ class Video(ModelNormal): """ allowed_values = { + ('language_origin',): { + 'None': None, + 'API': "api", + 'AUTO': "auto", + }, } validations = { @@ -89,6 +94,8 @@ def openapi_types(): 'discarded_at': (datetime, none_type,), # noqa: E501 'deletes_at': (datetime, none_type,), # noqa: E501 'discarded': (bool,), # noqa: E501 + 'language': (str,), # noqa: E501 + 'language_origin': (str, none_type,), # noqa: E501 'tags': ([str],), # noqa: E501 'metadata': ([Metadata],), # noqa: E501 'source': (VideoSource,), # noqa: E501 @@ -114,6 +121,8 @@ def discriminator(): 'discarded_at': 'discardedAt', # noqa: E501 'deletes_at': 'deletesAt', # noqa: E501 'discarded': 'discarded', # noqa: E501 + 'language': 'language', # noqa: E501 + 'language_origin': 'languageOrigin', # noqa: E501 'tags': 'tags', # noqa: E501 'metadata': 'metadata', # noqa: E501 'source': 'source', # noqa: E501 @@ -181,6 +190,8 @@ def __init__(self, video_id, *args, **kwargs): # noqa: E501 discarded_at (datetime, none_type): The date and time the video was discarded. The API populates this field only if you have the Video Restore feature enabled and discard a video. Date and time are provided using ATOM UTC format.. [optional] # noqa: E501 deletes_at (datetime, none_type): The date and time the video will be permanently deleted. The API populates this field only if you have the Video Restore feature enabled and discard a video. Discarded videos are pemanently deleted after 90 days. Date and time are provided using ATOM UTC format.. [optional] # noqa: E501 discarded (bool): Returns `true` for videos you discarded when you have the Video Restore feature enabled. Returns `false` for every other video.. [optional] # noqa: E501 + language (str): Returns the language of a video in [IETF language tag](https://en.wikipedia.org/wiki/IETF_language_tag) format. You can set the language during video creation via the API, otherwise it is detected automatically.. [optional] # noqa: E501 + language_origin (str, none_type): Returns the origin of the last update on the video's `language` attribute. - `api` means that the last update was requested from the API. - `auto` means that the last update was done automatically by the API.. [optional] # noqa: E501 tags ([str]): One array of tags (each tag is a string) in order to categorize a video. Tags may include spaces. . [optional] # noqa: E501 metadata ([Metadata]): Metadata you can use to categorise and filter videos. Metadata is a list of dictionaries, where each dictionary represents a key value pair for categorising a video. . [optional] # noqa: E501 source (VideoSource): [optional] # noqa: E501 diff --git a/apivideo/model/video_creation_payload.py b/apivideo/model/video_creation_payload.py index 9a31ef2..267802c 100644 --- a/apivideo/model/video_creation_payload.py +++ b/apivideo/model/video_creation_payload.py @@ -59,6 +59,41 @@ class VideoCreationPayload(ModelNormal): """ allowed_values = { + ('language',): { + 'AR': "ar", + 'CA': "ca", + 'CS': "cs", + 'DA': "da", + 'DE': "de", + 'EL': "el", + 'EN': "en", + 'ES': "es", + 'FA': "fa", + 'FI': "fi", + 'FR': "fr", + 'HE': "he", + 'HI': "hi", + 'HR': "hr", + 'HU': "hu", + 'IT': "it", + 'JA': "ja", + 'KO': "ko", + 'ML': "ml", + 'NL': "nl", + 'NN': "nn", + 'FALSE': "false", + 'PL': "pl", + 'PT': "pt", + 'RU': "ru", + 'SK': "sk", + 'SL': "sl", + 'TE': "te", + 'TR': "tr", + 'UK': "uk", + 'UR': "ur", + 'VI': "vi", + 'ZH': "zh", + }, } validations = { @@ -91,6 +126,8 @@ def openapi_types(): 'metadata': ([Metadata],), # noqa: E501 'clip': (VideoClip,), # noqa: E501 'watermark': (VideoWatermark,), # noqa: E501 + 'language': (str,), # noqa: E501 + 'transcript': (bool,), # noqa: E501 } @cached_property @@ -110,6 +147,8 @@ def discriminator(): 'metadata': 'metadata', # noqa: E501 'clip': 'clip', # noqa: E501 'watermark': 'watermark', # noqa: E501 + 'language': 'language', # noqa: E501 + 'transcript': 'transcript', # noqa: E501 } _composed_schemas = {} @@ -171,6 +210,8 @@ def __init__(self, title, *args, **kwargs): # noqa: E501 metadata ([Metadata]): A list of key value pairs that you use to provide metadata for your video.. [optional] # noqa: E501 clip (VideoClip): [optional] # noqa: E501 watermark (VideoWatermark): [optional] # noqa: E501 + language (str): Use this parameter to set the language of the video. When this parameter is set, the API creates a transcript of the video using the language you specify. You must use the [IETF language tag](https://en.wikipedia.org/wiki/IETF_language_tag) format. `language` is a permanent attribute of the video. You can update it to another language using the [`PATCH /videos/{videoId}`](https://docs.api.video/reference/api/Videos#update-a-video-object) operation. This triggers the API to generate a new transcript using a different language.. [optional] # noqa: E501 + transcript (bool): Use this parameter to enable transcription. - When `true`, the API generates a transcript for the video. - The default value is `false`. - If you define a video language using the `language` parameter, the API uses that language to transcribe the video. If you do not define a language, the API detects it based on the video. - When the API generates a transcript, it will be available as a caption for the video.. [optional] # noqa: E501 """ _check_type = kwargs.pop('_check_type', True) diff --git a/apivideo/model/video_update_payload.py b/apivideo/model/video_update_payload.py index 0398aab..2b5d7f5 100644 --- a/apivideo/model/video_update_payload.py +++ b/apivideo/model/video_update_payload.py @@ -55,6 +55,41 @@ class VideoUpdatePayload(ModelNormal): """ allowed_values = { + ('language',): { + 'AR': "ar", + 'CA': "ca", + 'CS': "cs", + 'DA': "da", + 'DE': "de", + 'EL': "el", + 'EN': "en", + 'ES': "es", + 'FA': "fa", + 'FI': "fi", + 'FR': "fr", + 'HE': "he", + 'HI': "hi", + 'HR': "hr", + 'HU': "hu", + 'IT': "it", + 'JA': "ja", + 'KO': "ko", + 'ML': "ml", + 'NL': "nl", + 'NN': "nn", + 'FALSE': "false", + 'PL': "pl", + 'PT': "pt", + 'RU': "ru", + 'SK': "sk", + 'SL': "sl", + 'TE': "te", + 'TR': "tr", + 'UK': "uk", + 'UR': "ur", + 'VI': "vi", + 'ZH': "zh", + }, } validations = { @@ -84,6 +119,8 @@ def openapi_types(): 'mp4_support': (bool,), # noqa: E501 'tags': ([str],), # noqa: E501 'metadata': ([Metadata],), # noqa: E501 + 'language': (str,), # noqa: E501 + 'transcript': (bool,), # noqa: E501 } @cached_property @@ -100,6 +137,8 @@ def discriminator(): 'mp4_support': 'mp4Support', # noqa: E501 'tags': 'tags', # noqa: E501 'metadata': 'metadata', # noqa: E501 + 'language': 'language', # noqa: E501 + 'transcript': 'transcript', # noqa: E501 } _composed_schemas = {} @@ -156,6 +195,8 @@ def __init__(self, *args, **kwargs): # noqa: E501 mp4_support (bool): Whether the player supports the mp4 format.. [optional] # noqa: E501 tags ([str]): A list of terms or words you want to tag the video with. Make sure the list includes all the tags you want as whatever you send in this list will overwrite the existing list for the video.. [optional] # noqa: E501 metadata ([Metadata]): A list (array) of dictionaries where each dictionary contains a key value pair that describes the video. As with tags, you must send the complete list of metadata you want as whatever you send here will overwrite the existing metadata for the video.. [optional] # noqa: E501 + language (str): Use this parameter to set the language of the video. When this parameter is set, the API creates a transcript of the video using the language you specify. You must use the [IETF language tag](https://en.wikipedia.org/wiki/IETF_language_tag) format. `language` is a permanent attribute of the video. You can update it to another language using the [`PATCH /videos/{videoId}`](https://docs.api.video/reference/api/Videos#update-a-video-object) operation. This triggers the API to generate a new transcript using a different language.. [optional] # noqa: E501 + transcript (bool): Use this parameter to enable transcription. - When `true`, the API generates a transcript for the video. - The default value is `false`. - If you define a video language using the `language` parameter, the API uses that language to transcribe the video. If you do not define a language, the API detects it based on the video. - When the API generates a transcript, it will be available as a caption for the video.. [optional] # noqa: E501 """ _check_type = kwargs.pop('_check_type', True) diff --git a/docs/Video.md b/docs/Video.md index 3abcf95..a72ab4a 100644 --- a/docs/Video.md +++ b/docs/Video.md @@ -12,6 +12,8 @@ Name | Type | Description | Notes **discarded_at** | **datetime, none_type** | The date and time the video was discarded. The API populates this field only if you have the Video Restore feature enabled and discard a video. Date and time are provided using ATOM UTC format. | [optional] **deletes_at** | **datetime, none_type** | The date and time the video will be permanently deleted. The API populates this field only if you have the Video Restore feature enabled and discard a video. Discarded videos are pemanently deleted after 90 days. Date and time are provided using ATOM UTC format. | [optional] **discarded** | **bool** | Returns `true` for videos you discarded when you have the Video Restore feature enabled. Returns `false` for every other video. | [optional] +**language** | **str** | Returns the language of a video in [IETF language tag](https://en.wikipedia.org/wiki/IETF_language_tag) format. You can set the language during video creation via the API, otherwise it is detected automatically. | [optional] +**language_origin** | **str, none_type** | Returns the origin of the last update on the video's `language` attribute. - `api` means that the last update was requested from the API. - `auto` means that the last update was done automatically by the API. | [optional] **tags** | **[str]** | One array of tags (each tag is a string) in order to categorize a video. Tags may include spaces. | [optional] **metadata** | [**[Metadata]**](Metadata.md) | Metadata you can use to categorise and filter videos. Metadata is a list of dictionaries, where each dictionary represents a key value pair for categorising a video. | [optional] **source** | [**VideoSource**](VideoSource.md) | | [optional] diff --git a/docs/VideoCreationPayload.md b/docs/VideoCreationPayload.md index d4b34eb..8069dba 100644 --- a/docs/VideoCreationPayload.md +++ b/docs/VideoCreationPayload.md @@ -14,6 +14,8 @@ Name | Type | Description | Notes **metadata** | [**[Metadata]**](Metadata.md) | A list of key value pairs that you use to provide metadata for your video. | [optional] **clip** | [**VideoClip**](VideoClip.md) | | [optional] **watermark** | [**VideoWatermark**](VideoWatermark.md) | | [optional] +**language** | **str** | Use this parameter to set the language of the video. When this parameter is set, the API creates a transcript of the video using the language you specify. You must use the [IETF language tag](https://en.wikipedia.org/wiki/IETF_language_tag) format. `language` is a permanent attribute of the video. You can update it to another language using the [`PATCH /videos/{videoId}`](https://docs.api.video/reference/api/Videos#update-a-video-object) operation. This triggers the API to generate a new transcript using a different language. | [optional] +**transcript** | **bool** | Use this parameter to enable transcription. - When `true`, the API generates a transcript for the video. - The default value is `false`. - If you define a video language using the `language` parameter, the API uses that language to transcribe the video. If you do not define a language, the API detects it based on the video. - When the API generates a transcript, it will be available as a caption for the video. | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/VideoUpdatePayload.md b/docs/VideoUpdatePayload.md index 2da683d..ec923d5 100644 --- a/docs/VideoUpdatePayload.md +++ b/docs/VideoUpdatePayload.md @@ -11,6 +11,8 @@ Name | Type | Description | Notes **mp4_support** | **bool** | Whether the player supports the mp4 format. | [optional] **tags** | **[str]** | A list of terms or words you want to tag the video with. Make sure the list includes all the tags you want as whatever you send in this list will overwrite the existing list for the video. | [optional] **metadata** | [**[Metadata]**](Metadata.md) | A list (array) of dictionaries where each dictionary contains a key value pair that describes the video. As with tags, you must send the complete list of metadata you want as whatever you send here will overwrite the existing metadata for the video. | [optional] +**language** | **str** | Use this parameter to set the language of the video. When this parameter is set, the API creates a transcript of the video using the language you specify. You must use the [IETF language tag](https://en.wikipedia.org/wiki/IETF_language_tag) format. `language` is a permanent attribute of the video. You can update it to another language using the [`PATCH /videos/{videoId}`](https://docs.api.video/reference/api/Videos#update-a-video-object) operation. This triggers the API to generate a new transcript using a different language. | [optional] +**transcript** | **bool** | Use this parameter to enable transcription. - When `true`, the API generates a transcript for the video. - The default value is `false`. - If you define a video language using the `language` parameter, the API uses that language to transcribe the video. If you do not define a language, the API detects it based on the video. - When the API generates a transcript, it will be available as a caption for the video. | [optional] [[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) diff --git a/docs/VideosApi.md b/docs/VideosApi.md index c256b1b..a91b3ef 100644 --- a/docs/VideosApi.md +++ b/docs/VideosApi.md @@ -70,6 +70,8 @@ with apivideo.AuthenticatedApiClient(__API_KEY__) as api_client: height="initial", opacity="70%", ), + language="fr", + transcript=True, ) # VideoCreationPayload | video to create # example passing only required values which don't have defaults set @@ -421,6 +423,8 @@ with apivideo.AuthenticatedApiClient(__API_KEY__) as api_client: value="Green", ), ], + language="fr", + transcript=True, ) # VideoUpdatePayload | # example passing only required values which don't have defaults set diff --git a/setup.py b/setup.py index 72ef9f5..e6a4231 100644 --- a/setup.py +++ b/setup.py @@ -10,7 +10,7 @@ from setuptools import setup, find_packages # noqa: H301 NAME = "api.video" -VERSION = "1.4.3" +VERSION = "1.4.4" # To install the library, run the following # # python setup.py install diff --git a/test/payloads/videos/create/responses/201.json b/test/payloads/videos/create/responses/201.json index fbcda04..6d0d225 100644 --- a/test/payloads/videos/create/responses/201.json +++ b/test/payloads/videos/create/responses/201.json @@ -2,6 +2,8 @@ "videoId" : "vi4blUQJFrYWbaG44NChkH27", "title" : "Maths video", "description" : "An amazing video explaining the string theory", + "language" : "en", + "languageOrigin" : "api", "public" : false, "panoramic" : false, "mp4Support" : true, diff --git a/test/payloads/videos/create/responses/400.json b/test/payloads/videos/create/responses/400-0.json similarity index 100% rename from test/payloads/videos/create/responses/400.json rename to test/payloads/videos/create/responses/400-0.json diff --git a/test/payloads/videos/create/responses/400-1.json b/test/payloads/videos/create/responses/400-1.json new file mode 100644 index 0000000..c67814e --- /dev/null +++ b/test/payloads/videos/create/responses/400-1.json @@ -0,0 +1,7 @@ +{ + "type" : "https://docs.api.video/reference/invalid-attribute", + "title" : "An attribute is invalid.", + "status" : 400, + "detail" : "The \"language\" attribute must contain only letters and dashes (for example \"fr\", \"fr-BE\").", + "name" : "language" +} \ No newline at end of file diff --git a/test/payloads/videos/create/responses/400-2.json b/test/payloads/videos/create/responses/400-2.json new file mode 100644 index 0000000..fc103e0 --- /dev/null +++ b/test/payloads/videos/create/responses/400-2.json @@ -0,0 +1,7 @@ +{ + "type" : "https://docs.api.video/reference/invalid-attribute", + "title" : "An attribute is invalid.", + "status" : 400, + "detail" : "The \"language\" attribute is not valid.", + "name" : "language" +} \ No newline at end of file diff --git a/test/payloads/videos/get/responses/200.json b/test/payloads/videos/get/responses/200.json index c6df209..05a4a7a 100644 --- a/test/payloads/videos/get/responses/200.json +++ b/test/payloads/videos/get/responses/200.json @@ -3,6 +3,8 @@ "playerId" : "pl45KFKdlddgk654dspkze", "title" : "Maths video", "description" : "An amazing video explaining string theory", + "language" : "en", + "languageOrigin" : "api", "public" : false, "panoramic" : false, "mp4Support" : true, diff --git a/test/payloads/videos/list/responses/200.json b/test/payloads/videos/list/responses/200.json index 16b27a5..e2747ed 100644 --- a/test/payloads/videos/list/responses/200.json +++ b/test/payloads/videos/list/responses/200.json @@ -4,6 +4,8 @@ "playerId" : "pl45KFKdlddgk654dspkze", "title" : "Maths video", "description" : "An amazing video explaining the string theory", + "language" : "en", + "languageOrigin" : "api", "public" : false, "panoramic" : false, "mp4Support" : true, @@ -32,6 +34,8 @@ "videoId" : "vi4blUQJFrYWbaG44NChkH27", "title" : "Video Title", "description" : "A description for your video.", + "language" : "en", + "languageOrigin" : "api", "public" : false, "panoramic" : false, "mp4Support" : true, @@ -64,6 +68,8 @@ "playerId" : "pl45KFKdlddgk654dspkze", "title" : "My Video Title", "description" : "A brief description of the video.", + "language" : "fr", + "languageOrigin" : "api", "public" : false, "panoramic" : false, "mp4Support" : true, diff --git a/test/payloads/videos/update/responses/200.json b/test/payloads/videos/update/responses/200.json index f466a51..db100f4 100644 --- a/test/payloads/videos/update/responses/200.json +++ b/test/payloads/videos/update/responses/200.json @@ -3,6 +3,8 @@ "playerId" : "pl45KFKdlddgk654dspkze", "title" : "Maths video", "description" : "An amazing video explaining the string theory", + "language" : "en", + "languageOrigin" : "api", "public" : false, "panoramic" : false, "mp4Support" : true, diff --git a/test/payloads/videos/update/responses/400.json b/test/payloads/videos/update/responses/400-0.json similarity index 100% rename from test/payloads/videos/update/responses/400.json rename to test/payloads/videos/update/responses/400-0.json diff --git a/test/payloads/videos/update/responses/400-1.json b/test/payloads/videos/update/responses/400-1.json new file mode 100644 index 0000000..c67814e --- /dev/null +++ b/test/payloads/videos/update/responses/400-1.json @@ -0,0 +1,7 @@ +{ + "type" : "https://docs.api.video/reference/invalid-attribute", + "title" : "An attribute is invalid.", + "status" : 400, + "detail" : "The \"language\" attribute must contain only letters and dashes (for example \"fr\", \"fr-BE\").", + "name" : "language" +} \ No newline at end of file diff --git a/test/payloads/videos/update/responses/400-2.json b/test/payloads/videos/update/responses/400-2.json new file mode 100644 index 0000000..fc103e0 --- /dev/null +++ b/test/payloads/videos/update/responses/400-2.json @@ -0,0 +1,7 @@ +{ + "type" : "https://docs.api.video/reference/invalid-attribute", + "title" : "An attribute is invalid.", + "status" : 400, + "detail" : "The \"language\" attribute is not valid.", + "name" : "language" +} \ No newline at end of file diff --git a/test/payloads/videos/upload_with_upload_token/responses/201.json b/test/payloads/videos/upload_with_upload_token/responses/201.json index 8aeb102..37424d1 100644 --- a/test/payloads/videos/upload_with_upload_token/responses/201.json +++ b/test/payloads/videos/upload_with_upload_token/responses/201.json @@ -3,6 +3,7 @@ "playerId" : "pl45KFKdlddgk654dspkze", "title" : "Maths video", "description" : "An amazing video explaining the string theory", + "language" : "en", "public" : false, "panoramic" : false, "tags" : [ "maths", "string theory", "video" ], diff --git a/test/test_videos_api.py b/test/test_videos_api.py index 212f74c..4c846ba 100644 --- a/test/test_videos_api.py +++ b/test/test_videos_api.py @@ -80,6 +80,8 @@ def test_create(self): height="initial", opacity="70%", ), + language="fr", + transcript=True, ), } url = '/videos'.format(**kwargs) @@ -197,6 +199,8 @@ def test_update(self): value="Green", ), ], + language="fr", + transcript=True, ), } url = '/videos/{video_id}'.format(**kwargs)