From 012dde2bbf8a072edf6fed89a096f0655517d106 Mon Sep 17 00:00:00 2001 From: DX-Bandwidth Date: Tue, 23 Jun 2026 15:05:35 +0000 Subject: [PATCH 1/3] Generate SDK with OpenAPI Generator Version --- .openapi-generator/FILES | 2 + README.md | 1 + api/openapi.yaml | 73 +++- bandwidth.yml | 70 ++++ docs/RecordingTranscriptionClip.md | 17 + docs/RecordingTranscriptions.md | 1 + docs/Transcription.md | 1 + src/main/java/com/bandwidth/sdk/JSON.java | 1 + .../sdk/model/RecordingTranscriptionClip.java | 394 ++++++++++++++++++ .../sdk/model/RecordingTranscriptions.java | 55 ++- .../bandwidth/sdk/model/Transcription.java | 32 +- 11 files changed, 634 insertions(+), 13 deletions(-) create mode 100644 docs/RecordingTranscriptionClip.md create mode 100644 src/main/java/com/bandwidth/sdk/model/RecordingTranscriptionClip.java diff --git a/.openapi-generator/FILES b/.openapi-generator/FILES index 0da4f8c5..08281dbe 100644 --- a/.openapi-generator/FILES +++ b/.openapi-generator/FILES @@ -163,6 +163,7 @@ docs/RbmWebViewEnum.md docs/RecordingAvailableCallback.md docs/RecordingCompleteCallback.md docs/RecordingStateEnum.md +docs/RecordingTranscriptionClip.md docs/RecordingTranscriptionMetadata.md docs/RecordingTranscriptions.md docs/RecordingsApi.md @@ -407,6 +408,7 @@ src/main/java/com/bandwidth/sdk/model/RbmWebViewEnum.java src/main/java/com/bandwidth/sdk/model/RecordingAvailableCallback.java src/main/java/com/bandwidth/sdk/model/RecordingCompleteCallback.java src/main/java/com/bandwidth/sdk/model/RecordingStateEnum.java +src/main/java/com/bandwidth/sdk/model/RecordingTranscriptionClip.java src/main/java/com/bandwidth/sdk/model/RecordingTranscriptionMetadata.java src/main/java/com/bandwidth/sdk/model/RecordingTranscriptions.java src/main/java/com/bandwidth/sdk/model/RedirectCallback.java diff --git a/README.md b/README.md index 0f80d7dc..81f72dd0 100644 --- a/README.md +++ b/README.md @@ -340,6 +340,7 @@ Class | Method | HTTP request | Description - [RecordingAvailableCallback](docs/RecordingAvailableCallback.md) - [RecordingCompleteCallback](docs/RecordingCompleteCallback.md) - [RecordingStateEnum](docs/RecordingStateEnum.md) + - [RecordingTranscriptionClip](docs/RecordingTranscriptionClip.md) - [RecordingTranscriptionMetadata](docs/RecordingTranscriptionMetadata.md) - [RecordingTranscriptions](docs/RecordingTranscriptions.md) - [RedirectCallback](docs/RedirectCallback.md) diff --git a/api/openapi.yaml b/api/openapi.yaml index 829a814e..b6b27331 100644 --- a/api/openapi.yaml +++ b/api/openapi.yaml @@ -12086,15 +12086,73 @@ components: recordingTranscriptions: example: transcripts: - - confidence: 0.9 - text: "Nice talking to you, friend!" - - confidence: 0.9 - text: "Nice talking to you, friend!" + - speaker: 0 + text: "Hi, is Thursday at two still good for you? Perfect, talk soon." + confidence: 0.96 + - speaker: 1 + text: "Yes, that works great. See you then! Sounds good, bye!" + confidence: 0.97 + clips: + - speaker: 0 + text: "Hi, is Thursday at two still good for you?" + confidence: 0.97 + startTimeSeconds: 0.4 + endTimeSeconds: 3.1 + - speaker: 1 + text: "Yes, that works great. See you then!" + confidence: 0.95 + startTimeSeconds: 3.8 + endTimeSeconds: 6.2 + - speaker: 0 + text: "Perfect, talk soon." + confidence: 0.94 + startTimeSeconds: 6.9 + endTimeSeconds: 8.1 + - speaker: 1 + text: "Sounds good, bye!" + confidence: 0.98 + startTimeSeconds: 8.5 + endTimeSeconds: 9.7 properties: transcripts: items: $ref: "#/components/schemas/transcription" type: array + clips: + description: "A list of individual speech clips with speaker, timing, and\ + \ confidence information." + items: + $ref: "#/components/schemas/recordingTranscriptionClip" + type: array + type: object + recordingTranscriptionClip: + properties: + speaker: + description: Zero-based index identifying the speaker. + example: 0 + type: integer + text: + description: The transcribed text of this clip. + example: "Hi there, thanks for calling!" + type: string + confidence: + description: How confident the transcription engine was in transcribing + this clip (from `0.0` to `1.0`). + example: 0.85 + format: double + maximum: 1 + minimum: 0 + type: number + startTimeSeconds: + description: "The start time of this clip within the recording, in seconds." + example: 2.3 + format: double + type: number + endTimeSeconds: + description: "The end time of this clip within the recording, in seconds." + example: 3.1 + format: double + type: number type: object callTranscriptionMetadataList: example: @@ -14185,10 +14243,11 @@ components: type: string type: object transcription: - example: - confidence: 0.9 - text: "Nice talking to you, friend!" properties: + speaker: + description: Zero-based index identifying the speaker. + example: 0 + type: integer text: description: The transcribed text example: "Nice talking to you, friend!" diff --git a/bandwidth.yml b/bandwidth.yml index a380e26d..fd39c5cb 100644 --- a/bandwidth.yml +++ b/bandwidth.yml @@ -4354,6 +4354,72 @@ components: type: array items: $ref: '#/components/schemas/transcription' + clips: + type: array + description: >- + A list of individual speech clips with speaker, timing, and + confidence information. + items: + $ref: '#/components/schemas/recordingTranscriptionClip' + example: + transcripts: + - speaker: 0 + text: Hi, is Thursday at two still good for you? Perfect, talk soon. + confidence: 0.96 + - speaker: 1 + text: Yes, that works great. See you then! Sounds good, bye! + confidence: 0.97 + clips: + - speaker: 0 + text: Hi, is Thursday at two still good for you? + confidence: 0.97 + startTimeSeconds: 0.4 + endTimeSeconds: 3.1 + - speaker: 1 + text: Yes, that works great. See you then! + confidence: 0.95 + startTimeSeconds: 3.8 + endTimeSeconds: 6.2 + - speaker: 0 + text: Perfect, talk soon. + confidence: 0.94 + startTimeSeconds: 6.9 + endTimeSeconds: 8.1 + - speaker: 1 + text: Sounds good, bye! + confidence: 0.98 + startTimeSeconds: 8.5 + endTimeSeconds: 9.7 + recordingTranscriptionClip: + type: object + properties: + speaker: + type: integer + description: Zero-based index identifying the speaker. + example: 0 + text: + type: string + description: The transcribed text of this clip. + example: Hi there, thanks for calling! + confidence: + type: number + format: double + minimum: 0 + maximum: 1 + description: >- + How confident the transcription engine was in transcribing this clip + (from `0.0` to `1.0`). + example: 0.85 + startTimeSeconds: + type: number + format: double + description: The start time of this clip within the recording, in seconds. + example: 2.3 + endTimeSeconds: + type: number + format: double + description: The end time of this clip within the recording, in seconds. + example: 3.1 callTranscriptionMetadataList: type: array items: @@ -5480,6 +5546,10 @@ components: transcription: type: object properties: + speaker: + type: integer + description: Zero-based index identifying the speaker. + example: 0 text: type: string description: The transcribed text diff --git a/docs/RecordingTranscriptionClip.md b/docs/RecordingTranscriptionClip.md new file mode 100644 index 00000000..52d37156 --- /dev/null +++ b/docs/RecordingTranscriptionClip.md @@ -0,0 +1,17 @@ + + +# RecordingTranscriptionClip + + +## Properties + +| Name | Type | Description | Notes | +|------------ | ------------- | ------------- | -------------| +|**speaker** | **Integer** | Zero-based index identifying the speaker. | [optional] | +|**text** | **String** | The transcribed text of this clip. | [optional] | +|**confidence** | **Double** | How confident the transcription engine was in transcribing this clip (from `0.0` to `1.0`). | [optional] | +|**startTimeSeconds** | **Double** | The start time of this clip within the recording, in seconds. | [optional] | +|**endTimeSeconds** | **Double** | The end time of this clip within the recording, in seconds. | [optional] | + + + diff --git a/docs/RecordingTranscriptions.md b/docs/RecordingTranscriptions.md index 43289805..e3e997fe 100644 --- a/docs/RecordingTranscriptions.md +++ b/docs/RecordingTranscriptions.md @@ -8,6 +8,7 @@ | Name | Type | Description | Notes | |------------ | ------------- | ------------- | -------------| |**transcripts** | [**List<Transcription>**](Transcription.md) | | [optional] | +|**clips** | [**List<RecordingTranscriptionClip>**](RecordingTranscriptionClip.md) | A list of individual speech clips with speaker, timing, and confidence information. | [optional] | diff --git a/docs/Transcription.md b/docs/Transcription.md index 009de6b6..d2c8704d 100644 --- a/docs/Transcription.md +++ b/docs/Transcription.md @@ -7,6 +7,7 @@ | Name | Type | Description | Notes | |------------ | ------------- | ------------- | -------------| +|**speaker** | **Integer** | Zero-based index identifying the speaker. | [optional] | |**text** | **String** | The transcribed text | [optional] | |**confidence** | **Double** | The confidence on the recognized content, ranging from `0.0` to `1.0` with `1.0` being the highest confidence. | [optional] | diff --git a/src/main/java/com/bandwidth/sdk/JSON.java b/src/main/java/com/bandwidth/sdk/JSON.java index 7f32723a..45d5cf89 100644 --- a/src/main/java/com/bandwidth/sdk/JSON.java +++ b/src/main/java/com/bandwidth/sdk/JSON.java @@ -270,6 +270,7 @@ private static Class getClassByDiscriminator(Map classByDiscriminatorValue, Stri gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.RbmSuggestionResponse.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.RecordingAvailableCallback.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.RecordingCompleteCallback.CustomTypeAdapterFactory()); + gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.RecordingTranscriptionClip.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.RecordingTranscriptionMetadata.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.RecordingTranscriptions.CustomTypeAdapterFactory()); gsonBuilder.registerTypeAdapterFactory(new com.bandwidth.sdk.model.RedirectCallback.CustomTypeAdapterFactory()); diff --git a/src/main/java/com/bandwidth/sdk/model/RecordingTranscriptionClip.java b/src/main/java/com/bandwidth/sdk/model/RecordingTranscriptionClip.java new file mode 100644 index 00000000..6da224d9 --- /dev/null +++ b/src/main/java/com/bandwidth/sdk/model/RecordingTranscriptionClip.java @@ -0,0 +1,394 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.model; + +import java.util.Objects; +import java.util.Locale; +import com.google.gson.TypeAdapter; +import com.google.gson.annotations.JsonAdapter; +import com.google.gson.annotations.SerializedName; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; +import java.util.Arrays; + +import com.google.gson.Gson; +import com.google.gson.GsonBuilder; +import com.google.gson.JsonArray; +import com.google.gson.JsonDeserializationContext; +import com.google.gson.JsonDeserializer; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonParseException; +import com.google.gson.TypeAdapterFactory; +import com.google.gson.reflect.TypeToken; +import com.google.gson.TypeAdapter; +import com.google.gson.stream.JsonReader; +import com.google.gson.stream.JsonWriter; +import java.io.IOException; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.Locale; + +import com.bandwidth.sdk.JSON; + +/** + * RecordingTranscriptionClip + */ +@javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.17.0") +public class RecordingTranscriptionClip { + public static final String SERIALIZED_NAME_SPEAKER = "speaker"; + @SerializedName(SERIALIZED_NAME_SPEAKER) + @javax.annotation.Nullable + private Integer speaker; + + public static final String SERIALIZED_NAME_TEXT = "text"; + @SerializedName(SERIALIZED_NAME_TEXT) + @javax.annotation.Nullable + private String text; + + public static final String SERIALIZED_NAME_CONFIDENCE = "confidence"; + @SerializedName(SERIALIZED_NAME_CONFIDENCE) + @javax.annotation.Nullable + private Double confidence; + + public static final String SERIALIZED_NAME_START_TIME_SECONDS = "startTimeSeconds"; + @SerializedName(SERIALIZED_NAME_START_TIME_SECONDS) + @javax.annotation.Nullable + private Double startTimeSeconds; + + public static final String SERIALIZED_NAME_END_TIME_SECONDS = "endTimeSeconds"; + @SerializedName(SERIALIZED_NAME_END_TIME_SECONDS) + @javax.annotation.Nullable + private Double endTimeSeconds; + + public RecordingTranscriptionClip() { + } + + public RecordingTranscriptionClip speaker(@javax.annotation.Nullable Integer speaker) { + this.speaker = speaker; + return this; + } + + /** + * Zero-based index identifying the speaker. + * @return speaker + */ + @javax.annotation.Nullable + public Integer getSpeaker() { + return speaker; + } + + public void setSpeaker(@javax.annotation.Nullable Integer speaker) { + this.speaker = speaker; + } + + + public RecordingTranscriptionClip text(@javax.annotation.Nullable String text) { + this.text = text; + return this; + } + + /** + * The transcribed text of this clip. + * @return text + */ + @javax.annotation.Nullable + public String getText() { + return text; + } + + public void setText(@javax.annotation.Nullable String text) { + this.text = text; + } + + + public RecordingTranscriptionClip confidence(@javax.annotation.Nullable Double confidence) { + this.confidence = confidence; + return this; + } + + /** + * How confident the transcription engine was in transcribing this clip (from `0.0` to `1.0`). + * minimum: 0 + * maximum: 1 + * @return confidence + */ + @javax.annotation.Nullable + public Double getConfidence() { + return confidence; + } + + public void setConfidence(@javax.annotation.Nullable Double confidence) { + this.confidence = confidence; + } + + + public RecordingTranscriptionClip startTimeSeconds(@javax.annotation.Nullable Double startTimeSeconds) { + this.startTimeSeconds = startTimeSeconds; + return this; + } + + /** + * The start time of this clip within the recording, in seconds. + * @return startTimeSeconds + */ + @javax.annotation.Nullable + public Double getStartTimeSeconds() { + return startTimeSeconds; + } + + public void setStartTimeSeconds(@javax.annotation.Nullable Double startTimeSeconds) { + this.startTimeSeconds = startTimeSeconds; + } + + + public RecordingTranscriptionClip endTimeSeconds(@javax.annotation.Nullable Double endTimeSeconds) { + this.endTimeSeconds = endTimeSeconds; + return this; + } + + /** + * The end time of this clip within the recording, in seconds. + * @return endTimeSeconds + */ + @javax.annotation.Nullable + public Double getEndTimeSeconds() { + return endTimeSeconds; + } + + public void setEndTimeSeconds(@javax.annotation.Nullable Double endTimeSeconds) { + this.endTimeSeconds = endTimeSeconds; + } + + /** + * A container for additional, undeclared properties. + * This is a holder for any undeclared properties as specified with + * the 'additionalProperties' keyword in the OAS document. + */ + private Map additionalProperties; + + /** + * Set the additional (undeclared) property with the specified name and value. + * If the property does not already exist, create it otherwise replace it. + * + * @param key name of the property + * @param value value of the property + * @return the RecordingTranscriptionClip instance itself + */ + public RecordingTranscriptionClip putAdditionalProperty(String key, Object value) { + if (this.additionalProperties == null) { + this.additionalProperties = new HashMap(); + } + this.additionalProperties.put(key, value); + return this; + } + + /** + * Return the additional (undeclared) property. + * + * @return a map of objects + */ + public Map getAdditionalProperties() { + return additionalProperties; + } + + /** + * Return the additional (undeclared) property with the specified name. + * + * @param key name of the property + * @return an object + */ + public Object getAdditionalProperty(String key) { + if (this.additionalProperties == null) { + return null; + } + return this.additionalProperties.get(key); + } + + + @Override + public boolean equals(Object o) { + if (this == o) { + return true; + } + if (o == null || getClass() != o.getClass()) { + return false; + } + RecordingTranscriptionClip recordingTranscriptionClip = (RecordingTranscriptionClip) o; + return Objects.equals(this.speaker, recordingTranscriptionClip.speaker) && + Objects.equals(this.text, recordingTranscriptionClip.text) && + Objects.equals(this.confidence, recordingTranscriptionClip.confidence) && + Objects.equals(this.startTimeSeconds, recordingTranscriptionClip.startTimeSeconds) && + Objects.equals(this.endTimeSeconds, recordingTranscriptionClip.endTimeSeconds)&& + Objects.equals(this.additionalProperties, recordingTranscriptionClip.additionalProperties); + } + + @Override + public int hashCode() { + return Objects.hash(speaker, text, confidence, startTimeSeconds, endTimeSeconds, additionalProperties); + } + + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("class RecordingTranscriptionClip {\n"); + sb.append(" speaker: ").append(toIndentedString(speaker)).append("\n"); + sb.append(" text: ").append(toIndentedString(text)).append("\n"); + sb.append(" confidence: ").append(toIndentedString(confidence)).append("\n"); + sb.append(" startTimeSeconds: ").append(toIndentedString(startTimeSeconds)).append("\n"); + sb.append(" endTimeSeconds: ").append(toIndentedString(endTimeSeconds)).append("\n"); + sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); + sb.append("}"); + return sb.toString(); + } + + /** + * Convert the given object to string with each line indented by 4 spaces + * (except the first line). + */ + private String toIndentedString(Object o) { + if (o == null) { + return "null"; + } + return o.toString().replace("\n", "\n "); + } + + + public static HashSet openapiFields; + public static HashSet openapiRequiredFields; + + static { + // a set of all properties/fields (JSON key names) + openapiFields = new HashSet(Arrays.asList("speaker", "text", "confidence", "startTimeSeconds", "endTimeSeconds")); + + // a set of required properties/fields (JSON key names) + openapiRequiredFields = new HashSet(0); + } + + /** + * Validates the JSON Element and throws an exception if issues found + * + * @param jsonElement JSON Element + * @throws IOException if the JSON Element is invalid with respect to RecordingTranscriptionClip + */ + public static void validateJsonElement(JsonElement jsonElement) throws IOException { + if (jsonElement == null) { + if (!RecordingTranscriptionClip.openapiRequiredFields.isEmpty()) { // has required fields but JSON element is null + throw new IllegalArgumentException(String.format(Locale.ROOT, "The required field(s) %s in RecordingTranscriptionClip is not found in the empty JSON string", RecordingTranscriptionClip.openapiRequiredFields.toString())); + } + } + JsonObject jsonObj = jsonElement.getAsJsonObject(); + if ((jsonObj.get("text") != null && !jsonObj.get("text").isJsonNull()) && !jsonObj.get("text").isJsonPrimitive()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `text` to be a primitive type in the JSON string but got `%s`", jsonObj.get("text").toString())); + } + } + + public static class CustomTypeAdapterFactory implements TypeAdapterFactory { + @SuppressWarnings("unchecked") + @Override + public TypeAdapter create(Gson gson, TypeToken type) { + if (!RecordingTranscriptionClip.class.isAssignableFrom(type.getRawType())) { + return null; // this class only serializes 'RecordingTranscriptionClip' and its subtypes + } + final TypeAdapter elementAdapter = gson.getAdapter(JsonElement.class); + final TypeAdapter thisAdapter + = gson.getDelegateAdapter(this, TypeToken.get(RecordingTranscriptionClip.class)); + + return (TypeAdapter) new TypeAdapter() { + @Override + public void write(JsonWriter out, RecordingTranscriptionClip value) throws IOException { + JsonObject obj = thisAdapter.toJsonTree(value).getAsJsonObject(); + obj.remove("additionalProperties"); + // serialize additional properties + if (value.getAdditionalProperties() != null) { + for (Map.Entry entry : value.getAdditionalProperties().entrySet()) { + if (entry.getValue() instanceof String) + obj.addProperty(entry.getKey(), (String) entry.getValue()); + else if (entry.getValue() instanceof Number) + obj.addProperty(entry.getKey(), (Number) entry.getValue()); + else if (entry.getValue() instanceof Boolean) + obj.addProperty(entry.getKey(), (Boolean) entry.getValue()); + else if (entry.getValue() instanceof Character) + obj.addProperty(entry.getKey(), (Character) entry.getValue()); + else { + JsonElement jsonElement = gson.toJsonTree(entry.getValue()); + if (jsonElement.isJsonArray()) { + obj.add(entry.getKey(), jsonElement.getAsJsonArray()); + } else { + obj.add(entry.getKey(), jsonElement.getAsJsonObject()); + } + } + } + } + elementAdapter.write(out, obj); + } + + @Override + public RecordingTranscriptionClip read(JsonReader in) throws IOException { + JsonElement jsonElement = elementAdapter.read(in); + validateJsonElement(jsonElement); + JsonObject jsonObj = jsonElement.getAsJsonObject(); + // store additional fields in the deserialized instance + RecordingTranscriptionClip instance = thisAdapter.fromJsonTree(jsonObj); + for (Map.Entry entry : jsonObj.entrySet()) { + if (!openapiFields.contains(entry.getKey())) { + if (entry.getValue().isJsonPrimitive()) { // primitive type + if (entry.getValue().getAsJsonPrimitive().isString()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsString()); + else if (entry.getValue().getAsJsonPrimitive().isNumber()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsNumber()); + else if (entry.getValue().getAsJsonPrimitive().isBoolean()) + instance.putAdditionalProperty(entry.getKey(), entry.getValue().getAsBoolean()); + else + throw new IllegalArgumentException(String.format(Locale.ROOT, "The field `%s` has unknown primitive type. Value: %s", entry.getKey(), entry.getValue().toString())); + } else if (entry.getValue().isJsonArray()) { + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), List.class)); + } else { // JSON object + instance.putAdditionalProperty(entry.getKey(), gson.fromJson(entry.getValue(), HashMap.class)); + } + } + } + return instance; + } + + }.nullSafe(); + } + } + + /** + * Create an instance of RecordingTranscriptionClip given an JSON string + * + * @param jsonString JSON string + * @return An instance of RecordingTranscriptionClip + * @throws IOException if the JSON string is invalid with respect to RecordingTranscriptionClip + */ + public static RecordingTranscriptionClip fromJson(String jsonString) throws IOException { + return JSON.getGson().fromJson(jsonString, RecordingTranscriptionClip.class); + } + + /** + * Convert an instance of RecordingTranscriptionClip to an JSON string + * + * @return JSON string + */ + public String toJson() { + return JSON.getGson().toJson(this); + } +} + diff --git a/src/main/java/com/bandwidth/sdk/model/RecordingTranscriptions.java b/src/main/java/com/bandwidth/sdk/model/RecordingTranscriptions.java index 4b0f97e6..9c8a578f 100644 --- a/src/main/java/com/bandwidth/sdk/model/RecordingTranscriptions.java +++ b/src/main/java/com/bandwidth/sdk/model/RecordingTranscriptions.java @@ -15,6 +15,7 @@ import java.util.Objects; import java.util.Locale; +import com.bandwidth.sdk.model.RecordingTranscriptionClip; import com.bandwidth.sdk.model.Transcription; import com.google.gson.TypeAdapter; import com.google.gson.annotations.JsonAdapter; @@ -60,6 +61,11 @@ public class RecordingTranscriptions { @javax.annotation.Nullable private List transcripts = new ArrayList<>(); + public static final String SERIALIZED_NAME_CLIPS = "clips"; + @SerializedName(SERIALIZED_NAME_CLIPS) + @javax.annotation.Nullable + private List clips = new ArrayList<>(); + public RecordingTranscriptions() { } @@ -89,6 +95,33 @@ public void setTranscripts(@javax.annotation.Nullable List transc this.transcripts = transcripts; } + + public RecordingTranscriptions clips(@javax.annotation.Nullable List clips) { + this.clips = clips; + return this; + } + + public RecordingTranscriptions addClipsItem(RecordingTranscriptionClip clipsItem) { + if (this.clips == null) { + this.clips = new ArrayList<>(); + } + this.clips.add(clipsItem); + return this; + } + + /** + * A list of individual speech clips with speaker, timing, and confidence information. + * @return clips + */ + @javax.annotation.Nullable + public List getClips() { + return clips; + } + + public void setClips(@javax.annotation.Nullable List clips) { + this.clips = clips; + } + /** * A container for additional, undeclared properties. * This is a holder for any undeclared properties as specified with @@ -144,13 +177,14 @@ public boolean equals(Object o) { return false; } RecordingTranscriptions recordingTranscriptions = (RecordingTranscriptions) o; - return Objects.equals(this.transcripts, recordingTranscriptions.transcripts)&& + return Objects.equals(this.transcripts, recordingTranscriptions.transcripts) && + Objects.equals(this.clips, recordingTranscriptions.clips)&& Objects.equals(this.additionalProperties, recordingTranscriptions.additionalProperties); } @Override public int hashCode() { - return Objects.hash(transcripts, additionalProperties); + return Objects.hash(transcripts, clips, additionalProperties); } @Override @@ -158,6 +192,7 @@ public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class RecordingTranscriptions {\n"); sb.append(" transcripts: ").append(toIndentedString(transcripts)).append("\n"); + sb.append(" clips: ").append(toIndentedString(clips)).append("\n"); sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); sb.append("}"); return sb.toString(); @@ -180,7 +215,7 @@ private String toIndentedString(Object o) { static { // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(Arrays.asList("transcripts")); + openapiFields = new HashSet(Arrays.asList("transcripts", "clips")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet(0); @@ -213,6 +248,20 @@ public static void validateJsonElement(JsonElement jsonElement) throws IOExcepti }; } } + if (jsonObj.get("clips") != null && !jsonObj.get("clips").isJsonNull()) { + JsonArray jsonArrayclips = jsonObj.getAsJsonArray("clips"); + if (jsonArrayclips != null) { + // ensure the json data is an array + if (!jsonObj.get("clips").isJsonArray()) { + throw new IllegalArgumentException(String.format(Locale.ROOT, "Expected the field `clips` to be an array in the JSON string but got `%s`", jsonObj.get("clips").toString())); + } + + // validate the optional field `clips` (array) + for (int i = 0; i < jsonArrayclips.size(); i++) { + RecordingTranscriptionClip.validateJsonElement(jsonArrayclips.get(i)); + }; + } + } } public static class CustomTypeAdapterFactory implements TypeAdapterFactory { diff --git a/src/main/java/com/bandwidth/sdk/model/Transcription.java b/src/main/java/com/bandwidth/sdk/model/Transcription.java index d254c619..d2ff2fb4 100644 --- a/src/main/java/com/bandwidth/sdk/model/Transcription.java +++ b/src/main/java/com/bandwidth/sdk/model/Transcription.java @@ -52,6 +52,11 @@ */ @javax.annotation.Generated(value = "org.openapitools.codegen.languages.JavaClientCodegen", comments = "Generator version: 7.17.0") public class Transcription { + public static final String SERIALIZED_NAME_SPEAKER = "speaker"; + @SerializedName(SERIALIZED_NAME_SPEAKER) + @javax.annotation.Nullable + private Integer speaker; + public static final String SERIALIZED_NAME_TEXT = "text"; @SerializedName(SERIALIZED_NAME_TEXT) @javax.annotation.Nullable @@ -65,6 +70,25 @@ public class Transcription { public Transcription() { } + public Transcription speaker(@javax.annotation.Nullable Integer speaker) { + this.speaker = speaker; + return this; + } + + /** + * Zero-based index identifying the speaker. + * @return speaker + */ + @javax.annotation.Nullable + public Integer getSpeaker() { + return speaker; + } + + public void setSpeaker(@javax.annotation.Nullable Integer speaker) { + this.speaker = speaker; + } + + public Transcription text(@javax.annotation.Nullable String text) { this.text = text; return this; @@ -157,20 +181,22 @@ public boolean equals(Object o) { return false; } Transcription transcription = (Transcription) o; - return Objects.equals(this.text, transcription.text) && + return Objects.equals(this.speaker, transcription.speaker) && + Objects.equals(this.text, transcription.text) && Objects.equals(this.confidence, transcription.confidence)&& Objects.equals(this.additionalProperties, transcription.additionalProperties); } @Override public int hashCode() { - return Objects.hash(text, confidence, additionalProperties); + return Objects.hash(speaker, text, confidence, additionalProperties); } @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("class Transcription {\n"); + sb.append(" speaker: ").append(toIndentedString(speaker)).append("\n"); sb.append(" text: ").append(toIndentedString(text)).append("\n"); sb.append(" confidence: ").append(toIndentedString(confidence)).append("\n"); sb.append(" additionalProperties: ").append(toIndentedString(additionalProperties)).append("\n"); @@ -195,7 +221,7 @@ private String toIndentedString(Object o) { static { // a set of all properties/fields (JSON key names) - openapiFields = new HashSet(Arrays.asList("text", "confidence")); + openapiFields = new HashSet(Arrays.asList("speaker", "text", "confidence")); // a set of required properties/fields (JSON key names) openapiRequiredFields = new HashSet(0); From 0b44a131f1a1809ac107d71b582bc83fc6c4ad60 Mon Sep 17 00:00:00 2001 From: ckoegel Date: Tue, 23 Jun 2026 13:40:18 -0400 Subject: [PATCH 2/3] unit tests --- .../sdk/unit/models/ErrorResponseTest.java | 71 ---------------- .../RecordingTranscriptionClipTest.java | 83 +++++++++++++++++++ .../models/RecordingTranscriptionsTest.java | 13 ++- .../sdk/unit/models/TranscriptionTest.java | 9 ++ 4 files changed, 104 insertions(+), 72 deletions(-) delete mode 100644 src/test/java/com/bandwidth/sdk/unit/models/ErrorResponseTest.java create mode 100644 src/test/java/com/bandwidth/sdk/unit/models/RecordingTranscriptionClipTest.java diff --git a/src/test/java/com/bandwidth/sdk/unit/models/ErrorResponseTest.java b/src/test/java/com/bandwidth/sdk/unit/models/ErrorResponseTest.java deleted file mode 100644 index 1e49dbd0..00000000 --- a/src/test/java/com/bandwidth/sdk/unit/models/ErrorResponseTest.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Bandwidth - * Bandwidth's Communication APIs - * - * The version of the OpenAPI document: 1.0.0 - * Contact: letstalk@bandwidth.com - * - * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). - * https://openapi-generator.tech - * Do not edit the class manually. - */ - -package com.bandwidth.sdk.unit.models; - -import org.junit.jupiter.api.Test; - -import java.util.ArrayList; -import java.util.List; -import com.bandwidth.sdk.model.BrtcErrorResponse; -import com.bandwidth.sdk.model.BrtcLink; -import com.bandwidth.sdk.model.BrtcError; - -import static org.hamcrest.MatcherAssert.assertThat; -import static org.hamcrest.CoreMatchers.instanceOf; -import static org.hamcrest.CoreMatchers.is; -import static org.hamcrest.CoreMatchers.nullValue; -import static org.hamcrest.CoreMatchers.equalTo; - -/** - * Model tests for BrtcErrorResponse - */ -public class ErrorResponseTest { - private final BrtcErrorResponse model = new BrtcErrorResponse() - .links(new ArrayList()) - .data(null) - .errors(new ArrayList()); - - /** - * Model tests for ErrorResponse - */ - @Test - public void testErrorResponse() { - assertThat(model, instanceOf(BrtcErrorResponse.class)); - } - - /** - * Test the property 'links' - */ - @Test - public void linksTest() { - assertThat(model.getLinks(), instanceOf(List.class)); - assertThat(model.getLinks().size(), equalTo(0)); - } - - /** - * Test the property 'data' - */ - @Test - public void dataTest() { - assertThat(model.getData(), is(nullValue())); - } - - /** - * Test the property 'errors' - */ - @Test - public void errorsTest() { - assertThat(model.getErrors(), instanceOf(List.class)); - assertThat(model.getErrors().size(), equalTo(0)); - } -} diff --git a/src/test/java/com/bandwidth/sdk/unit/models/RecordingTranscriptionClipTest.java b/src/test/java/com/bandwidth/sdk/unit/models/RecordingTranscriptionClipTest.java new file mode 100644 index 00000000..cc611763 --- /dev/null +++ b/src/test/java/com/bandwidth/sdk/unit/models/RecordingTranscriptionClipTest.java @@ -0,0 +1,83 @@ +/* + * Bandwidth + * Bandwidth's Communication APIs + * + * The version of the OpenAPI document: 1.0.0 + * Contact: letstalk@bandwidth.com + * + * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech). + * https://openapi-generator.tech + * Do not edit the class manually. + */ + + +package com.bandwidth.sdk.unit.models; + +import org.junit.jupiter.api.Test; + +import com.bandwidth.sdk.model.RecordingTranscriptionClip; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.CoreMatchers.instanceOf; + + +/** + * Model tests for RecordingTranscriptionClip + */ +public class RecordingTranscriptionClipTest { + private final RecordingTranscriptionClip model = new RecordingTranscriptionClip() + .speaker(1) + .text("text") + .confidence(0.5) + .startTimeSeconds(10.0) + .endTimeSeconds(20.0); + + /** + * Model tests for RecordingTranscriptionClip + */ + @Test + public void testRecordingTranscriptionClip() { + assertThat(model, instanceOf(RecordingTranscriptionClip.class)); + } + + /** + * Test the property 'speaker' + */ + @Test + public void speakerTest() { + assertThat(model.getSpeaker(), instanceOf(Integer.class)); + } + + /** + * Test the property 'text' + */ + @Test + public void textTest() { + assertThat(model.getText(), instanceOf(String.class)); + } + + /** + * Test the property 'confidence' + */ + @Test + public void confidenceTest() { + assertThat(model.getConfidence(), instanceOf(Double.class)); + } + + /** + * Test the property 'startTimeSeconds' + */ + @Test + public void startTimeSecondsTest() { + assertThat(model.getStartTimeSeconds(), instanceOf(Double.class)); + } + + /** + * Test the property 'endTimeSeconds' + */ + @Test + public void endTimeSecondsTest() { + assertThat(model.getEndTimeSeconds(), instanceOf(Double.class)); + } + +} diff --git a/src/test/java/com/bandwidth/sdk/unit/models/RecordingTranscriptionsTest.java b/src/test/java/com/bandwidth/sdk/unit/models/RecordingTranscriptionsTest.java index 248b046d..d99cb433 100644 --- a/src/test/java/com/bandwidth/sdk/unit/models/RecordingTranscriptionsTest.java +++ b/src/test/java/com/bandwidth/sdk/unit/models/RecordingTranscriptionsTest.java @@ -17,6 +17,8 @@ import java.util.List; import java.util.Arrays; import java.util.ArrayList; + +import com.bandwidth.sdk.model.RecordingTranscriptionClip; import com.bandwidth.sdk.model.RecordingTranscriptions; import com.bandwidth.sdk.model.Transcription; @@ -28,7 +30,8 @@ */ public class RecordingTranscriptionsTest { private final RecordingTranscriptions model = new RecordingTranscriptions() - .transcripts(new ArrayList(Arrays.asList(new Transcription()))); + .transcripts(new ArrayList(Arrays.asList(new Transcription()))) + .clips(new ArrayList(Arrays.asList(new RecordingTranscriptionClip()))); /** * Model tests for RecordingTranscriptions @@ -46,4 +49,12 @@ public void transcriptsTest() { assertThat(model.getTranscripts(), instanceOf(List.class)); } + /** + * Test the property 'clips' + */ + @Test + public void clipsTest() { + assertThat(model.getClips(), instanceOf(List.class)); + } + } diff --git a/src/test/java/com/bandwidth/sdk/unit/models/TranscriptionTest.java b/src/test/java/com/bandwidth/sdk/unit/models/TranscriptionTest.java index d275db2c..2dc6e95a 100644 --- a/src/test/java/com/bandwidth/sdk/unit/models/TranscriptionTest.java +++ b/src/test/java/com/bandwidth/sdk/unit/models/TranscriptionTest.java @@ -24,6 +24,7 @@ */ public class TranscriptionTest { private final Transcription model = new Transcription() + .speaker(1) .text("text") .confidence(0.5); @@ -35,6 +36,14 @@ public void testTranscription() { assertThat(model, instanceOf(Transcription.class)); } + /** + * Test the property 'speaker' + */ + @Test + public void speakerTest() { + assertThat(model.getSpeaker(), instanceOf(Integer.class)); + } + /** * Test the property 'text' */ From b51e9d46d398f2bf85bf1dfa7ca91bb5c9ea1e05 Mon Sep 17 00:00:00 2001 From: ckoegel Date: Tue, 23 Jun 2026 13:40:25 -0400 Subject: [PATCH 3/3] api unit tests --- .../sdk/unit/api/RecordingsApiTest.java | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/src/test/java/com/bandwidth/sdk/unit/api/RecordingsApiTest.java b/src/test/java/com/bandwidth/sdk/unit/api/RecordingsApiTest.java index eda0f048..4bb04a73 100644 --- a/src/test/java/com/bandwidth/sdk/unit/api/RecordingsApiTest.java +++ b/src/test/java/com/bandwidth/sdk/unit/api/RecordingsApiTest.java @@ -12,7 +12,11 @@ import com.bandwidth.sdk.model.CallRecordingMetadata; import com.bandwidth.sdk.model.FileFormatEnum; import com.bandwidth.sdk.model.RecordingStateEnum; +import com.bandwidth.sdk.model.RecordingTranscriptionClip; import com.bandwidth.sdk.model.RecordingTranscriptionMetadata; +import com.bandwidth.sdk.model.RecordingTranscriptions; +import com.bandwidth.sdk.model.TranscribeRecording; +import com.bandwidth.sdk.model.Transcription; import com.bandwidth.sdk.model.UpdateCallRecording; import static com.bandwidth.sdk.utils.TestingEnvironmentVariables.*; @@ -111,6 +115,58 @@ public void testListCallRecordings() throws ApiException { assertThat(response.getData().get(0).getRecordingName(), instanceOf(String.class)); } + @Test + public void testGetRecordingTranscription() throws ApiException { + ApiResponse response = api.getRecordingTranscriptionWithHttpInfo(BW_ACCOUNT_ID, callId, + recordingId); + + assertThat(response.getStatusCode(), is(200)); + assertThat(response.getData(), instanceOf(RecordingTranscriptions.class)); + assertThat(response.getData().getTranscripts(), instanceOf(List.class)); + assertThat(response.getData().getTranscripts().get(0), instanceOf(Transcription.class)); + assertThat(response.getData().getTranscripts().get(0).getSpeaker(), instanceOf(Integer.class)); + assertThat(response.getData().getTranscripts().get(0).getText(), instanceOf(String.class)); + assertThat(response.getData().getTranscripts().get(0).getConfidence(), instanceOf(Double.class)); + assertThat(response.getData().getClips(), instanceOf(List.class)); + assertThat(response.getData().getClips().get(0), instanceOf(RecordingTranscriptionClip.class)); + assertThat(response.getData().getClips().get(0).getSpeaker(), instanceOf(Integer.class)); + assertThat(response.getData().getClips().get(0).getText(), instanceOf(String.class)); + assertThat(response.getData().getClips().get(0).getConfidence(), instanceOf(Double.class)); + assertThat(response.getData().getClips().get(0).getStartTimeSeconds(), instanceOf(Double.class)); + assertThat(response.getData().getClips().get(0).getEndTimeSeconds(), instanceOf(Double.class)); + } + + @Test + public void testTranscribeCallRecording() throws ApiException { + TranscribeRecording transcribeRecording = new TranscribeRecording() + .callbackUrl(URI.create("https://myServer.example/bandwidth/webhooks/transcriptionAvailable")); + ApiResponse response = api.transcribeCallRecordingWithHttpInfo(BW_ACCOUNT_ID, callId, recordingId, + transcribeRecording); + + assertThat(response.getStatusCode(), is(204)); + } + + @Test + public void testDeleteRecordingTranscription() throws ApiException { + ApiResponse response = api.deleteRecordingTranscriptionWithHttpInfo(BW_ACCOUNT_ID, callId, recordingId); + + assertThat(response.getStatusCode(), is(204)); + } + + @Test + public void testDeleteRecording() throws ApiException { + ApiResponse response = api.deleteRecordingWithHttpInfo(BW_ACCOUNT_ID, callId, recordingId); + + assertThat(response.getStatusCode(), is(204)); + } + + @Test + public void testDeleteRecordingMedia() throws ApiException { + ApiResponse response = api.deleteRecordingMediaWithHttpInfo(BW_ACCOUNT_ID, callId, recordingId); + + assertThat(response.getStatusCode(), is(204)); + } + @Test @Disabled // Prism Error public void testGetCallRecording() throws ApiException {