From ad7c5bddd8a1f054b39120e9f5a0893ea1dcf20d Mon Sep 17 00:00:00 2001 From: olivierapivideo Date: Tue, 8 Oct 2024 09:14:05 +0000 Subject: [PATCH] Add transcript feature --- CHANGELOG.md | 3 + docs/Model/Video.md | 2 + docs/Model/VideoCreationPayload.md | 2 + docs/Model/VideoUpdatePayload.md | 2 + src/BaseClient.php | 4 +- src/Model/Video.php | 96 ++++++++++++++++ src/Model/VideoCreationPayload.php | 170 ++++++++++++++++++++++++++++- src/Model/VideoUpdatePayload.php | 170 ++++++++++++++++++++++++++++- 8 files changed, 435 insertions(+), 14 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ce5875..caebeb8 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/docs/Model/Video.md b/docs/Model/Video.md index 30f2f57..bce5c77 100644 --- a/docs/Model/Video.md +++ b/docs/Model/Video.md @@ -13,6 +13,8 @@ Name | Type | Description | Notes **discardedAt** | [**\DateTime**](\DateTime.md) | 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] **deletesAt** | [**\DateTime**](\DateTime.md) | 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** | **string** | 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] +**languageOrigin** | **string** | 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** | **string[]** | One array of tags (each tag is a string) in order to categorize a video. Tags may include spaces. | [optional] **metadata** | [**\ApiVideo\Client\Model\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** | [**\ApiVideo\Client\Model\VideoSource**](VideoSource.md) | | [optional] diff --git a/docs/Model/VideoCreationPayload.md b/docs/Model/VideoCreationPayload.md index 4e76cf5..4ec104f 100644 --- a/docs/Model/VideoCreationPayload.md +++ b/docs/Model/VideoCreationPayload.md @@ -15,5 +15,7 @@ Name | Type | Description | Notes **metadata** | [**\ApiVideo\Client\Model\Metadata[]**](Metadata.md) | A list of key value pairs that you use to provide metadata for your video. | [optional] **clip** | [**\ApiVideo\Client\Model\VideoClip**](VideoClip.md) | | [optional] **watermark** | [**\ApiVideo\Client\Model\VideoWatermark**](VideoWatermark.md) | | [optional] +**language** | **string** | 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#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/docs/Model/VideoUpdatePayload.md b/docs/Model/VideoUpdatePayload.md index 903d772..48c352d 100644 --- a/docs/Model/VideoUpdatePayload.md +++ b/docs/Model/VideoUpdatePayload.md @@ -12,5 +12,7 @@ Name | Type | Description | Notes **mp4Support** | **bool** | Whether the player supports the mp4 format. | [optional] **tags** | **string[]** | 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** | [**\ApiVideo\Client\Model\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** | **string** | 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#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/src/BaseClient.php b/src/BaseClient.php index 273dbc3..f83b42b 100644 --- a/src/BaseClient.php +++ b/src/BaseClient.php @@ -78,7 +78,7 @@ public function __construct(string $baseUri, ?string $apiKey, ClientInterface $h $this->originSdkHeaderValue = ""; if ($apiKey) { - $this->authenticator = new Authenticator($this, $apiKey, 'php:1.4.3'); + $this->authenticator = new Authenticator($this, $apiKey, 'php:1.4.4'); } } @@ -111,7 +111,7 @@ public function request(Request $commandRequest, bool $skipAuthRequest = false): if($this->originSdkHeaderValue) { $request = $request->withHeader('AV-Origin-Sdk', $this->originSdkHeaderValue); } - $request = $request->withHeader('AV-Origin-Client', 'php:1.4.3'); + $request = $request->withHeader('AV-Origin-Client', 'php:1.4.4'); return $this->sendRequest($request, $skipAuthRequest); } diff --git a/src/Model/Video.php b/src/Model/Video.php index 169f9cb..08822a5 100644 --- a/src/Model/Video.php +++ b/src/Model/Video.php @@ -40,6 +40,8 @@ public static function getDefinition(): ModelDefinition 'discardedAt' => '\DateTime', 'deletesAt' => '\DateTime', 'discarded' => 'bool', + 'language' => 'string', + 'languageOrigin' => 'string', 'tags' => 'string[]', 'metadata' => '\ApiVideo\Client\Model\Metadata[]', 'source' => '\ApiVideo\Client\Model\VideoSource', @@ -59,6 +61,8 @@ public static function getDefinition(): ModelDefinition 'discardedAt' => 'date-time', 'deletesAt' => 'date-time', 'discarded' => null, + 'language' => null, + 'languageOrigin' => null, 'tags' => null, 'metadata' => null, 'source' => null, @@ -78,6 +82,8 @@ public static function getDefinition(): ModelDefinition 'discardedAt' => 'discardedAt', 'deletesAt' => 'deletesAt', 'discarded' => 'discarded', + 'language' => 'language', + 'languageOrigin' => 'languageOrigin', 'tags' => 'tags', 'metadata' => 'metadata', 'source' => 'source', @@ -97,6 +103,8 @@ public static function getDefinition(): ModelDefinition 'discardedAt' => 'setDiscardedAt', 'deletesAt' => 'setDeletesAt', 'discarded' => 'setDiscarded', + 'language' => 'setLanguage', + 'languageOrigin' => 'setLanguageOrigin', 'tags' => 'setTags', 'metadata' => 'setMetadata', 'source' => 'setSource', @@ -116,6 +124,8 @@ public static function getDefinition(): ModelDefinition 'discardedAt' => 'getDiscardedAt', 'deletesAt' => 'getDeletesAt', 'discarded' => 'getDiscarded', + 'language' => 'getLanguage', + 'languageOrigin' => 'getLanguageOrigin', 'tags' => 'getTags', 'metadata' => 'getMetadata', 'source' => 'getSource', @@ -135,6 +145,8 @@ public static function getDefinition(): ModelDefinition 'discardedAt' => null, 'deletesAt' => null, 'discarded' => null, + 'language' => null, + 'languageOrigin' => null, 'tags' => null, 'metadata' => null, 'source' => null, @@ -148,6 +160,21 @@ public static function getDefinition(): ModelDefinition ); } + const LANGUAGE_ORIGIN_API = 'api'; + const LANGUAGE_ORIGIN_AUTO = 'auto'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getLanguageOriginAllowableValues() + { + return [ + self::LANGUAGE_ORIGIN_API, + self::LANGUAGE_ORIGIN_AUTO, + ]; + } /** * Associative array for storing property values @@ -173,6 +200,8 @@ public function __construct(array $data = null) $this->container['discardedAt'] = isset($data['discardedAt']) ? new \DateTime($data['discardedAt']) : null; $this->container['deletesAt'] = isset($data['deletesAt']) ? new \DateTime($data['deletesAt']) : null; $this->container['discarded'] = $data['discarded'] ?? null; + $this->container['language'] = $data['language'] ?? null; + $this->container['languageOrigin'] = $data['languageOrigin'] ?? null; $this->container['tags'] = $data['tags'] ?? null; $this->container['metadata'] = isset($data['metadata']) ? array_map(function(array $value): Metadata { return new Metadata($value); }, $data['metadata']) : null; $this->container['source'] = isset($data['source']) ? new VideoSource($data['source']) : null; @@ -195,6 +224,15 @@ public function listInvalidProperties() if ($this->container['videoId'] === null) { $invalidProperties[] = "'videoId' can't be null"; } + $allowedValues = $this->getLanguageOriginAllowableValues(); + if (!is_null($this->container['languageOrigin']) && !in_array($this->container['languageOrigin'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'languageOrigin', must be one of '%s'", + $this->container['languageOrigin'], + implode("', '", $allowedValues) + ); + } + return $invalidProperties; } @@ -426,6 +464,64 @@ public function setDiscarded($discarded) return $this; } + /** + * Gets language + * + * @return string|null + */ + public function getLanguage() + { + return $this->container['language']; + } + + /** + * Sets language + * + * @param string|null $language 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. + * + * @return self + */ + public function setLanguage($language) + { + $this->container['language'] = $language; + + return $this; + } + + /** + * Gets languageOrigin + * + * @return string|null + */ + public function getLanguageOrigin() + { + return $this->container['languageOrigin']; + } + + /** + * Sets languageOrigin + * + * @param string|null $languageOrigin 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. + * + * @return self + */ + public function setLanguageOrigin($languageOrigin) + { + $allowedValues = $this->getLanguageOriginAllowableValues(); + if (!is_null($languageOrigin) && !in_array($languageOrigin, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'languageOrigin', must be one of '%s'", + $languageOrigin, + implode("', '", $allowedValues) + ) + ); + } + $this->container['languageOrigin'] = $languageOrigin; + + return $this; + } + /** * Gets tags * diff --git a/src/Model/VideoCreationPayload.php b/src/Model/VideoCreationPayload.php index 01aaaa4..cb0ead6 100644 --- a/src/Model/VideoCreationPayload.php +++ b/src/Model/VideoCreationPayload.php @@ -41,7 +41,9 @@ public static function getDefinition(): ModelDefinition 'tags' => 'string[]', 'metadata' => '\ApiVideo\Client\Model\Metadata[]', 'clip' => '\ApiVideo\Client\Model\VideoClip', - 'watermark' => '\ApiVideo\Client\Model\VideoWatermark' + 'watermark' => '\ApiVideo\Client\Model\VideoWatermark', + 'language' => 'string', + 'transcript' => 'bool' ], [ 'title' => null, @@ -54,7 +56,9 @@ public static function getDefinition(): ModelDefinition 'tags' => null, 'metadata' => null, 'clip' => null, - 'watermark' => null + 'watermark' => null, + 'language' => null, + 'transcript' => null ], [ 'title' => 'title', @@ -67,7 +71,9 @@ public static function getDefinition(): ModelDefinition 'tags' => 'tags', 'metadata' => 'metadata', 'clip' => 'clip', - 'watermark' => 'watermark' + 'watermark' => 'watermark', + 'language' => 'language', + 'transcript' => 'transcript' ], [ 'title' => 'setTitle', @@ -80,7 +86,9 @@ public static function getDefinition(): ModelDefinition 'tags' => 'setTags', 'metadata' => 'setMetadata', 'clip' => 'setClip', - 'watermark' => 'setWatermark' + 'watermark' => 'setWatermark', + 'language' => 'setLanguage', + 'transcript' => 'setTranscript' ], [ 'title' => 'getTitle', @@ -93,7 +101,9 @@ public static function getDefinition(): ModelDefinition 'tags' => 'getTags', 'metadata' => 'getMetadata', 'clip' => 'getClip', - 'watermark' => 'getWatermark' + 'watermark' => 'getWatermark', + 'language' => 'getLanguage', + 'transcript' => 'getTranscript' ], [ 'title' => null, @@ -106,12 +116,91 @@ public static function getDefinition(): ModelDefinition 'tags' => null, 'metadata' => null, 'clip' => null, - 'watermark' => null + 'watermark' => null, + 'language' => null, + 'transcript' => null ], null ); } + const LANGUAGE_AR = 'ar'; + const LANGUAGE_CA = 'ca'; + const LANGUAGE_CS = 'cs'; + const LANGUAGE_DA = 'da'; + const LANGUAGE_DE = 'de'; + const LANGUAGE_EL = 'el'; + const LANGUAGE_EN = 'en'; + const LANGUAGE_ES = 'es'; + const LANGUAGE_FA = 'fa'; + const LANGUAGE_FI = 'fi'; + const LANGUAGE_FR = 'fr'; + const LANGUAGE_HE = 'he'; + const LANGUAGE_HI = 'hi'; + const LANGUAGE_HR = 'hr'; + const LANGUAGE_HU = 'hu'; + const LANGUAGE_IT = 'it'; + const LANGUAGE_JA = 'ja'; + const LANGUAGE_KO = 'ko'; + const LANGUAGE_ML = 'ml'; + const LANGUAGE_NL = 'nl'; + const LANGUAGE_NN = 'nn'; + const LANGUAGE_FALSE = 'false'; + const LANGUAGE_PL = 'pl'; + const LANGUAGE_PT = 'pt'; + const LANGUAGE_RU = 'ru'; + const LANGUAGE_SK = 'sk'; + const LANGUAGE_SL = 'sl'; + const LANGUAGE_TE = 'te'; + const LANGUAGE_TR = 'tr'; + const LANGUAGE_UK = 'uk'; + const LANGUAGE_UR = 'ur'; + const LANGUAGE_VI = 'vi'; + const LANGUAGE_ZH = 'zh'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getLanguageAllowableValues() + { + return [ + self::LANGUAGE_AR, + self::LANGUAGE_CA, + self::LANGUAGE_CS, + self::LANGUAGE_DA, + self::LANGUAGE_DE, + self::LANGUAGE_EL, + self::LANGUAGE_EN, + self::LANGUAGE_ES, + self::LANGUAGE_FA, + self::LANGUAGE_FI, + self::LANGUAGE_FR, + self::LANGUAGE_HE, + self::LANGUAGE_HI, + self::LANGUAGE_HR, + self::LANGUAGE_HU, + self::LANGUAGE_IT, + self::LANGUAGE_JA, + self::LANGUAGE_KO, + self::LANGUAGE_ML, + self::LANGUAGE_NL, + self::LANGUAGE_NN, + self::LANGUAGE_FALSE, + self::LANGUAGE_PL, + self::LANGUAGE_PT, + self::LANGUAGE_RU, + self::LANGUAGE_SK, + self::LANGUAGE_SL, + self::LANGUAGE_TE, + self::LANGUAGE_TR, + self::LANGUAGE_UK, + self::LANGUAGE_UR, + self::LANGUAGE_VI, + self::LANGUAGE_ZH, + ]; + } /** * Associative array for storing property values @@ -139,6 +228,8 @@ public function __construct(array $data = null) $this->container['metadata'] = isset($data['metadata']) ? array_map(function(array $value): Metadata { return new Metadata($value); }, $data['metadata']) : null; $this->container['clip'] = isset($data['clip']) ? new VideoClip($data['clip']) : null; $this->container['watermark'] = isset($data['watermark']) ? new VideoWatermark($data['watermark']) : null; + $this->container['language'] = $data['language'] ?? null; + $this->container['transcript'] = $data['transcript'] ?? null; } /** @@ -153,6 +244,15 @@ public function listInvalidProperties() if ($this->container['title'] === null) { $invalidProperties[] = "'title' can't be null"; } + $allowedValues = $this->getLanguageAllowableValues(); + if (!is_null($this->container['language']) && !in_array($this->container['language'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'language', must be one of '%s'", + $this->container['language'], + implode("', '", $allowedValues) + ); + } + return $invalidProperties; } @@ -432,6 +532,64 @@ public function setWatermark($watermark) return $this; } + /** + * Gets language + * + * @return string|null + */ + public function getLanguage() + { + return $this->container['language']; + } + + /** + * Sets language + * + * @param string|null $language 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. + * + * @return self + */ + public function setLanguage($language) + { + $allowedValues = $this->getLanguageAllowableValues(); + if (!is_null($language) && !in_array($language, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'language', must be one of '%s'", + $language, + implode("', '", $allowedValues) + ) + ); + } + $this->container['language'] = $language; + + return $this; + } + + /** + * Gets transcript + * + * @return bool|null + */ + public function getTranscript() + { + return $this->container['transcript']; + } + + /** + * Sets transcript + * + * @param bool|null $transcript 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. + * + * @return self + */ + public function setTranscript($transcript) + { + $this->container['transcript'] = $transcript; + + return $this; + } + /** * Serializes the object to a value that can be serialized natively by json_encode(). * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php diff --git a/src/Model/VideoUpdatePayload.php b/src/Model/VideoUpdatePayload.php index 807f1e6..83a2771 100644 --- a/src/Model/VideoUpdatePayload.php +++ b/src/Model/VideoUpdatePayload.php @@ -38,7 +38,9 @@ public static function getDefinition(): ModelDefinition 'panoramic' => 'bool', 'mp4Support' => 'bool', 'tags' => 'string[]', - 'metadata' => '\ApiVideo\Client\Model\Metadata[]' + 'metadata' => '\ApiVideo\Client\Model\Metadata[]', + 'language' => 'string', + 'transcript' => 'bool' ], [ 'playerId' => null, @@ -48,7 +50,9 @@ public static function getDefinition(): ModelDefinition 'panoramic' => null, 'mp4Support' => null, 'tags' => null, - 'metadata' => null + 'metadata' => null, + 'language' => null, + 'transcript' => null ], [ 'playerId' => 'playerId', @@ -58,7 +62,9 @@ public static function getDefinition(): ModelDefinition 'panoramic' => 'panoramic', 'mp4Support' => 'mp4Support', 'tags' => 'tags', - 'metadata' => 'metadata' + 'metadata' => 'metadata', + 'language' => 'language', + 'transcript' => 'transcript' ], [ 'playerId' => 'setPlayerId', @@ -68,7 +74,9 @@ public static function getDefinition(): ModelDefinition 'panoramic' => 'setPanoramic', 'mp4Support' => 'setMp4Support', 'tags' => 'setTags', - 'metadata' => 'setMetadata' + 'metadata' => 'setMetadata', + 'language' => 'setLanguage', + 'transcript' => 'setTranscript' ], [ 'playerId' => 'getPlayerId', @@ -78,7 +86,9 @@ public static function getDefinition(): ModelDefinition 'panoramic' => 'getPanoramic', 'mp4Support' => 'getMp4Support', 'tags' => 'getTags', - 'metadata' => 'getMetadata' + 'metadata' => 'getMetadata', + 'language' => 'getLanguage', + 'transcript' => 'getTranscript' ], [ 'playerId' => 'isPlayerIdDefined', @@ -88,12 +98,91 @@ public static function getDefinition(): ModelDefinition 'panoramic' => null, 'mp4Support' => null, 'tags' => null, - 'metadata' => null + 'metadata' => null, + 'language' => null, + 'transcript' => null ], null ); } + const LANGUAGE_AR = 'ar'; + const LANGUAGE_CA = 'ca'; + const LANGUAGE_CS = 'cs'; + const LANGUAGE_DA = 'da'; + const LANGUAGE_DE = 'de'; + const LANGUAGE_EL = 'el'; + const LANGUAGE_EN = 'en'; + const LANGUAGE_ES = 'es'; + const LANGUAGE_FA = 'fa'; + const LANGUAGE_FI = 'fi'; + const LANGUAGE_FR = 'fr'; + const LANGUAGE_HE = 'he'; + const LANGUAGE_HI = 'hi'; + const LANGUAGE_HR = 'hr'; + const LANGUAGE_HU = 'hu'; + const LANGUAGE_IT = 'it'; + const LANGUAGE_JA = 'ja'; + const LANGUAGE_KO = 'ko'; + const LANGUAGE_ML = 'ml'; + const LANGUAGE_NL = 'nl'; + const LANGUAGE_NN = 'nn'; + const LANGUAGE_FALSE = 'false'; + const LANGUAGE_PL = 'pl'; + const LANGUAGE_PT = 'pt'; + const LANGUAGE_RU = 'ru'; + const LANGUAGE_SK = 'sk'; + const LANGUAGE_SL = 'sl'; + const LANGUAGE_TE = 'te'; + const LANGUAGE_TR = 'tr'; + const LANGUAGE_UK = 'uk'; + const LANGUAGE_UR = 'ur'; + const LANGUAGE_VI = 'vi'; + const LANGUAGE_ZH = 'zh'; + + /** + * Gets allowable values of the enum + * + * @return string[] + */ + public function getLanguageAllowableValues() + { + return [ + self::LANGUAGE_AR, + self::LANGUAGE_CA, + self::LANGUAGE_CS, + self::LANGUAGE_DA, + self::LANGUAGE_DE, + self::LANGUAGE_EL, + self::LANGUAGE_EN, + self::LANGUAGE_ES, + self::LANGUAGE_FA, + self::LANGUAGE_FI, + self::LANGUAGE_FR, + self::LANGUAGE_HE, + self::LANGUAGE_HI, + self::LANGUAGE_HR, + self::LANGUAGE_HU, + self::LANGUAGE_IT, + self::LANGUAGE_JA, + self::LANGUAGE_KO, + self::LANGUAGE_ML, + self::LANGUAGE_NL, + self::LANGUAGE_NN, + self::LANGUAGE_FALSE, + self::LANGUAGE_PL, + self::LANGUAGE_PT, + self::LANGUAGE_RU, + self::LANGUAGE_SK, + self::LANGUAGE_SL, + self::LANGUAGE_TE, + self::LANGUAGE_TR, + self::LANGUAGE_UK, + self::LANGUAGE_UR, + self::LANGUAGE_VI, + self::LANGUAGE_ZH, + ]; + } /** * Associative array for storing property values @@ -118,6 +207,8 @@ public function __construct(array $data = null) $this->container['mp4Support'] = $data['mp4Support'] ?? null; $this->container['tags'] = $data['tags'] ?? null; $this->container['metadata'] = isset($data['metadata']) ? array_map(function(array $value): Metadata { return new Metadata($value); }, $data['metadata']) : null; + $this->container['language'] = $data['language'] ?? null; + $this->container['transcript'] = $data['transcript'] ?? null; } /** @@ -129,6 +220,15 @@ public function listInvalidProperties() { $invalidProperties = []; + $allowedValues = $this->getLanguageAllowableValues(); + if (!is_null($this->container['language']) && !in_array($this->container['language'], $allowedValues, true)) { + $invalidProperties[] = sprintf( + "invalid value '%s' for 'language', must be one of '%s'", + $this->container['language'], + implode("', '", $allowedValues) + ); + } + return $invalidProperties; } @@ -346,6 +446,64 @@ public function setMetadata($metadata) return $this; } + /** + * Gets language + * + * @return string|null + */ + public function getLanguage() + { + return $this->container['language']; + } + + /** + * Sets language + * + * @param string|null $language 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. + * + * @return self + */ + public function setLanguage($language) + { + $allowedValues = $this->getLanguageAllowableValues(); + if (!is_null($language) && !in_array($language, $allowedValues, true)) { + throw new \InvalidArgumentException( + sprintf( + "Invalid value '%s' for 'language', must be one of '%s'", + $language, + implode("', '", $allowedValues) + ) + ); + } + $this->container['language'] = $language; + + return $this; + } + + /** + * Gets transcript + * + * @return bool|null + */ + public function getTranscript() + { + return $this->container['transcript']; + } + + /** + * Sets transcript + * + * @param bool|null $transcript 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. + * + * @return self + */ + public function setTranscript($transcript) + { + $this->container['transcript'] = $transcript; + + return $this; + } + /** * Serializes the object to a value that can be serialized natively by json_encode(). * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php