Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add transcript feature #137

Merged
merged 1 commit into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .openapi-generator/oas_apivideo.yaml-defaut-cli.sha256
Original file line number Diff line number Diff line change
@@ -1 +1 @@
49fece4f39cb92341dc77e0eb7371a152903bf6aebcfa250d289efc9018b0f72
5ad86d4a6e6bdfede262551219ba43c8a645a86bc20fc9740b6f950e86f99f1d
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.

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

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

Expand Down
2 changes: 2 additions & 0 deletions docs/Video.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ Name | Type | Description | Notes
**DiscardedAt** | **DateTime?** | 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?** | 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** | **List<string>** | One array of tags (each tag is a string) in order to categorize a video. Tags may include spaces. | [optional]
**Metadata** | [**List<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 Down
2 changes: 2 additions & 0 deletions docs/VideoCreationPayload.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ Name | Type | Description | Notes
**Metadata** | [**List<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** | **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#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

2 changes: 2 additions & 0 deletions docs/VideoUpdatePayload.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ Name | Type | Description | Notes
**Mp4Support** | **bool** | Whether the player supports the mp4 format. | [optional]
**Tags** | **List<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** | [**List<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#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

12 changes: 6 additions & 6 deletions src/Api/VideosApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
if (videoCreationPayload != null && videoCreationPayload.title == null) {
throw new ApiException(400,"Missing required parameter 'videoCreationPayload.Title' when calling VideosApi->create");
}

// verify the required parameter 'videoCreationPayload' is set
if (videoCreationPayload == null)
throw new ApiException(400, "Missing required parameter 'videoCreationPayload' when calling VideosApi->create");
Expand Down Expand Up @@ -157,7 +157,7 @@
if (videoCreationPayload != null && videoCreationPayload.title == null) {
throw new ApiException(400,"Missing required parameter 'videoCreationPayload.Title' when calling VideosApi->create");
}

// verify the required parameter 'videoCreationPayload' is set
if (videoCreationPayload == null)
throw new ApiException(400, "Missing required parameter 'videoCreationPayload' when calling VideosApi->create");
Expand Down Expand Up @@ -559,7 +559,7 @@
}
}

public ApiResponse<Video> uploadPartWithHttpInfo(string videoId, System.IO.Stream file, int part, bool isLast) {

Check warning on line 562 in src/Api/VideosApi.cs

View workflow job for this annotation

GitHub Actions / test (5.x)

Missing XML comment for publicly visible type or member 'VideosApi.uploadPartWithHttpInfo(string, Stream, int, bool)'


// verify the required parameter 'videoId' is set
Expand Down Expand Up @@ -624,27 +624,27 @@
}


public class UploadProgressiveSession {

Check warning on line 627 in src/Api/VideosApi.cs

View workflow job for this annotation

GitHub Actions / test (5.x)

Missing XML comment for publicly visible type or member 'VideosApi.UploadProgressiveSession'
private int partNum = 1;


private string videoId;
private VideosApi videosApi;

public UploadProgressiveSession(VideosApi videosApi, string videoId) {

Check warning on line 634 in src/Api/VideosApi.cs

View workflow job for this annotation

GitHub Actions / test (5.x)

Missing XML comment for publicly visible type or member 'VideosApi.UploadProgressiveSession.UploadProgressiveSession(VideosApi, string)'
this.videoId = videoId;
this.videosApi = videosApi;
}

public Video uploadPart(System.IO.Stream part) {

Check warning on line 639 in src/Api/VideosApi.cs

View workflow job for this annotation

GitHub Actions / test (5.x)

Missing XML comment for publicly visible type or member 'VideosApi.UploadProgressiveSession.uploadPart(Stream)'
return uploadPart(part, false);
}

public Video uploadLastPart(System.IO.Stream part) {

Check warning on line 643 in src/Api/VideosApi.cs

View workflow job for this annotation

GitHub Actions / test (5.x)

Missing XML comment for publicly visible type or member 'VideosApi.UploadProgressiveSession.uploadLastPart(Stream)'
return uploadPart(part, true);
}

public Video uploadPart(System.IO.Stream part, bool isLastPart) {

Check warning on line 647 in src/Api/VideosApi.cs

View workflow job for this annotation

GitHub Actions / test (5.x)

Missing XML comment for publicly visible type or member 'VideosApi.UploadProgressiveSession.uploadPart(Stream, bool)'
int lastPartNum = partNum;
partNum++;
ApiResponse<Video> localVarResp = this.videosApi.uploadPartWithHttpInfo(this.videoId, part, lastPartNum, isLastPart);
Expand Down Expand Up @@ -1242,11 +1242,11 @@
if (videoUpdatePayload == null)
throw new ApiException(400,"Missing required parameter 'videoUpdatePayload' when calling VideosApi->update");


if (videoUpdatePayload == null)
throw new ApiException(400,"Missing required parameter 'videoUpdatePayload' when calling VideosApi->update");


// verify the required parameter 'videoId' is set
if (videoId == null)
throw new ApiException(400, "Missing required parameter 'videoId' when calling VideosApi->update");
Expand Down Expand Up @@ -1326,11 +1326,11 @@
if (videoUpdatePayload == null)
throw new ApiException(400,"Missing required parameter 'videoUpdatePayload' when calling VideosApi->update");


if (videoUpdatePayload == null)
throw new ApiException(400,"Missing required parameter 'videoUpdatePayload' when calling VideosApi->update");


// verify the required parameter 'videoId' is set
if (videoId == null)
throw new ApiException(400, "Missing required parameter 'videoId' when calling VideosApi->update");
Expand Down
2 changes: 1 addition & 1 deletion src/ApiVideo.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ The version of the OpenAPI document: 1
<OutputType>Library</OutputType>
<PackOnBuild>true</PackOnBuild>
<PackageId>ApiVideo</PackageId>
<PackageVersion>1.6.3</PackageVersion>
<PackageVersion>1.6.4</PackageVersion>
<Authors>api.video</Authors>
<Description>api.video csharp API client</Description>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
Expand Down
2 changes: 1 addition & 1 deletion src/Client/ApiClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
private void Initialize(IRestClient client)
{
this.RestClient = client;
setName("AV-Origin-Client", "csharp", "1.6.3");
setName("AV-Origin-Client", "csharp", "1.6.4");
}

/// <summary>
Expand Down Expand Up @@ -298,10 +298,10 @@

class ApiExceptionResponse
{
public string type;

Check warning on line 301 in src/Client/ApiClient.cs

View workflow job for this annotation

GitHub Actions / test (5.x)

Field 'ApiClient.ApiExceptionResponse.type' is never assigned to, and will always have its default value null
public string title;

Check warning on line 302 in src/Client/ApiClient.cs

View workflow job for this annotation

GitHub Actions / test (5.x)

Field 'ApiClient.ApiExceptionResponse.title' is never assigned to, and will always have its default value null
public string name;

Check warning on line 303 in src/Client/ApiClient.cs

View workflow job for this annotation

GitHub Actions / test (5.x)

Field 'ApiClient.ApiExceptionResponse.name' is never assigned to, and will always have its default value null
public int status;

Check warning on line 304 in src/Client/ApiClient.cs

View workflow job for this annotation

GitHub Actions / test (5.x)

Field 'ApiClient.ApiExceptionResponse.status' is never assigned to, and will always have its default value 0
}

/// <summary>
Expand Down
16 changes: 16 additions & 0 deletions src/Model/Video.cs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,20 @@ public class Video: DeepObject {
[JsonProperty(PropertyName = "discarded")]
public Nullable<bool> discarded { get; set; }
/// <summary>
/// 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.
/// </summary>
/// <value>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.</value>
[DataMember(Name="language", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "language")]
public string language { get; set; }
/// <summary>
/// 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.
/// </summary>
/// <value>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.</value>
[DataMember(Name="languageOrigin", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "languageOrigin")]
public string languageorigin { get; set; }
/// <summary>
/// One array of tags (each tag is a string) in order to categorize a video. Tags may include spaces.
/// </summary>
/// <value>One array of tags (each tag is a string) in order to categorize a video. Tags may include spaces. </value>
Expand Down Expand Up @@ -147,6 +161,8 @@ public override string ToString() {
sb.Append(" DiscardedAt: ").Append(discardedat).Append("\n");
sb.Append(" DeletesAt: ").Append(deletesat).Append("\n");
sb.Append(" Discarded: ").Append(discarded).Append("\n");
sb.Append(" Language: ").Append(language).Append("\n");
sb.Append(" LanguageOrigin: ").Append(languageorigin).Append("\n");
sb.Append(" Tags: ").Append(tags).Append("\n");
sb.Append(" Metadata: ").Append(metadata).Append("\n");
sb.Append(" Source: ").Append(source).Append("\n");
Expand Down
16 changes: 16 additions & 0 deletions src/Model/VideoCreationPayload.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,20 @@ public class VideoCreationPayload: DeepObject {
[DataMember(Name="watermark", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "watermark")]
public VideoWatermark watermark { get; set; }
/// <summary>
/// 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.
/// </summary>
/// <value>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.</value>
[DataMember(Name="language", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "language")]
public string language { get; set; }
/// <summary>
/// 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.
/// </summary>
/// <value>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.</value>
[DataMember(Name="transcript", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "transcript")]
public Nullable<bool> transcript { get; set; }


/// <summary>
Expand Down Expand Up @@ -117,6 +131,8 @@ public override string ToString() {
sb.Append(" Metadata: ").Append(metadata).Append("\n");
sb.Append(" Clip: ").Append(clip).Append("\n");
sb.Append(" Watermark: ").Append(watermark).Append("\n");
sb.Append(" Language: ").Append(language).Append("\n");
sb.Append(" Transcript: ").Append(transcript).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
Expand Down
16 changes: 16 additions & 0 deletions src/Model/VideoUpdatePayload.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,20 @@ public string playerid
[DataMember(Name="metadata", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "metadata")]
public List<Metadata> metadata { get; set; }
/// <summary>
/// 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.
/// </summary>
/// <value>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.</value>
[DataMember(Name="language", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "language")]
public string language { get; set; }
/// <summary>
/// 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.
/// </summary>
/// <value>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.</value>
[DataMember(Name="transcript", EmitDefaultValue=false)]
[JsonProperty(PropertyName = "transcript")]
public Nullable<bool> transcript { get; set; }


/// <summary>
Expand All @@ -100,6 +114,8 @@ public override string ToString() {
sb.Append(" Mp4Support: ").Append(mp4support).Append("\n");
sb.Append(" Tags: ").Append(tags).Append("\n");
sb.Append(" Metadata: ").Append(metadata).Append("\n");
sb.Append(" Language: ").Append(language).Append("\n");
sb.Append(" Transcript: ").Append(transcript).Append("\n");
sb.Append("}\n");
return sb.ToString();
}
Expand Down
4 changes: 2 additions & 2 deletions tests/Client/VideosApiTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ public void UpdatetResponseWithStatus200Test()
public void UpdateResponseWithStatus400Test()
{
InitUpdateTests();
answerOnAnyRequest(400, readResourceFile(PAYLOADS_PATH + "responses/400.json"));
answerOnAnyRequest(400, readResourceFile(PAYLOADS_PATH + "responses/400-0.json"));

api.Invoking(x => x.update("vi4k0jvEUuaTdRAEjQ4Jfrgz", new VideoUpdatePayload()))
.Should()
Expand Down Expand Up @@ -458,7 +458,7 @@ public void CreateResponseWithStatus201Test()
public void CreateResponseWithStatus400Test()
{
InitCreateTests();
answerOnAnyRequest(400, readResourceFile(PAYLOADS_PATH + "responses/400.json"));
answerOnAnyRequest(400, readResourceFile(PAYLOADS_PATH + "responses/400-0.json"));

api.Invoking(x => x.create(new VideoCreationPayload() { title = "title" }))
.Should()
Expand Down
2 changes: 2 additions & 0 deletions tests/resources/payloads/videos/create/responses/201.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 tests/resources/payloads/videos/create/responses/400-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"
}
Loading
Loading