Skip to content

Commit

Permalink
Update Captions in the API reference
Browse files Browse the repository at this point in the history
  • Loading branch information
szekelyzol authored Nov 27, 2023
1 parent b790b26 commit 5c78568
Show file tree
Hide file tree
Showing 17 changed files with 92 additions and 18 deletions.
8 changes: 4 additions & 4 deletions docs/api/CaptionsApi.md
Original file line number Diff line number Diff line change
Expand Up @@ -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. |


Expand All @@ -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
Expand All @@ -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**| |


Expand All @@ -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
Expand Down
7 changes: 4 additions & 3 deletions docs/model/Caption.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]


Expand Down
8 changes: 4 additions & 4 deletions src/api/CaptionsApi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down Expand Up @@ -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<Caption> {
const queryParams: QueryOptions = {};
Expand Down Expand Up @@ -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 &#x60;en&#x60; (English), extended subtags like &#x60;fr-CA&#x60; (French, Canada), or region subtags like &#x60;zh-Hans-CN&#x60; (Simplified Chinese used in the PRC). - This parameter **only accepts dashes for separators**, for example &#x60;fr-CA&#x60;. 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(
Expand Down Expand Up @@ -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 &#x60;en&#x60; (English), extended subtags like &#x60;fr-CA&#x60; (French, Canada), or region subtags like &#x60;zh-Hans-CN&#x60; (Simplified Chinese used in the PRC). - This parameter **only accepts dashes for separators**, for example &#x60;fr-CA&#x60;. 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<void> {
const queryParams: QueryOptions = {};
Expand Down
19 changes: 19 additions & 0 deletions src/model/Caption.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand All @@ -41,6 +54,12 @@ export default class Caption {
type: 'string',
format: '',
},
{
name: 'languageName',
baseName: 'languageName',
type: 'string',
format: '',
},
{
name: '_default',
baseName: 'default',
Expand Down
7 changes: 7 additions & 0 deletions test/payloads/captions/delete/responses400-0.json
Original file line number Diff line number Diff line change
@@ -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"
}
7 changes: 7 additions & 0 deletions test/payloads/captions/delete/responses400-1.json
Original file line number Diff line number Diff line change
@@ -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"
}
1 change: 1 addition & 0 deletions test/payloads/captions/get/responses200.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
7 changes: 7 additions & 0 deletions test/payloads/captions/get/responses400-0.json
Original file line number Diff line number Diff line change
@@ -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"
}
7 changes: 7 additions & 0 deletions test/payloads/captions/get/responses400-1.json
Original file line number Diff line number Diff line change
@@ -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"
}
2 changes: 2 additions & 0 deletions test/payloads/captions/list/responses200.json
Original file line number Diff line number Diff line change
Expand Up @@ -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" : {
Expand Down
1 change: 1 addition & 0 deletions test/payloads/captions/update/responses200.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
7 changes: 7 additions & 0 deletions test/payloads/captions/update/responses400-0.json
Original file line number Diff line number Diff line change
@@ -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"
}
7 changes: 7 additions & 0 deletions test/payloads/captions/update/responses400-1.json
Original file line number Diff line number Diff line change
@@ -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"
}
7 changes: 0 additions & 7 deletions test/payloads/captions/update/responses400.json

This file was deleted.

1 change: 1 addition & 0 deletions test/payloads/captions/upload/responses200.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
7 changes: 7 additions & 0 deletions test/payloads/captions/upload/responses400-0.json
Original file line number Diff line number Diff line change
@@ -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"
}
7 changes: 7 additions & 0 deletions test/payloads/captions/upload/responses400-1.json
Original file line number Diff line number Diff line change
@@ -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"
}

0 comments on commit 5c78568

Please sign in to comment.