diff --git a/CHANGELOG.md b/CHANGELOG.md index c48fc20..47ebcf0 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/README.md b/README.md index dbf34cb..84ed970 100644 --- a/README.md +++ b/README.md @@ -69,7 +69,7 @@ Add this dependency to your project's POM: video.api java-api-client - 1.4.3 + 1.4.4 compile ``` @@ -79,7 +79,7 @@ Add this dependency to your project's POM: Add this dependency to your project's build file: ```groovy -implementation "video.api:java-api-client:1.4.3" +implementation "video.api:java-api-client:1.4.4" ``` #### Others @@ -92,7 +92,7 @@ mvn clean package Then manually install the following JARs: -* `target/java-api-client-1.4.3.jar` +* `target/java-api-client-1.4.4.jar` * `target/lib/*.jar` ### Code sample diff --git a/api/openapi.yaml b/api/openapi.yaml index 755e8a4..390dd17 100644 --- a/api/openapi.yaml +++ b/api/openapi.yaml @@ -288,6 +288,8 @@ paths: playerId: pl45KFKdlddgk654dspkze title: Maths video description: An amazing video explaining the string theory + language: en + languageOrigin: api public: false panoramic: false mp4Support: true @@ -318,6 +320,8 @@ paths: - videoId: vi4blUQJFrYWbaG44NChkH27 title: Video Title description: A description for your video. + language: en + languageOrigin: api public: false panoramic: false mp4Support: true @@ -350,6 +354,8 @@ paths: playerId: pl45KFKdlddgk654dspkze title: My Video Title description: A brief description of the video. + language: fr + languageOrigin: api public: false panoramic: false mp4Support: true @@ -616,6 +622,8 @@ paths: videoId: vi4blUQJFrYWbaG44NChkH27 title: Maths video description: An amazing video explaining the string theory + language: en + languageOrigin: api public: false panoramic: false mp4Support: true @@ -698,7 +706,7 @@ paths: content: application/json: examples: - response: + Arttribute required: value: type: https://docs.api.video/reference/attribute-required title: This attribute is required. @@ -717,6 +725,25 @@ paths: - type: https://docs.api.video/reference/invalid-attribute title: This attribute must be an array. name: metadata + Invalid language formatting: + description: This error occurs when the language tag you provided + contains characters other than letters and dashes. + value: + 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 + Invalid language: + description: This error occurs when the language tag you provided + does not match any supported language. + value: + type: https://docs.api.video/reference/invalid-attribute + title: An attribute is invalid. + status: 400 + detail: The "language" attribute is not valid. + name: language schema: $ref: '#/components/schemas/bad-request' description: Bad Request @@ -2977,6 +3004,8 @@ paths: playerId: pl45KFKdlddgk654dspkze title: Maths video description: An amazing video explaining string theory + language: en + languageOrigin: api public: false panoramic: false mp4Support: true @@ -3231,6 +3260,8 @@ paths: playerId: pl45KFKdlddgk654dspkze title: Maths video description: An amazing video explaining the string theory + language: en + languageOrigin: api public: false panoramic: false mp4Support: true @@ -3286,7 +3317,7 @@ paths: content: application/json: examples: - response: + Invalid attribute: value: type: https://docs.api.video/reference/invalid-attribute title: This attribute must be a ISO-8601 date. @@ -3302,6 +3333,25 @@ paths: - type: https://docs.api.video/reference/invalid-attribute title: This attribute must be an array. name: metadata + Invalid language formatting: + description: This error occurs when the language tag you provided + contains characters other than letters and dashes. + value: + 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 + Invalid language: + description: This error occurs when the language tag you provided + does not match any supported language. + value: + type: https://docs.api.video/reference/invalid-attribute + title: An attribute is invalid. + status: 400 + detail: The "language" attribute is not valid. + name: language schema: $ref: '#/components/schemas/bad-request' description: Bad Request @@ -5607,6 +5657,7 @@ paths: playerId: pl45KFKdlddgk654dspkze title: Maths video description: An amazing video explaining the string theory + language: en public: false panoramic: false tags: @@ -14886,6 +14937,8 @@ components: videoId: vi4k0jvEUuaTdRAEjQ4Jfrgz title: Maths video description: An amazing video explaining the string theory + language: en + languageOrigin: api tags: - maths - string theory @@ -14957,6 +15010,21 @@ components: description: Returns `true` for videos you discarded when you have the Video Restore feature enabled. Returns `false` for every other video. type: boolean + language: + description: 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. + type: string + languageOrigin: + description: |- + 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. + enum: + - api + - auto + type: string tags: description: "One array of tags (each tag is a string) in order to categorize\ \ a video. Tags may include spaces. \n" @@ -15705,6 +15773,8 @@ components: - videoId: vi4k0jvEUuaTdRAEjQ4Jfrgz title: Maths video description: An amazing video explaining the string theory + language: en + languageOrigin: api tags: - maths - string theory @@ -15726,6 +15796,8 @@ components: - videoId: vi4k0jvEUuaTdRAEjQ4Jfrgz title: Maths video description: An amazing video explaining the string theory + language: en + languageOrigin: api tags: - maths - string theory @@ -15777,6 +15849,8 @@ components: panoramic: false mp4Support: true playerId: pl45KFKdlddgk654dspkze + language: en + transcript: true tags: - maths - string theory @@ -15847,6 +15921,55 @@ components: $ref: '#/components/schemas/video-clip' watermark: $ref: '#/components/schemas/video-watermark' + language: + description: |- + 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. + enum: + - 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 + example: fr + type: string + transcript: + description: "Use this parameter to enable transcription. \n\n- When `true`,\ + \ the API generates a transcript for the video.\n- The default value is\ + \ `false`.\n- 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. \n- When the API\ + \ generates a transcript, it will be available as a caption for the video." + type: boolean required: - title title: VideoCreationPayload @@ -15897,6 +16020,8 @@ components: title: String theory description: An amazing video explaining the string theory public: false + language: en + reanscript: true panoramic: false mp4Support: true tags: @@ -15951,6 +16076,55 @@ components: items: $ref: '#/components/schemas/metadata' type: array + language: + description: |- + 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. + enum: + - 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 + example: fr + type: string + transcript: + description: "Use this parameter to enable transcription. \n\n- When `true`,\ + \ the API generates a transcript for the video.\n- The default value is\ + \ `false`.\n- 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. \n- When the API\ + \ generates a transcript, it will be available as a caption for the video." + type: boolean title: VideoUpdatePayload type: object discarded-video-update-payload: diff --git a/build.gradle b/build.gradle index 47eaa74..f6e1ddd 100644 --- a/build.gradle +++ b/build.gradle @@ -4,7 +4,7 @@ apply plugin: 'com.diffplug.spotless' apply plugin: 'maven-publish' group = 'video.api' -version = '1.4.3' +version = '1.4.4' buildscript { repositories { diff --git a/docs/Video.md b/docs/Video.md index 2b080eb..511ff99 100644 --- a/docs/Video.md +++ b/docs/Video.md @@ -15,6 +15,8 @@ Name | Type | Description | Notes **discardedAt** | **OffsetDateTime** | 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** | **OffsetDateTime** | 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** | [**LanguageOriginEnum**](#LanguageOriginEnum) | 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] @@ -25,6 +27,15 @@ Name | Type | Description | Notes **mp4Support** | **Boolean** | This lets you know whether mp4 is supported. If enabled, an mp4 URL will be provided in the response for the video. | [optional] + +## Enum: LanguageOriginEnum + +Name | Value +---- | ----- +API | "api" +AUTO | "auto" + + ## Implemented Interfaces * Serializable diff --git a/docs/VideoCreationPayload.md b/docs/VideoCreationPayload.md index 4f5d2c1..5af38d6 100644 --- a/docs/VideoCreationPayload.md +++ b/docs/VideoCreationPayload.md @@ -17,6 +17,48 @@ 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** | [**LanguageEnum**](#LanguageEnum) | 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: LanguageEnum + +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" ## Implemented Interfaces diff --git a/docs/VideoUpdatePayload.md b/docs/VideoUpdatePayload.md index b447871..d8a1eed 100644 --- a/docs/VideoUpdatePayload.md +++ b/docs/VideoUpdatePayload.md @@ -14,6 +14,48 @@ Name | Type | Description | Notes **mp4Support** | **Boolean** | 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** | [**LanguageEnum**](#LanguageEnum) | 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: LanguageEnum + +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" ## Implemented Interfaces diff --git a/docs/VideosApi.md b/docs/VideosApi.md index 13ae154..ca6650d 100644 --- a/docs/VideosApi.md +++ b/docs/VideosApi.md @@ -58,6 +58,15 @@ public class Example { videoCreationPayload.setMetadata(Collections.emptyList()); // A list of key value pairs that you use to provide metadata for your video. videoCreationPayload.setClip(); // videoCreationPayload.setWatermark(); // + videoCreationPayload.setLanguage(""fr""); // 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. + videoCreationPayload.setTranscript(); // 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. try { @@ -430,6 +439,15 @@ public class Example { videoUpdatePayload.setMp4Support(true); // Whether the player supports the mp4 format. videoUpdatePayload.setTags(Arrays.asList("maths", "string theory", "video")); // 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. videoUpdatePayload.setMetadata(Collections.emptyList()); // 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. + videoUpdatePayload.setLanguage(""fr""); // 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. + videoUpdatePayload.setTranscript(); // 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. try { diff --git a/pom.xml b/pom.xml index bc3691a..cfe95a7 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ java-api-client jar ${project.groupId}:${project.artifactId} - 1.4.3 + 1.4.4 https://github.com/apivideo/api.video-java-client api.video Java API client diff --git a/src/main/java/video/api/client/api/ApiClient.java b/src/main/java/video/api/client/api/ApiClient.java index 33ca591..6ecf58e 100644 --- a/src/main/java/video/api/client/api/ApiClient.java +++ b/src/main/java/video/api/client/api/ApiClient.java @@ -120,7 +120,7 @@ private OkHttpClient initHttpClient(List interceptors) { private void init() { verifyingSsl = true; json = new JSON(); - addDefaultHeader("AV-Origin-Client", "java:1.4.3"); + addDefaultHeader("AV-Origin-Client", "java:1.4.4"); } private boolean isValid(String regex, String field) { diff --git a/src/main/java/video/api/client/api/models/Video.java b/src/main/java/video/api/client/api/models/Video.java index 2e866d3..15ed877 100644 --- a/src/main/java/video/api/client/api/models/Video.java +++ b/src/main/java/video/api/client/api/models/Video.java @@ -72,6 +72,63 @@ public class Video implements Serializable, DeepObject { @SerializedName(SERIALIZED_NAME_DISCARDED) private Boolean discarded; + public static final String SERIALIZED_NAME_LANGUAGE = "language"; + @SerializedName(SERIALIZED_NAME_LANGUAGE) + private String language; + + /** + * 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. + */ + @JsonAdapter(LanguageOriginEnum.Adapter.class) + public enum LanguageOriginEnum { + API("api"), + + AUTO("auto"); + + private String value; + + LanguageOriginEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static LanguageOriginEnum fromValue(String value) { + for (LanguageOriginEnum b : LanguageOriginEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final LanguageOriginEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public LanguageOriginEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return LanguageOriginEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_LANGUAGE_ORIGIN = "languageOrigin"; + @SerializedName(SERIALIZED_NAME_LANGUAGE_ORIGIN) + private LanguageOriginEnum languageOrigin; + public static final String SERIALIZED_NAME_TAGS = "tags"; @SerializedName(SERIALIZED_NAME_TAGS) private List tags = null; @@ -296,6 +353,51 @@ public void setDiscarded(Boolean discarded) { this.discarded = discarded; } + public Video language(String language) { + this.language = language; + return this; + } + + /** + * 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 language + **/ + @javax.annotation.Nullable + @ApiModelProperty(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.") + + public String getLanguage() { + return language; + } + + public void setLanguage(String language) { + this.language = language; + } + + public Video languageOrigin(LanguageOriginEnum languageOrigin) { + this.languageOrigin = languageOrigin; + return this; + } + + /** + * 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 languageOrigin + **/ + @javax.annotation.Nullable + @ApiModelProperty(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.") + + public LanguageOriginEnum getLanguageOrigin() { + return languageOrigin; + } + + public void setLanguageOrigin(LanguageOriginEnum languageOrigin) { + this.languageOrigin = languageOrigin; + } + public Video tags(List tags) { this.tags = tags; return this; @@ -498,16 +600,19 @@ public boolean equals(Object o) { && Objects.equals(this.updatedAt, video.updatedAt) && Objects.equals(this.discardedAt, video.discardedAt) && Objects.equals(this.deletesAt, video.deletesAt) && Objects.equals(this.discarded, video.discarded) - && Objects.equals(this.tags, video.tags) && Objects.equals(this.metadata, video.metadata) - && Objects.equals(this.source, video.source) && Objects.equals(this.assets, video.assets) - && Objects.equals(this.playerId, video.playerId) && Objects.equals(this._public, video._public) - && Objects.equals(this.panoramic, video.panoramic) && Objects.equals(this.mp4Support, video.mp4Support); + && Objects.equals(this.language, video.language) + && Objects.equals(this.languageOrigin, video.languageOrigin) && Objects.equals(this.tags, video.tags) + && Objects.equals(this.metadata, video.metadata) && Objects.equals(this.source, video.source) + && Objects.equals(this.assets, video.assets) && Objects.equals(this.playerId, video.playerId) + && Objects.equals(this._public, video._public) && Objects.equals(this.panoramic, video.panoramic) + && Objects.equals(this.mp4Support, video.mp4Support); } @Override public int hashCode() { return Objects.hash(videoId, createdAt, title, description, publishedAt, updatedAt, discardedAt, deletesAt, - discarded, tags, metadata, source, assets, playerId, _public, panoramic, mp4Support); + discarded, language, languageOrigin, tags, metadata, source, assets, playerId, _public, panoramic, + mp4Support); } @Override @@ -523,6 +628,8 @@ public String toString() { sb.append(" discardedAt: ").append(toIndentedString(discardedAt)).append("\n"); sb.append(" deletesAt: ").append(toIndentedString(deletesAt)).append("\n"); sb.append(" discarded: ").append(toIndentedString(discarded)).append("\n"); + sb.append(" language: ").append(toIndentedString(language)).append("\n"); + sb.append(" languageOrigin: ").append(toIndentedString(languageOrigin)).append("\n"); sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); sb.append(" source: ").append(toIndentedString(source)).append("\n"); diff --git a/src/main/java/video/api/client/api/models/VideoCreationPayload.java b/src/main/java/video/api/client/api/models/VideoCreationPayload.java index bd335be..835b60f 100644 --- a/src/main/java/video/api/client/api/models/VideoCreationPayload.java +++ b/src/main/java/video/api/client/api/models/VideoCreationPayload.java @@ -79,6 +79,128 @@ public class VideoCreationPayload implements Serializable, DeepObject { @SerializedName(SERIALIZED_NAME_WATERMARK) private VideoWatermark watermark; + /** + * 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. + */ + @JsonAdapter(LanguageEnum.Adapter.class) + public enum LanguageEnum { + 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"); + + private String value; + + LanguageEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static LanguageEnum fromValue(String value) { + for (LanguageEnum b : LanguageEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final LanguageEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public LanguageEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return LanguageEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_LANGUAGE = "language"; + @SerializedName(SERIALIZED_NAME_LANGUAGE) + private LanguageEnum language; + + public static final String SERIALIZED_NAME_TRANSCRIPT = "transcript"; + @SerializedName(SERIALIZED_NAME_TRANSCRIPT) + private Boolean transcript; + public VideoCreationPayload title(String title) { this.title = title; return this; @@ -329,6 +451,56 @@ public void setWatermark(VideoWatermark watermark) { this.watermark = watermark; } + public VideoCreationPayload language(LanguageEnum language) { + this.language = language; + return this; + } + + /** + * 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 language + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "fr", 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.") + + public LanguageEnum getLanguage() { + return language; + } + + public void setLanguage(LanguageEnum language) { + this.language = language; + } + + public VideoCreationPayload transcript(Boolean transcript) { + this.transcript = transcript; + return this; + } + + /** + * 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 transcript + **/ + @javax.annotation.Nullable + @ApiModelProperty(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.") + + public Boolean getTranscript() { + return transcript; + } + + public void setTranscript(Boolean transcript) { + this.transcript = transcript; + } + @Override public boolean equals(Object o) { if (this == o) { @@ -348,13 +520,15 @@ public boolean equals(Object o) { && Objects.equals(this.tags, videoCreationPayload.tags) && Objects.equals(this.metadata, videoCreationPayload.metadata) && Objects.equals(this.clip, videoCreationPayload.clip) - && Objects.equals(this.watermark, videoCreationPayload.watermark); + && Objects.equals(this.watermark, videoCreationPayload.watermark) + && Objects.equals(this.language, videoCreationPayload.language) + && Objects.equals(this.transcript, videoCreationPayload.transcript); } @Override public int hashCode() { return Objects.hash(title, description, source, _public, panoramic, mp4Support, playerId, tags, metadata, clip, - watermark); + watermark, language, transcript); } @Override @@ -372,6 +546,8 @@ public String toString() { sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); sb.append(" clip: ").append(toIndentedString(clip)).append("\n"); sb.append(" watermark: ").append(toIndentedString(watermark)).append("\n"); + sb.append(" language: ").append(toIndentedString(language)).append("\n"); + sb.append(" transcript: ").append(toIndentedString(transcript)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/src/main/java/video/api/client/api/models/VideoUpdatePayload.java b/src/main/java/video/api/client/api/models/VideoUpdatePayload.java index 7eab4f8..347995e 100644 --- a/src/main/java/video/api/client/api/models/VideoUpdatePayload.java +++ b/src/main/java/video/api/client/api/models/VideoUpdatePayload.java @@ -65,6 +65,128 @@ public class VideoUpdatePayload implements Serializable, DeepObject { @SerializedName(SERIALIZED_NAME_METADATA) private List metadata = null; + /** + * 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. + */ + @JsonAdapter(LanguageEnum.Adapter.class) + public enum LanguageEnum { + 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"); + + private String value; + + LanguageEnum(String value) { + this.value = value; + } + + public String getValue() { + return value; + } + + @Override + public String toString() { + return String.valueOf(value); + } + + public static LanguageEnum fromValue(String value) { + for (LanguageEnum b : LanguageEnum.values()) { + if (b.value.equals(value)) { + return b; + } + } + throw new IllegalArgumentException("Unexpected value '" + value + "'"); + } + + public static class Adapter extends TypeAdapter { + @Override + public void write(final JsonWriter jsonWriter, final LanguageEnum enumeration) throws IOException { + jsonWriter.value(enumeration.getValue()); + } + + @Override + public LanguageEnum read(final JsonReader jsonReader) throws IOException { + String value = jsonReader.nextString(); + return LanguageEnum.fromValue(value); + } + } + } + + public static final String SERIALIZED_NAME_LANGUAGE = "language"; + @SerializedName(SERIALIZED_NAME_LANGUAGE) + private LanguageEnum language; + + public static final String SERIALIZED_NAME_TRANSCRIPT = "transcript"; + @SerializedName(SERIALIZED_NAME_TRANSCRIPT) + private Boolean transcript; + public VideoUpdatePayload playerId(String playerId) { this.playerId = new Nullable(playerId); @@ -259,6 +381,56 @@ public void setMetadata(List metadata) { this.metadata = metadata; } + public VideoUpdatePayload language(LanguageEnum language) { + this.language = language; + return this; + } + + /** + * 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 language + **/ + @javax.annotation.Nullable + @ApiModelProperty(example = "fr", 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.") + + public LanguageEnum getLanguage() { + return language; + } + + public void setLanguage(LanguageEnum language) { + this.language = language; + } + + public VideoUpdatePayload transcript(Boolean transcript) { + this.transcript = transcript; + return this; + } + + /** + * 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 transcript + **/ + @javax.annotation.Nullable + @ApiModelProperty(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.") + + public Boolean getTranscript() { + return transcript; + } + + public void setTranscript(Boolean transcript) { + this.transcript = transcript; + } + @Override public boolean equals(Object o) { if (this == o) { @@ -275,12 +447,15 @@ public boolean equals(Object o) { && Objects.equals(this.panoramic, videoUpdatePayload.panoramic) && Objects.equals(this.mp4Support, videoUpdatePayload.mp4Support) && Objects.equals(this.tags, videoUpdatePayload.tags) - && Objects.equals(this.metadata, videoUpdatePayload.metadata); + && Objects.equals(this.metadata, videoUpdatePayload.metadata) + && Objects.equals(this.language, videoUpdatePayload.language) + && Objects.equals(this.transcript, videoUpdatePayload.transcript); } @Override public int hashCode() { - return Objects.hash(playerId, title, description, _public, panoramic, mp4Support, tags, metadata); + return Objects.hash(playerId, title, description, _public, panoramic, mp4Support, tags, metadata, language, + transcript); } @Override @@ -295,6 +470,8 @@ public String toString() { sb.append(" mp4Support: ").append(toIndentedString(mp4Support)).append("\n"); sb.append(" tags: ").append(toIndentedString(tags)).append("\n"); sb.append(" metadata: ").append(toIndentedString(metadata)).append("\n"); + sb.append(" language: ").append(toIndentedString(language)).append("\n"); + sb.append(" transcript: ").append(toIndentedString(transcript)).append("\n"); sb.append("}"); return sb.toString(); } diff --git a/src/test/java/video/api/client/api/clients/VideosApiTest.java b/src/test/java/video/api/client/api/clients/VideosApiTest.java index 3d95148..fae349f 100644 --- a/src/test/java/video/api/client/api/clients/VideosApiTest.java +++ b/src/test/java/video/api/client/api/clients/VideosApiTest.java @@ -316,7 +316,7 @@ public void responseWithStatus200Test() throws ApiException { @Test @DisplayName("400 response") public void responseWithStatus400Test() throws ApiException { - answerOnAnyRequest(400, readResourceFile(PAYLOADS_PATH + "responses/400.json")); + answerOnAnyRequest(400, readResourceFile(PAYLOADS_PATH + "responses/400-0.json")); assertThatThrownBy(() -> api.update("vi4blUQJFrYWbaG44NChkH27", new VideoUpdatePayload())) .isInstanceOf(ApiException.class) @@ -452,7 +452,7 @@ public void responseWithStatus201Test() throws ApiException { @Test @DisplayName("400 response") public void responseWithStatus400Test() throws ApiException { - answerOnAnyRequest(400, readResourceFile(PAYLOADS_PATH + "responses/400.json")); + answerOnAnyRequest(400, readResourceFile(PAYLOADS_PATH + "responses/400-0.json")); assertThatThrownBy(() -> api.create(new VideoCreationPayload().title("title"))) .isInstanceOf(ApiException.class) diff --git a/src/test/resources/payloads/videos/create/responses/201.json b/src/test/resources/payloads/videos/create/responses/201.json index fbcda04..6d0d225 100644 --- a/src/test/resources/payloads/videos/create/responses/201.json +++ b/src/test/resources/payloads/videos/create/responses/201.json @@ -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, diff --git a/src/test/resources/payloads/videos/create/responses/400.json b/src/test/resources/payloads/videos/create/responses/400-0.json similarity index 100% rename from src/test/resources/payloads/videos/create/responses/400.json rename to src/test/resources/payloads/videos/create/responses/400-0.json diff --git a/src/test/resources/payloads/videos/create/responses/400-1.json b/src/test/resources/payloads/videos/create/responses/400-1.json new file mode 100644 index 0000000..c67814e --- /dev/null +++ b/src/test/resources/payloads/videos/create/responses/400-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 must contain only letters and dashes (for example \"fr\", \"fr-BE\").", + "name" : "language" +} \ No newline at end of file diff --git a/src/test/resources/payloads/videos/create/responses/400-2.json b/src/test/resources/payloads/videos/create/responses/400-2.json new file mode 100644 index 0000000..fc103e0 --- /dev/null +++ b/src/test/resources/payloads/videos/create/responses/400-2.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/src/test/resources/payloads/videos/get/responses/200.json b/src/test/resources/payloads/videos/get/responses/200.json index c6df209..05a4a7a 100644 --- a/src/test/resources/payloads/videos/get/responses/200.json +++ b/src/test/resources/payloads/videos/get/responses/200.json @@ -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, diff --git a/src/test/resources/payloads/videos/list/responses/200.json b/src/test/resources/payloads/videos/list/responses/200.json index 16b27a5..e2747ed 100644 --- a/src/test/resources/payloads/videos/list/responses/200.json +++ b/src/test/resources/payloads/videos/list/responses/200.json @@ -4,6 +4,8 @@ "playerId" : "pl45KFKdlddgk654dspkze", "title" : "Maths video", "description" : "An amazing video explaining the string theory", + "language" : "en", + "languageOrigin" : "api", "public" : false, "panoramic" : false, "mp4Support" : true, @@ -32,6 +34,8 @@ "videoId" : "vi4blUQJFrYWbaG44NChkH27", "title" : "Video Title", "description" : "A description for your video.", + "language" : "en", + "languageOrigin" : "api", "public" : false, "panoramic" : false, "mp4Support" : true, @@ -64,6 +68,8 @@ "playerId" : "pl45KFKdlddgk654dspkze", "title" : "My Video Title", "description" : "A brief description of the video.", + "language" : "fr", + "languageOrigin" : "api", "public" : false, "panoramic" : false, "mp4Support" : true, diff --git a/src/test/resources/payloads/videos/update/responses/200.json b/src/test/resources/payloads/videos/update/responses/200.json index f466a51..db100f4 100644 --- a/src/test/resources/payloads/videos/update/responses/200.json +++ b/src/test/resources/payloads/videos/update/responses/200.json @@ -3,6 +3,8 @@ "playerId" : "pl45KFKdlddgk654dspkze", "title" : "Maths video", "description" : "An amazing video explaining the string theory", + "language" : "en", + "languageOrigin" : "api", "public" : false, "panoramic" : false, "mp4Support" : true, diff --git a/src/test/resources/payloads/videos/update/responses/400.json b/src/test/resources/payloads/videos/update/responses/400-0.json similarity index 100% rename from src/test/resources/payloads/videos/update/responses/400.json rename to src/test/resources/payloads/videos/update/responses/400-0.json diff --git a/src/test/resources/payloads/videos/update/responses/400-1.json b/src/test/resources/payloads/videos/update/responses/400-1.json new file mode 100644 index 0000000..c67814e --- /dev/null +++ b/src/test/resources/payloads/videos/update/responses/400-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 must contain only letters and dashes (for example \"fr\", \"fr-BE\").", + "name" : "language" +} \ No newline at end of file diff --git a/src/test/resources/payloads/videos/update/responses/400-2.json b/src/test/resources/payloads/videos/update/responses/400-2.json new file mode 100644 index 0000000..fc103e0 --- /dev/null +++ b/src/test/resources/payloads/videos/update/responses/400-2.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/src/test/resources/payloads/videos/uploadWithUploadToken/responses/201.json b/src/test/resources/payloads/videos/uploadWithUploadToken/responses/201.json index 8aeb102..37424d1 100644 --- a/src/test/resources/payloads/videos/uploadWithUploadToken/responses/201.json +++ b/src/test/resources/payloads/videos/uploadWithUploadToken/responses/201.json @@ -3,6 +3,7 @@ "playerId" : "pl45KFKdlddgk654dspkze", "title" : "Maths video", "description" : "An amazing video explaining the string theory", + "language" : "en", "public" : false, "panoramic" : false, "tags" : [ "maths", "string theory", "video" ],