diff --git a/aws-android-sdk-transcribe/src/main/java/com/amazonaws/services/transcribe/model/StartTranscriptionJobRequest.java b/aws-android-sdk-transcribe/src/main/java/com/amazonaws/services/transcribe/model/StartTranscriptionJobRequest.java index 3feb12c0da..3ee1c759f1 100644 --- a/aws-android-sdk-transcribe/src/main/java/com/amazonaws/services/transcribe/model/StartTranscriptionJobRequest.java +++ b/aws-android-sdk-transcribe/src/main/java/com/amazonaws/services/transcribe/model/StartTranscriptionJobRequest.java @@ -568,6 +568,21 @@ public class StartTranscriptionJobRequest extends AmazonWebServiceRequest implem */ private java.util.Map languageIdSettings; + /** + *

+ * Enables toxic speech detection in your transcript. If you include + * ToxicityDetection in your request, you must also include + * ToxicityCategories. + *

+ *

+ * For information on the types of toxic speech Amazon Transcribe can + * detect, see Detecting toxic speech. + *

+ */ + private java.util.List toxicityDetection; + /** *

* A unique name, chosen by you, for your transcription job. The name that @@ -4172,6 +4187,149 @@ public StartTranscriptionJobRequest clearLanguageIdSettingsEntries() { return this; } + /** + *

+ * Enables toxic speech detection in your transcript. If you include + * ToxicityDetection in your request, you must also include + * ToxicityCategories. + *

+ *

+ * For information on the types of toxic speech Amazon Transcribe can + * detect, see Detecting toxic speech. + *

+ * + * @return

+ * Enables toxic speech detection in your transcript. If you include + * ToxicityDetection in your request, you must also + * include ToxicityCategories. + *

+ *

+ * For information on the types of toxic speech Amazon Transcribe + * can detect, see Detecting toxic speech. + *

+ */ + public java.util.List getToxicityDetection() { + return toxicityDetection; + } + + /** + *

+ * Enables toxic speech detection in your transcript. If you include + * ToxicityDetection in your request, you must also include + * ToxicityCategories. + *

+ *

+ * For information on the types of toxic speech Amazon Transcribe can + * detect, see Detecting toxic speech. + *

+ * + * @param toxicityDetection

+ * Enables toxic speech detection in your transcript. If you + * include ToxicityDetection in your request, you + * must also include ToxicityCategories. + *

+ *

+ * For information on the types of toxic speech Amazon Transcribe + * can detect, see Detecting toxic speech. + *

+ */ + public void setToxicityDetection( + java.util.Collection toxicityDetection) { + if (toxicityDetection == null) { + this.toxicityDetection = null; + return; + } + + this.toxicityDetection = new java.util.ArrayList( + toxicityDetection); + } + + /** + *

+ * Enables toxic speech detection in your transcript. If you include + * ToxicityDetection in your request, you must also include + * ToxicityCategories. + *

+ *

+ * For information on the types of toxic speech Amazon Transcribe can + * detect, see Detecting toxic speech. + *

+ *

+ * Returns a reference to this object so that method calls can be chained + * together. + * + * @param toxicityDetection

+ * Enables toxic speech detection in your transcript. If you + * include ToxicityDetection in your request, you + * must also include ToxicityCategories. + *

+ *

+ * For information on the types of toxic speech Amazon Transcribe + * can detect, see Detecting toxic speech. + *

+ * @return A reference to this updated object so that method calls can be + * chained together. + */ + public StartTranscriptionJobRequest withToxicityDetection( + ToxicityDetectionSettings... toxicityDetection) { + if (getToxicityDetection() == null) { + this.toxicityDetection = new java.util.ArrayList( + toxicityDetection.length); + } + for (ToxicityDetectionSettings value : toxicityDetection) { + this.toxicityDetection.add(value); + } + return this; + } + + /** + *

+ * Enables toxic speech detection in your transcript. If you include + * ToxicityDetection in your request, you must also include + * ToxicityCategories. + *

+ *

+ * For information on the types of toxic speech Amazon Transcribe can + * detect, see Detecting toxic speech. + *

+ *

+ * Returns a reference to this object so that method calls can be chained + * together. + * + * @param toxicityDetection

+ * Enables toxic speech detection in your transcript. If you + * include ToxicityDetection in your request, you + * must also include ToxicityCategories. + *

+ *

+ * For information on the types of toxic speech Amazon Transcribe + * can detect, see Detecting toxic speech. + *

+ * @return A reference to this updated object so that method calls can be + * chained together. + */ + public StartTranscriptionJobRequest withToxicityDetection( + java.util.Collection toxicityDetection) { + setToxicityDetection(toxicityDetection); + return this; + } + /** * Returns a string representation of this object; useful for testing and * debugging. @@ -4220,7 +4378,9 @@ public String toString() { if (getTags() != null) sb.append("Tags: " + getTags() + ","); if (getLanguageIdSettings() != null) - sb.append("LanguageIdSettings: " + getLanguageIdSettings()); + sb.append("LanguageIdSettings: " + getLanguageIdSettings() + ","); + if (getToxicityDetection() != null) + sb.append("ToxicityDetection: " + getToxicityDetection()); sb.append("}"); return sb.toString(); } @@ -4267,6 +4427,8 @@ public int hashCode() { hashCode = prime * hashCode + ((getTags() == null) ? 0 : getTags().hashCode()); hashCode = prime * hashCode + ((getLanguageIdSettings() == null) ? 0 : getLanguageIdSettings().hashCode()); + hashCode = prime * hashCode + + ((getToxicityDetection() == null) ? 0 : getToxicityDetection().hashCode()); return hashCode; } @@ -4375,6 +4537,11 @@ public boolean equals(Object obj) { if (other.getLanguageIdSettings() != null && other.getLanguageIdSettings().equals(this.getLanguageIdSettings()) == false) return false; + if (other.getToxicityDetection() == null ^ this.getToxicityDetection() == null) + return false; + if (other.getToxicityDetection() != null + && other.getToxicityDetection().equals(this.getToxicityDetection()) == false) + return false; return true; } } diff --git a/aws-android-sdk-transcribe/src/main/java/com/amazonaws/services/transcribe/model/ToxicityCategory.java b/aws-android-sdk-transcribe/src/main/java/com/amazonaws/services/transcribe/model/ToxicityCategory.java new file mode 100644 index 0000000000..477c33a0b6 --- /dev/null +++ b/aws-android-sdk-transcribe/src/main/java/com/amazonaws/services/transcribe/model/ToxicityCategory.java @@ -0,0 +1,60 @@ +/* + * Copyright 2010-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). + * You may not use this file except in compliance with the License. + * A copy of the License is located at + * + * http://aws.amazon.com/apache2.0 + * + * or in the "license" file accompanying this file. This file is distributed + * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ + +package com.amazonaws.services.transcribe.model; + +import java.util.HashMap; +import java.util.Map; + +/** + * Toxicity Category + */ +public enum ToxicityCategory { + + ALL("ALL"); + + private String value; + + private ToxicityCategory(String value) { + this.value = value; + } + + @Override + public String toString() { + return value; + } + + private static final Map enumMap; + static { + enumMap = new HashMap(); + enumMap.put("ALL", ALL); + } + + /** + * Use this in place of valueOf. + * + * @param value real value + * @return ToxicityCategory corresponding to the value + */ + public static ToxicityCategory fromValue(String value) { + if (value == null || value.isEmpty()) { + throw new IllegalArgumentException("Value cannot be null or empty!"); + } else if (enumMap.containsKey(value)) { + return enumMap.get(value); + } else { + throw new IllegalArgumentException("Cannot create enum from " + value + " value!"); + } + } +} diff --git a/aws-android-sdk-transcribe/src/main/java/com/amazonaws/services/transcribe/model/ToxicityDetectionSettings.java b/aws-android-sdk-transcribe/src/main/java/com/amazonaws/services/transcribe/model/ToxicityDetectionSettings.java new file mode 100644 index 0000000000..38dd89e6e4 --- /dev/null +++ b/aws-android-sdk-transcribe/src/main/java/com/amazonaws/services/transcribe/model/ToxicityDetectionSettings.java @@ -0,0 +1,177 @@ +/* + * Copyright 2010-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). + * You may not use this file except in compliance with the License. + * A copy of the License is located at + * + * http://aws.amazon.com/apache2.0 + * + * or in the "license" file accompanying this file. This file is distributed + * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ + +package com.amazonaws.services.transcribe.model; + +import java.io.Serializable; + +/** + *

+ * Contains ToxicityCategories, which is a required parameter if + * you want to enable toxicity detection (ToxicityDetection) in + * your transcription request. + *

+ */ +public class ToxicityDetectionSettings implements Serializable { + /** + *

+ * If you include ToxicityDetection in your transcription + * request, you must also include ToxicityCategories. The only + * accepted value for this parameter is ALL. + *

+ */ + private java.util.List toxicityCategories; + + /** + *

+ * If you include ToxicityDetection in your transcription + * request, you must also include ToxicityCategories. The only + * accepted value for this parameter is ALL. + *

+ * + * @return

+ * If you include ToxicityDetection in your + * transcription request, you must also include + * ToxicityCategories. The only accepted value for this + * parameter is ALL. + *

+ */ + public java.util.List getToxicityCategories() { + return toxicityCategories; + } + + /** + *

+ * If you include ToxicityDetection in your transcription + * request, you must also include ToxicityCategories. The only + * accepted value for this parameter is ALL. + *

+ * + * @param toxicityCategories

+ * If you include ToxicityDetection in your + * transcription request, you must also include + * ToxicityCategories. The only accepted value for + * this parameter is ALL. + *

+ */ + public void setToxicityCategories(java.util.Collection toxicityCategories) { + if (toxicityCategories == null) { + this.toxicityCategories = null; + return; + } + + this.toxicityCategories = new java.util.ArrayList(toxicityCategories); + } + + /** + *

+ * If you include ToxicityDetection in your transcription + * request, you must also include ToxicityCategories. The only + * accepted value for this parameter is ALL. + *

+ *

+ * Returns a reference to this object so that method calls can be chained + * together. + * + * @param toxicityCategories

+ * If you include ToxicityDetection in your + * transcription request, you must also include + * ToxicityCategories. The only accepted value for + * this parameter is ALL. + *

+ * @return A reference to this updated object so that method calls can be + * chained together. + */ + public ToxicityDetectionSettings withToxicityCategories(String... toxicityCategories) { + if (getToxicityCategories() == null) { + this.toxicityCategories = new java.util.ArrayList(toxicityCategories.length); + } + for (String value : toxicityCategories) { + this.toxicityCategories.add(value); + } + return this; + } + + /** + *

+ * If you include ToxicityDetection in your transcription + * request, you must also include ToxicityCategories. The only + * accepted value for this parameter is ALL. + *

+ *

+ * Returns a reference to this object so that method calls can be chained + * together. + * + * @param toxicityCategories

+ * If you include ToxicityDetection in your + * transcription request, you must also include + * ToxicityCategories. The only accepted value for + * this parameter is ALL. + *

+ * @return A reference to this updated object so that method calls can be + * chained together. + */ + public ToxicityDetectionSettings withToxicityCategories( + java.util.Collection toxicityCategories) { + setToxicityCategories(toxicityCategories); + return this; + } + + /** + * Returns a string representation of this object; useful for testing and + * debugging. + * + * @return A string representation of this object. + * @see java.lang.Object#toString() + */ + @Override + public String toString() { + StringBuilder sb = new StringBuilder(); + sb.append("{"); + if (getToxicityCategories() != null) + sb.append("ToxicityCategories: " + getToxicityCategories()); + sb.append("}"); + return sb.toString(); + } + + @Override + public int hashCode() { + final int prime = 31; + int hashCode = 1; + + hashCode = prime * hashCode + + ((getToxicityCategories() == null) ? 0 : getToxicityCategories().hashCode()); + return hashCode; + } + + @Override + public boolean equals(Object obj) { + if (this == obj) + return true; + if (obj == null) + return false; + + if (obj instanceof ToxicityDetectionSettings == false) + return false; + ToxicityDetectionSettings other = (ToxicityDetectionSettings) obj; + + if (other.getToxicityCategories() == null ^ this.getToxicityCategories() == null) + return false; + if (other.getToxicityCategories() != null + && other.getToxicityCategories().equals(this.getToxicityCategories()) == false) + return false; + return true; + } +} diff --git a/aws-android-sdk-transcribe/src/main/java/com/amazonaws/services/transcribe/model/TranscriptionJob.java b/aws-android-sdk-transcribe/src/main/java/com/amazonaws/services/transcribe/model/TranscriptionJob.java index 4249889041..c14f79a95d 100644 --- a/aws-android-sdk-transcribe/src/main/java/com/amazonaws/services/transcribe/model/TranscriptionJob.java +++ b/aws-android-sdk-transcribe/src/main/java/com/amazonaws/services/transcribe/model/TranscriptionJob.java @@ -338,6 +338,14 @@ public class TranscriptionJob implements Serializable { */ private java.util.Map languageIdSettings; + /** + *

+ * Provides information about the toxicity detection settings applied to + * your transcription. + *

+ */ + private java.util.List toxicityDetection; + /** *

* The name of the transcription job. Job names are case sensitive and must @@ -2562,6 +2570,92 @@ public TranscriptionJob clearLanguageIdSettingsEntries() { return this; } + /** + *

+ * Provides information about the toxicity detection settings applied to + * your transcription. + *

+ * + * @return

+ * Provides information about the toxicity detection settings + * applied to your transcription. + *

+ */ + public java.util.List getToxicityDetection() { + return toxicityDetection; + } + + /** + *

+ * Provides information about the toxicity detection settings applied to + * your transcription. + *

+ * + * @param toxicityDetection

+ * Provides information about the toxicity detection settings + * applied to your transcription. + *

+ */ + public void setToxicityDetection( + java.util.Collection toxicityDetection) { + if (toxicityDetection == null) { + this.toxicityDetection = null; + return; + } + + this.toxicityDetection = new java.util.ArrayList( + toxicityDetection); + } + + /** + *

+ * Provides information about the toxicity detection settings applied to + * your transcription. + *

+ *

+ * Returns a reference to this object so that method calls can be chained + * together. + * + * @param toxicityDetection

+ * Provides information about the toxicity detection settings + * applied to your transcription. + *

+ * @return A reference to this updated object so that method calls can be + * chained together. + */ + public TranscriptionJob withToxicityDetection(ToxicityDetectionSettings... toxicityDetection) { + if (getToxicityDetection() == null) { + this.toxicityDetection = new java.util.ArrayList( + toxicityDetection.length); + } + for (ToxicityDetectionSettings value : toxicityDetection) { + this.toxicityDetection.add(value); + } + return this; + } + + /** + *

+ * Provides information about the toxicity detection settings applied to + * your transcription. + *

+ *

+ * Returns a reference to this object so that method calls can be chained + * together. + * + * @param toxicityDetection

+ * Provides information about the toxicity detection settings + * applied to your transcription. + *

+ * @return A reference to this updated object so that method calls can be + * chained together. + */ + public TranscriptionJob withToxicityDetection( + java.util.Collection toxicityDetection) { + setToxicityDetection(toxicityDetection); + return this; + } + /** * Returns a string representation of this object; useful for testing and * debugging. @@ -2618,7 +2712,9 @@ public String toString() { if (getSubtitles() != null) sb.append("Subtitles: " + getSubtitles() + ","); if (getLanguageIdSettings() != null) - sb.append("LanguageIdSettings: " + getLanguageIdSettings()); + sb.append("LanguageIdSettings: " + getLanguageIdSettings() + ","); + if (getToxicityDetection() != null) + sb.append("ToxicityDetection: " + getToxicityDetection()); sb.append("}"); return sb.toString(); } @@ -2674,6 +2770,8 @@ public int hashCode() { hashCode = prime * hashCode + ((getSubtitles() == null) ? 0 : getSubtitles().hashCode()); hashCode = prime * hashCode + ((getLanguageIdSettings() == null) ? 0 : getLanguageIdSettings().hashCode()); + hashCode = prime * hashCode + + ((getToxicityDetection() == null) ? 0 : getToxicityDetection().hashCode()); return hashCode; } @@ -2801,6 +2899,11 @@ public boolean equals(Object obj) { if (other.getLanguageIdSettings() != null && other.getLanguageIdSettings().equals(this.getLanguageIdSettings()) == false) return false; + if (other.getToxicityDetection() == null ^ this.getToxicityDetection() == null) + return false; + if (other.getToxicityDetection() != null + && other.getToxicityDetection().equals(this.getToxicityDetection()) == false) + return false; return true; } } diff --git a/aws-android-sdk-transcribe/src/main/java/com/amazonaws/services/transcribe/model/TranscriptionJobSummary.java b/aws-android-sdk-transcribe/src/main/java/com/amazonaws/services/transcribe/model/TranscriptionJobSummary.java index c1e5e72285..eb276711b0 100644 --- a/aws-android-sdk-transcribe/src/main/java/com/amazonaws/services/transcribe/model/TranscriptionJobSummary.java +++ b/aws-android-sdk-transcribe/src/main/java/com/amazonaws/services/transcribe/model/TranscriptionJobSummary.java @@ -202,6 +202,14 @@ public class TranscriptionJobSummary implements Serializable { */ private java.util.List languageCodes; + /** + *

+ * Indicates whether toxicity detection was enabled for the specified + * transcription job. + *

+ */ + private java.util.List toxicityDetection; + /** *

* The name of the transcription job. Job names are case sensitive and must @@ -1588,6 +1596,93 @@ public TranscriptionJobSummary withLanguageCodes( return this; } + /** + *

+ * Indicates whether toxicity detection was enabled for the specified + * transcription job. + *

+ * + * @return

+ * Indicates whether toxicity detection was enabled for the + * specified transcription job. + *

+ */ + public java.util.List getToxicityDetection() { + return toxicityDetection; + } + + /** + *

+ * Indicates whether toxicity detection was enabled for the specified + * transcription job. + *

+ * + * @param toxicityDetection

+ * Indicates whether toxicity detection was enabled for the + * specified transcription job. + *

+ */ + public void setToxicityDetection( + java.util.Collection toxicityDetection) { + if (toxicityDetection == null) { + this.toxicityDetection = null; + return; + } + + this.toxicityDetection = new java.util.ArrayList( + toxicityDetection); + } + + /** + *

+ * Indicates whether toxicity detection was enabled for the specified + * transcription job. + *

+ *

+ * Returns a reference to this object so that method calls can be chained + * together. + * + * @param toxicityDetection

+ * Indicates whether toxicity detection was enabled for the + * specified transcription job. + *

+ * @return A reference to this updated object so that method calls can be + * chained together. + */ + public TranscriptionJobSummary withToxicityDetection( + ToxicityDetectionSettings... toxicityDetection) { + if (getToxicityDetection() == null) { + this.toxicityDetection = new java.util.ArrayList( + toxicityDetection.length); + } + for (ToxicityDetectionSettings value : toxicityDetection) { + this.toxicityDetection.add(value); + } + return this; + } + + /** + *

+ * Indicates whether toxicity detection was enabled for the specified + * transcription job. + *

+ *

+ * Returns a reference to this object so that method calls can be chained + * together. + * + * @param toxicityDetection

+ * Indicates whether toxicity detection was enabled for the + * specified transcription job. + *

+ * @return A reference to this updated object so that method calls can be + * chained together. + */ + public TranscriptionJobSummary withToxicityDetection( + java.util.Collection toxicityDetection) { + setToxicityDetection(toxicityDetection); + return this; + } + /** * Returns a string representation of this object; useful for testing and * debugging. @@ -1626,7 +1721,9 @@ public String toString() { if (getIdentifiedLanguageScore() != null) sb.append("IdentifiedLanguageScore: " + getIdentifiedLanguageScore() + ","); if (getLanguageCodes() != null) - sb.append("LanguageCodes: " + getLanguageCodes()); + sb.append("LanguageCodes: " + getLanguageCodes() + ","); + if (getToxicityDetection() != null) + sb.append("ToxicityDetection: " + getToxicityDetection()); sb.append("}"); return sb.toString(); } @@ -1669,6 +1766,8 @@ public int hashCode() { .hashCode()); hashCode = prime * hashCode + ((getLanguageCodes() == null) ? 0 : getLanguageCodes().hashCode()); + hashCode = prime * hashCode + + ((getToxicityDetection() == null) ? 0 : getToxicityDetection().hashCode()); return hashCode; } @@ -1754,6 +1853,11 @@ public boolean equals(Object obj) { if (other.getLanguageCodes() != null && other.getLanguageCodes().equals(this.getLanguageCodes()) == false) return false; + if (other.getToxicityDetection() == null ^ this.getToxicityDetection() == null) + return false; + if (other.getToxicityDetection() != null + && other.getToxicityDetection().equals(this.getToxicityDetection()) == false) + return false; return true; } } diff --git a/aws-android-sdk-transcribe/src/main/java/com/amazonaws/services/transcribe/model/transform/StartTranscriptionJobRequestMarshaller.java b/aws-android-sdk-transcribe/src/main/java/com/amazonaws/services/transcribe/model/transform/StartTranscriptionJobRequestMarshaller.java index d0c2bc57ed..5669790722 100644 --- a/aws-android-sdk-transcribe/src/main/java/com/amazonaws/services/transcribe/model/transform/StartTranscriptionJobRequestMarshaller.java +++ b/aws-android-sdk-transcribe/src/main/java/com/amazonaws/services/transcribe/model/transform/StartTranscriptionJobRequestMarshaller.java @@ -199,6 +199,19 @@ public Request marshall( } jsonWriter.endObject(); } + if (startTranscriptionJobRequest.getToxicityDetection() != null) { + java.util.List toxicityDetection = startTranscriptionJobRequest + .getToxicityDetection(); + jsonWriter.name("ToxicityDetection"); + jsonWriter.beginArray(); + for (ToxicityDetectionSettings toxicityDetectionItem : toxicityDetection) { + if (toxicityDetectionItem != null) { + ToxicityDetectionSettingsJsonMarshaller.getInstance().marshall( + toxicityDetectionItem, jsonWriter); + } + } + jsonWriter.endArray(); + } jsonWriter.endObject(); jsonWriter.close(); diff --git a/aws-android-sdk-transcribe/src/main/java/com/amazonaws/services/transcribe/model/transform/ToxicityDetectionSettingsJsonMarshaller.java b/aws-android-sdk-transcribe/src/main/java/com/amazonaws/services/transcribe/model/transform/ToxicityDetectionSettingsJsonMarshaller.java new file mode 100644 index 0000000000..3e9f16613d --- /dev/null +++ b/aws-android-sdk-transcribe/src/main/java/com/amazonaws/services/transcribe/model/transform/ToxicityDetectionSettingsJsonMarshaller.java @@ -0,0 +1,52 @@ +/* + * Copyright 2010-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). + * You may not use this file except in compliance with the License. + * A copy of the License is located at + * + * http://aws.amazon.com/apache2.0 + * + * or in the "license" file accompanying this file. This file is distributed + * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ + +package com.amazonaws.services.transcribe.model.transform; + +import com.amazonaws.services.transcribe.model.*; +import com.amazonaws.util.DateUtils; +import com.amazonaws.util.json.AwsJsonWriter; + +/** + * JSON marshaller for POJO ToxicityDetectionSettings + */ +class ToxicityDetectionSettingsJsonMarshaller { + + public void marshall(ToxicityDetectionSettings toxicityDetectionSettings, + AwsJsonWriter jsonWriter) throws Exception { + jsonWriter.beginObject(); + if (toxicityDetectionSettings.getToxicityCategories() != null) { + java.util.List toxicityCategories = toxicityDetectionSettings + .getToxicityCategories(); + jsonWriter.name("ToxicityCategories"); + jsonWriter.beginArray(); + for (String toxicityCategoriesItem : toxicityCategories) { + if (toxicityCategoriesItem != null) { + jsonWriter.value(toxicityCategoriesItem); + } + } + jsonWriter.endArray(); + } + jsonWriter.endObject(); + } + + private static ToxicityDetectionSettingsJsonMarshaller instance; + + public static ToxicityDetectionSettingsJsonMarshaller getInstance() { + if (instance == null) + instance = new ToxicityDetectionSettingsJsonMarshaller(); + return instance; + } +} diff --git a/aws-android-sdk-transcribe/src/main/java/com/amazonaws/services/transcribe/model/transform/ToxicityDetectionSettingsJsonUnmarshaller.java b/aws-android-sdk-transcribe/src/main/java/com/amazonaws/services/transcribe/model/transform/ToxicityDetectionSettingsJsonUnmarshaller.java new file mode 100644 index 0000000000..92cb1d7fa4 --- /dev/null +++ b/aws-android-sdk-transcribe/src/main/java/com/amazonaws/services/transcribe/model/transform/ToxicityDetectionSettingsJsonUnmarshaller.java @@ -0,0 +1,59 @@ +/* + * Copyright 2010-2023 Amazon.com, Inc. or its affiliates. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"). + * You may not use this file except in compliance with the License. + * A copy of the License is located at + * + * http://aws.amazon.com/apache2.0 + * + * or in the "license" file accompanying this file. This file is distributed + * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either + * express or implied. See the License for the specific language governing + * permissions and limitations under the License. + */ + +package com.amazonaws.services.transcribe.model.transform; + +import com.amazonaws.services.transcribe.model.*; +import com.amazonaws.transform.SimpleTypeJsonUnmarshallers.*; +import com.amazonaws.transform.*; +import com.amazonaws.util.json.AwsJsonReader; + +/** + * JSON unmarshaller for POJO ToxicityDetectionSettings + */ +class ToxicityDetectionSettingsJsonUnmarshaller implements + Unmarshaller { + + public ToxicityDetectionSettings unmarshall(JsonUnmarshallerContext context) throws Exception { + AwsJsonReader reader = context.getReader(); + if (!reader.isContainer()) { + reader.skipValue(); + return null; + } + ToxicityDetectionSettings toxicityDetectionSettings = new ToxicityDetectionSettings(); + reader.beginObject(); + while (reader.hasNext()) { + String name = reader.nextName(); + if (name.equals("ToxicityCategories")) { + toxicityDetectionSettings.setToxicityCategories(new ListUnmarshaller( + StringJsonUnmarshaller.getInstance() + ) + .unmarshall(context)); + } else { + reader.skipValue(); + } + } + reader.endObject(); + return toxicityDetectionSettings; + } + + private static ToxicityDetectionSettingsJsonUnmarshaller instance; + + public static ToxicityDetectionSettingsJsonUnmarshaller getInstance() { + if (instance == null) + instance = new ToxicityDetectionSettingsJsonUnmarshaller(); + return instance; + } +} diff --git a/aws-android-sdk-transcribe/src/main/java/com/amazonaws/services/transcribe/model/transform/TranscriptionJobJsonMarshaller.java b/aws-android-sdk-transcribe/src/main/java/com/amazonaws/services/transcribe/model/transform/TranscriptionJobJsonMarshaller.java index bb7c9c3e02..a8a9a63d23 100644 --- a/aws-android-sdk-transcribe/src/main/java/com/amazonaws/services/transcribe/model/transform/TranscriptionJobJsonMarshaller.java +++ b/aws-android-sdk-transcribe/src/main/java/com/amazonaws/services/transcribe/model/transform/TranscriptionJobJsonMarshaller.java @@ -173,6 +173,19 @@ public void marshall(TranscriptionJob transcriptionJob, AwsJsonWriter jsonWriter } jsonWriter.endObject(); } + if (transcriptionJob.getToxicityDetection() != null) { + java.util.List toxicityDetection = transcriptionJob + .getToxicityDetection(); + jsonWriter.name("ToxicityDetection"); + jsonWriter.beginArray(); + for (ToxicityDetectionSettings toxicityDetectionItem : toxicityDetection) { + if (toxicityDetectionItem != null) { + ToxicityDetectionSettingsJsonMarshaller.getInstance().marshall( + toxicityDetectionItem, jsonWriter); + } + } + jsonWriter.endArray(); + } jsonWriter.endObject(); } diff --git a/aws-android-sdk-transcribe/src/main/java/com/amazonaws/services/transcribe/model/transform/TranscriptionJobJsonUnmarshaller.java b/aws-android-sdk-transcribe/src/main/java/com/amazonaws/services/transcribe/model/transform/TranscriptionJobJsonUnmarshaller.java index b1c328a1fc..03366bdc27 100644 --- a/aws-android-sdk-transcribe/src/main/java/com/amazonaws/services/transcribe/model/transform/TranscriptionJobJsonUnmarshaller.java +++ b/aws-android-sdk-transcribe/src/main/java/com/amazonaws/services/transcribe/model/transform/TranscriptionJobJsonUnmarshaller.java @@ -114,6 +114,12 @@ public TranscriptionJob unmarshall(JsonUnmarshallerContext context) throws Excep LanguageIdSettingsJsonUnmarshaller.getInstance() ) .unmarshall(context)); + } else if (name.equals("ToxicityDetection")) { + transcriptionJob + .setToxicityDetection(new ListUnmarshaller( + ToxicityDetectionSettingsJsonUnmarshaller.getInstance() + ) + .unmarshall(context)); } else { reader.skipValue(); } diff --git a/aws-android-sdk-transcribe/src/main/java/com/amazonaws/services/transcribe/model/transform/TranscriptionJobSummaryJsonMarshaller.java b/aws-android-sdk-transcribe/src/main/java/com/amazonaws/services/transcribe/model/transform/TranscriptionJobSummaryJsonMarshaller.java index 0b633458a2..6c251658f5 100644 --- a/aws-android-sdk-transcribe/src/main/java/com/amazonaws/services/transcribe/model/transform/TranscriptionJobSummaryJsonMarshaller.java +++ b/aws-android-sdk-transcribe/src/main/java/com/amazonaws/services/transcribe/model/transform/TranscriptionJobSummaryJsonMarshaller.java @@ -106,6 +106,19 @@ public void marshall(TranscriptionJobSummary transcriptionJobSummary, AwsJsonWri } jsonWriter.endArray(); } + if (transcriptionJobSummary.getToxicityDetection() != null) { + java.util.List toxicityDetection = transcriptionJobSummary + .getToxicityDetection(); + jsonWriter.name("ToxicityDetection"); + jsonWriter.beginArray(); + for (ToxicityDetectionSettings toxicityDetectionItem : toxicityDetection) { + if (toxicityDetectionItem != null) { + ToxicityDetectionSettingsJsonMarshaller.getInstance().marshall( + toxicityDetectionItem, jsonWriter); + } + } + jsonWriter.endArray(); + } jsonWriter.endObject(); } diff --git a/aws-android-sdk-transcribe/src/main/java/com/amazonaws/services/transcribe/model/transform/TranscriptionJobSummaryJsonUnmarshaller.java b/aws-android-sdk-transcribe/src/main/java/com/amazonaws/services/transcribe/model/transform/TranscriptionJobSummaryJsonUnmarshaller.java index d7387c9022..69ac808704 100644 --- a/aws-android-sdk-transcribe/src/main/java/com/amazonaws/services/transcribe/model/transform/TranscriptionJobSummaryJsonUnmarshaller.java +++ b/aws-android-sdk-transcribe/src/main/java/com/amazonaws/services/transcribe/model/transform/TranscriptionJobSummaryJsonUnmarshaller.java @@ -86,6 +86,12 @@ public TranscriptionJobSummary unmarshall(JsonUnmarshallerContext context) throw LanguageCodeItemJsonUnmarshaller.getInstance() ) .unmarshall(context)); + } else if (name.equals("ToxicityDetection")) { + transcriptionJobSummary + .setToxicityDetection(new ListUnmarshaller( + ToxicityDetectionSettingsJsonUnmarshaller.getInstance() + ) + .unmarshall(context)); } else { reader.skipValue(); }