Skip to content

Commit

Permalink
Merge pull request #227 from apivideo/add-transcript-feature
Browse files Browse the repository at this point in the history
Add transcript feature
  • Loading branch information
bot-api-video authored Oct 8, 2024
2 parents c6021bf + bf70b5a commit c38bb99
Show file tree
Hide file tree
Showing 21 changed files with 276 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Changelog
All changes to this project will be documented in this file.

## [2.6.4] - 2024-10-08
- Add transcript feature

## [2.6.3] - 2024-09-30
- Add /tags API endpoint

Expand Down
11 changes: 11 additions & 0 deletions docs/model/Video.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ Name | Type | Description | Notes
**discardedAt** | **Date** | 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** | **Date** | 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** | **boolean** | 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** | [**VideoLanguageOriginEnum**](#VideoLanguageOriginEnum) | 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** | **Array<string>** | One array of tags (each tag is a string) in order to categorize a video. Tags may include spaces. | [optional]
**metadata** | [**Array<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]
Expand All @@ -25,3 +27,12 @@ Name | Type | Description | Notes



## Enum: VideoLanguageOriginEnum

Name | Value
---- | -----
Api | 'api'
Auto | 'auto'



42 changes: 42 additions & 0 deletions docs/model/VideoCreationPayload.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,48 @@ Name | Type | Description | Notes
**metadata** | [**Array<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** | [**VideoCreationPayloadLanguageEnum**](#VideoCreationPayloadLanguageEnum) | 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** | **boolean** | 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]



## Enum: VideoCreationPayloadLanguageEnum

Name | Value
---- | -----
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'



42 changes: 42 additions & 0 deletions docs/model/VideoUpdatePayload.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,48 @@ Name | Type | Description | Notes
**mp4Support** | **boolean** | Whether the player supports the mp4 format. | [optional]
**tags** | **Array<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** | [**Array<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** | [**VideoUpdatePayloadLanguageEnum**](#VideoUpdatePayloadLanguageEnum) | 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** | **boolean** | 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]



## Enum: VideoUpdatePayloadLanguageEnum

Name | Value
---- | -----
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'



2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@api.video/nodejs-client",
"version": "2.6.3",
"version": "2.6.4",
"description": "api.video nodejs API client",
"keywords": [
"api.video",
Expand Down
2 changes: 1 addition & 1 deletion src/HttpClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export default class HttpClient {
this.chunkSize = params.chunkSize;
this.headers = new AxiosHeaders({
Accept: 'application/json, */*;q=0.8',
'AV-Origin-Client': 'nodejs:2.6.3',
'AV-Origin-Client': 'nodejs:2.6.4',
Authorization: this.apiKey ? `Basic ${encode(`${this.apiKey}:`)}` : '',
...(params.applicationName && params.applicationVersion
? {
Expand Down
3 changes: 3 additions & 0 deletions src/ObjectSerializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,10 @@ const enumsMap: Set<string> = new Set<string>([
'QualityTypeEnum',
'QualityQualityEnum',
'QualityStatusEnum',
'VideoLanguageOriginEnum',
'VideoCreationPayloadLanguageEnum',
'VideoStatusIngestStatusEnum',
'VideoUpdatePayloadLanguageEnum',
]);

const typeMap: { [index: string]: any } = {
Expand Down
22 changes: 22 additions & 0 deletions src/model/Video.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,14 @@ export default class Video {
* Returns `true` for videos you discarded when you have the Video Restore feature enabled. Returns `false` for every other video.
*/
'discarded'?: boolean;
/**
* 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.
*/
'language'?: 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.
*/
'languageOrigin'?: VideoLanguageOriginEnum;
/**
* One array of tags (each tag is a string) in order to categorize a video. Tags may include spaces.
*/
Expand Down Expand Up @@ -135,6 +143,18 @@ export default class Video {
type: 'boolean',
format: '',
},
{
name: 'language',
baseName: 'language',
type: 'string',
format: '',
},
{
name: 'languageOrigin',
baseName: 'languageOrigin',
type: 'VideoLanguageOriginEnum',
format: '',
},
{
name: 'tags',
baseName: 'tags',
Expand Down Expand Up @@ -189,3 +209,5 @@ export default class Video {
return Video.attributeTypeMap;
}
}

export type VideoLanguageOriginEnum = 'api' | 'auto';
55 changes: 55 additions & 0 deletions src/model/VideoCreationPayload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,14 @@ export default class VideoCreationPayload {
'metadata'?: Array<Metadata>;
'clip'?: VideoClip;
'watermark'?: VideoWatermark;
/**
* 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.
*/
'language'?: VideoCreationPayloadLanguageEnum;
/**
* 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.
*/
'transcript'?: boolean;

static readonly discriminator?: string = undefined;

Expand Down Expand Up @@ -123,9 +131,56 @@ export default class VideoCreationPayload {
type: 'VideoWatermark',
format: '',
},
{
name: 'language',
baseName: 'language',
type: 'VideoCreationPayloadLanguageEnum',
format: '',
},
{
name: 'transcript',
baseName: 'transcript',
type: 'boolean',
format: '',
},
];

static getAttributeTypeMap(): Array<AttributeType> {
return VideoCreationPayload.attributeTypeMap;
}
}

export type VideoCreationPayloadLanguageEnum =
| 'ar'
| 'ca'
| 'cs'
| 'da'
| 'de'
| 'el'
| 'en'
| 'es'
| 'fa'
| 'fi'
| 'fr'
| 'he'
| 'hi'
| 'hr'
| 'hu'
| 'it'
| 'ja'
| 'ko'
| 'ml'
| 'nl'
| 'nn'
| 'false'
| 'pl'
| 'pt'
| 'ru'
| 'sk'
| 'sl'
| 'te'
| 'tr'
| 'uk'
| 'ur'
| 'vi'
| 'zh';
55 changes: 55 additions & 0 deletions src/model/VideoUpdatePayload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@ export default class VideoUpdatePayload {
* 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.
*/
'metadata'?: Array<Metadata>;
/**
* 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.
*/
'language'?: VideoUpdatePayloadLanguageEnum;
/**
* 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.
*/
'transcript'?: boolean;

static readonly discriminator?: string = undefined;

Expand Down Expand Up @@ -97,9 +105,56 @@ export default class VideoUpdatePayload {
type: 'Array<Metadata>',
format: '',
},
{
name: 'language',
baseName: 'language',
type: 'VideoUpdatePayloadLanguageEnum',
format: '',
},
{
name: 'transcript',
baseName: 'transcript',
type: 'boolean',
format: '',
},
];

static getAttributeTypeMap(): Array<AttributeType> {
return VideoUpdatePayload.attributeTypeMap;
}
}

export type VideoUpdatePayloadLanguageEnum =
| 'ar'
| 'ca'
| 'cs'
| 'da'
| 'de'
| 'el'
| 'en'
| 'es'
| 'fa'
| 'fi'
| 'fr'
| 'he'
| 'hi'
| 'hr'
| 'hu'
| 'it'
| 'ja'
| 'ko'
| 'ml'
| 'nl'
| 'nn'
| 'false'
| 'pl'
| 'pt'
| 'ru'
| 'sk'
| 'sl'
| 'te'
| 'tr'
| 'uk'
| 'ur'
| 'vi'
| 'zh';
2 changes: 2 additions & 0 deletions test/payloads/videos/create/responses201.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
7 changes: 7 additions & 0 deletions test/payloads/videos/create/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 must contain only letters and dashes (for example \"fr\", \"fr-BE\").",
"name" : "language"
}
7 changes: 7 additions & 0 deletions test/payloads/videos/create/responses400-2.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/videos/get/responses200.json
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Loading

0 comments on commit c38bb99

Please sign in to comment.