diff --git a/docs/api/CaptionsApi.md b/docs/api/CaptionsApi.md index a3c4230..236561c 100644 --- a/docs/api/CaptionsApi.md +++ b/docs/api/CaptionsApi.md @@ -22,7 +22,7 @@ Upload a VTT file to add captions to your video. More information can be found [ | Name | Type | Required | Description | | ------------- | ------------- | ------------- | ------------- | | **videoId** | **string**| **yes**| The unique identifier for the video you want to add a caption to. | - | **language** | **string**| **yes**| A valid BCP 47 language representation. | + | **language** | **string**| **yes**| A valid language identifier using IETF language tags. You can use primary subtags like `en` (English), extended subtags like `fr-CA` (French, Canada), or region subtags like `zh-Hans-CN` (Simplified Chinese used in the PRC). - This parameter **only accepts dashes for separators**, for example `fr-CA`. If you use a different separator in your request, the API returns an error. - When the value in your request does not match any covered language, the API returns an error. - This endpoint uses [Symfony](https://symfony.com) to reference the list of supported language tags. You can find the list of supported tags [here](https://github.com/symfony/symfony/blob/6.3/src/Symfony/Component/Intl/Resources/data/locales/meta.php). | | **file** | **string \| Readable \| Buffer**| **yes**| The video text track (VTT) you want to upload. | @@ -48,7 +48,7 @@ Tutorials that use the [captions endpoint](https://api.video/blog/endpoints/capt | Name | Type | Required | Description | | ------------- | ------------- | ------------- | ------------- | | **videoId** | **string**| **yes**| The unique identifier for the video you want captions for. | - | **language** | **string**| **yes**| A valid [BCP 47](https://github.com/libyal/libfwnt/wiki/Language-Code-identifiers) language representation | + | **language** | **string**| **yes**| A valid language identifier using IETF language tags. You can use primary subtags like `en` (English), extended subtags like `fr-CA` (French, Canada), or region subtags like `zh-Hans-CN` (Simplified Chinese used in the PRC). - This parameter **only accepts dashes for separators**, for example `fr-CA`. If you use a different separator in your request, the API returns an error. - When the value in your request does not match any covered language, the API returns an error. - This endpoint uses [Symfony](https://symfony.com) to reference the list of supported language tags. You can find the list of supported tags [here](https://github.com/symfony/symfony/blob/6.3/src/Symfony/Component/Intl/Resources/data/locales/meta.php). | ### Return type @@ -71,7 +71,7 @@ To have the captions on automatically, use this method to set default: true. | Name | Type | Required | Description | | ------------- | ------------- | ------------- | ------------- | | **videoId** | **string**| **yes**| The unique identifier for the video you want to have automatic captions for. | - | **language** | **string**| **yes**| A valid [BCP 47](https://github.com/libyal/libfwnt/wiki/Language-Code-identifiers) language representation. | + | **language** | **string**| **yes**| A valid language identifier using IETF language tags. You can use primary subtags like `en` (English), extended subtags like `fr-CA` (French, Canada), or region subtags like `zh-Hans-CN` (Simplified Chinese used in the PRC). - This parameter **only accepts dashes for separators**, for example `fr-CA`. If you use a different separator in your request, the API returns an error. - When the value in your request does not match any covered language, the API returns an error. - This endpoint uses [Symfony](https://symfony.com) to reference the list of supported language tags. You can find the list of supported tags [here](https://github.com/symfony/symfony/blob/6.3/src/Symfony/Component/Intl/Resources/data/locales/meta.php). | | **captionsUpdatePayload** | [**CaptionsUpdatePayload**](../model/CaptionsUpdatePayload.md)| **yes**| | @@ -95,7 +95,7 @@ Delete a caption in a specific language by by video id. | Name | Type | Required | Description | | ------------- | ------------- | ------------- | ------------- | | **videoId** | **string**| **yes**| The unique identifier for the video you want to delete a caption from. | - | **language** | **string**| **yes**| A valid [BCP 47](https://github.com/libyal/libfwnt/wiki/Language-Code-identifiers) language representation. | + | **language** | **string**| **yes**| A valid language identifier using IETF language tags. You can use primary subtags like `en` (English), extended subtags like `fr-CA` (French, Canada), or region subtags like `zh-Hans-CN` (Simplified Chinese used in the PRC). - This parameter **only accepts dashes for separators**, for example `fr-CA`. If you use a different separator in your request, the API returns an error. - When the value in your request does not match any covered language, the API returns an error. - This endpoint uses [Symfony](https://symfony.com) to reference the list of supported language tags. You can find the list of supported tags [here](https://github.com/symfony/symfony/blob/6.3/src/Symfony/Component/Intl/Resources/data/locales/meta.php). | ### Return type diff --git a/docs/model/Caption.md b/docs/model/Caption.md index fa1b4c8..daea65a 100644 --- a/docs/model/Caption.md +++ b/docs/model/Caption.md @@ -5,9 +5,10 @@ Name | Type | Description | Notes ------------ | ------------- | ------------- | ------------- -**uri** | **string** | | [optional] -**src** | **string** | | [optional] -**srclang** | **string** | | [optional] +**uri** | **string** | The unique resource identifier of the uploaded caption. | [optional] +**src** | **string** | A direct URL to the uploaded caption file. | [optional] +**srclang** | **string** | Indicates the language of the uploaded caption file using IETF language tags. | [optional] +**languageName** | **string** | Returns the native name of the caption language in UTF-8 encoding. | [optional] **_default** | **boolean** | Whether you will have subtitles or not. True for yes you will have subtitles, false for no you will not have subtitles. | [optional] diff --git a/src/api/CaptionsApi.ts b/src/api/CaptionsApi.ts index 2248465..43f051a 100644 --- a/src/api/CaptionsApi.ts +++ b/src/api/CaptionsApi.ts @@ -35,7 +35,7 @@ export default class CaptionsApi { * Upload a VTT file to add captions to your video. More information can be found [here](https://docs.api.video/vod/add-captions) * Upload a caption * @param videoId The unique identifier for the video you want to add a caption to. - * @param language A valid BCP 47 language representation. + * @param language A valid language identifier using IETF language tags. You can use primary subtags like `en` (English), extended subtags like `fr-CA` (French, Canada), or region subtags like `zh-Hans-CN` (Simplified Chinese used in the PRC). - This parameter **only accepts dashes for separators**, for example `fr-CA`. If you use a different separator in your request, the API returns an error. - When the value in your request does not match any covered language, the API returns an error. - This endpoint uses [Symfony](https://symfony.com) to reference the list of supported language tags. You can find the list of supported tags [here](https://github.com/symfony/symfony/blob/6.3/src/Symfony/Component/Intl/Resources/data/locales/meta.php). * @param file The video text track (VTT) you want to upload. */ public async upload( @@ -99,7 +99,7 @@ export default class CaptionsApi { Tutorials that use the [captions endpoint](https://api.video/blog/endpoints/captions). * Retrieve a caption * @param videoId The unique identifier for the video you want captions for. - * @param language A valid [BCP 47](https://github.com/libyal/libfwnt/wiki/Language-Code-identifiers) language representation + * @param language A valid language identifier using IETF language tags. You can use primary subtags like `en` (English), extended subtags like `fr-CA` (French, Canada), or region subtags like `zh-Hans-CN` (Simplified Chinese used in the PRC). - This parameter **only accepts dashes for separators**, for example `fr-CA`. If you use a different separator in your request, the API returns an error. - When the value in your request does not match any covered language, the API returns an error. - This endpoint uses [Symfony](https://symfony.com) to reference the list of supported language tags. You can find the list of supported tags [here](https://github.com/symfony/symfony/blob/6.3/src/Symfony/Component/Intl/Resources/data/locales/meta.php). */ public async get(videoId: string, language: string): Promise { const queryParams: QueryOptions = {}; @@ -141,7 +141,7 @@ Tutorials that use the [captions endpoint](https://api.video/blog/endpoints/capt * To have the captions on automatically, use this method to set default: true. * Update a caption * @param videoId The unique identifier for the video you want to have automatic captions for. - * @param language A valid [BCP 47](https://github.com/libyal/libfwnt/wiki/Language-Code-identifiers) language representation. + * @param language A valid language identifier using IETF language tags. You can use primary subtags like `en` (English), extended subtags like `fr-CA` (French, Canada), or region subtags like `zh-Hans-CN` (Simplified Chinese used in the PRC). - This parameter **only accepts dashes for separators**, for example `fr-CA`. If you use a different separator in your request, the API returns an error. - When the value in your request does not match any covered language, the API returns an error. - This endpoint uses [Symfony](https://symfony.com) to reference the list of supported language tags. You can find the list of supported tags [here](https://github.com/symfony/symfony/blob/6.3/src/Symfony/Component/Intl/Resources/data/locales/meta.php). * @param captionsUpdatePayload */ public async update( @@ -208,7 +208,7 @@ Tutorials that use the [captions endpoint](https://api.video/blog/endpoints/capt * Delete a caption in a specific language by by video id. * Delete a caption * @param videoId The unique identifier for the video you want to delete a caption from. - * @param language A valid [BCP 47](https://github.com/libyal/libfwnt/wiki/Language-Code-identifiers) language representation. + * @param language A valid language identifier using IETF language tags. You can use primary subtags like `en` (English), extended subtags like `fr-CA` (French, Canada), or region subtags like `zh-Hans-CN` (Simplified Chinese used in the PRC). - This parameter **only accepts dashes for separators**, for example `fr-CA`. If you use a different separator in your request, the API returns an error. - When the value in your request does not match any covered language, the API returns an error. - This endpoint uses [Symfony](https://symfony.com) to reference the list of supported language tags. You can find the list of supported tags [here](https://github.com/symfony/symfony/blob/6.3/src/Symfony/Component/Intl/Resources/data/locales/meta.php). */ public async delete(videoId: string, language: string): Promise { const queryParams: QueryOptions = {}; diff --git a/src/model/Caption.ts b/src/model/Caption.ts index eeaa2b4..e0959e7 100644 --- a/src/model/Caption.ts +++ b/src/model/Caption.ts @@ -12,9 +12,22 @@ import AttributeType from './AttributeType.js'; export default class Caption { + /** + * The unique resource identifier of the uploaded caption. + */ 'uri'?: string; + /** + * A direct URL to the uploaded caption file. + */ 'src'?: string; + /** + * Indicates the language of the uploaded caption file using IETF language tags. + */ 'srclang'?: string; + /** + * Returns the native name of the caption language in UTF-8 encoding. + */ + 'languageName'?: string; /** * Whether you will have subtitles or not. True for yes you will have subtitles, false for no you will not have subtitles. */ @@ -41,6 +54,12 @@ export default class Caption { type: 'string', format: '', }, + { + name: 'languageName', + baseName: 'languageName', + type: 'string', + format: '', + }, { name: '_default', baseName: 'default', diff --git a/test/payloads/captions/delete/responses400-0.json b/test/payloads/captions/delete/responses400-0.json new file mode 100644 index 0000000..c67814e --- /dev/null +++ b/test/payloads/captions/delete/responses400-0.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/captions/delete/responses400-1.json b/test/payloads/captions/delete/responses400-1.json new file mode 100644 index 0000000..fc103e0 --- /dev/null +++ b/test/payloads/captions/delete/responses400-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 is not valid.", + "name" : "language" +} \ No newline at end of file diff --git a/test/payloads/captions/get/responses200.json b/test/payloads/captions/get/responses200.json index cc57937..8c3c102 100644 --- a/test/payloads/captions/get/responses200.json +++ b/test/payloads/captions/get/responses200.json @@ -2,5 +2,6 @@ "uri" : "/videos/vi3N6cDinStg3oBbN79GklWS/captions/en", "src" : "https://cdn.api.video/vod/vi3N6cDinStg3oBbN79GklWS/captions/en.vtt", "srclang" : "en", + "languageName" : "English", "default" : false } \ No newline at end of file diff --git a/test/payloads/captions/get/responses400-0.json b/test/payloads/captions/get/responses400-0.json new file mode 100644 index 0000000..c67814e --- /dev/null +++ b/test/payloads/captions/get/responses400-0.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/captions/get/responses400-1.json b/test/payloads/captions/get/responses400-1.json new file mode 100644 index 0000000..fc103e0 --- /dev/null +++ b/test/payloads/captions/get/responses400-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 is not valid.", + "name" : "language" +} \ No newline at end of file diff --git a/test/payloads/captions/list/responses200.json b/test/payloads/captions/list/responses200.json index e3e49d9..c47b58d 100644 --- a/test/payloads/captions/list/responses200.json +++ b/test/payloads/captions/list/responses200.json @@ -3,11 +3,13 @@ "uri" : "/videos/vi3N6cDinStg3oBbN79GklWS/captions/en", "src" : "https://cdn.api.video/vod/vi3N6cDinStg3oBbN79GklWS/captions/en.vtt", "srclang" : "en", + "languageName" : "English", "default" : false }, { "uri" : "/videos/vi3N6cDinStg3oBbN79GklWS/captions/fr", "src" : "https://cdn.api.video/vod/vi3N6cDinStg3oBbN79GklWS/captions/fr.vtt", "srclang" : "fr", + "languageName" : "Française", "default" : false } ], "pagination" : { diff --git a/test/payloads/captions/update/responses200.json b/test/payloads/captions/update/responses200.json index 22adfca..a41f483 100644 --- a/test/payloads/captions/update/responses200.json +++ b/test/payloads/captions/update/responses200.json @@ -2,5 +2,6 @@ "uri" : "/videos/vi3N6cDinStg3oBbN79GklWS/captions/en", "src" : "https://cdn.api.video/vod/vi3N6cDinStg3oBbN79GklWS/captions/en.vtt", "srclang" : "en", + "languageName" : "English", "default" : true } \ No newline at end of file diff --git a/test/payloads/captions/update/responses400-0.json b/test/payloads/captions/update/responses400-0.json new file mode 100644 index 0000000..c67814e --- /dev/null +++ b/test/payloads/captions/update/responses400-0.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/captions/update/responses400-1.json b/test/payloads/captions/update/responses400-1.json new file mode 100644 index 0000000..fc103e0 --- /dev/null +++ b/test/payloads/captions/update/responses400-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 is not valid.", + "name" : "language" +} \ No newline at end of file diff --git a/test/payloads/captions/update/responses400.json b/test/payloads/captions/update/responses400.json deleted file mode 100644 index 0ea79a3..0000000 --- a/test/payloads/captions/update/responses400.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "type" : "string (required)", - "title" : "string (required)", - "name" : "string (required)", - "status" : "integer (required)", - "problems" : [ null ] -} \ No newline at end of file diff --git a/test/payloads/captions/upload/responses200.json b/test/payloads/captions/upload/responses200.json index cc57937..8c3c102 100644 --- a/test/payloads/captions/upload/responses200.json +++ b/test/payloads/captions/upload/responses200.json @@ -2,5 +2,6 @@ "uri" : "/videos/vi3N6cDinStg3oBbN79GklWS/captions/en", "src" : "https://cdn.api.video/vod/vi3N6cDinStg3oBbN79GklWS/captions/en.vtt", "srclang" : "en", + "languageName" : "English", "default" : false } \ No newline at end of file diff --git a/test/payloads/captions/upload/responses400-0.json b/test/payloads/captions/upload/responses400-0.json new file mode 100644 index 0000000..c67814e --- /dev/null +++ b/test/payloads/captions/upload/responses400-0.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/captions/upload/responses400-1.json b/test/payloads/captions/upload/responses400-1.json new file mode 100644 index 0000000..fc103e0 --- /dev/null +++ b/test/payloads/captions/upload/responses400-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 is not valid.", + "name" : "language" +} \ No newline at end of file