commonMain.aws.sdk.kotlin.services.translate.model.TranslateTextRequest.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of translate-jvm Show documentation
Show all versions of translate-jvm Show documentation
The AWS SDK for Kotlin client for Translate
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.translate.model
import aws.smithy.kotlin.runtime.SdkDsl
public class TranslateTextRequest private constructor(builder: Builder) {
/**
* Settings to configure your translation output. You can configure the following options:
* + Brevity: reduces the length of the translated output for most translations.
* + Formality: sets the formality level of the output text.
* + Profanity: masks profane words and phrases in your translation output.
*/
public val settings: aws.sdk.kotlin.services.translate.model.TranslationSettings? = builder.settings
/**
* The language code for the language of the source text. For a list of language codes, see [Supported languages](https://docs.aws.amazon.com/translate/latest/dg/what-is-languages.html).
*
* To have Amazon Translate determine the source language of your text, you can specify `auto` in the `SourceLanguageCode` field. If you specify `auto`, Amazon Translate will call [Amazon Comprehend](https://docs.aws.amazon.com/comprehend/latest/dg/comprehend-general.html) to determine the source language.
*
* If you specify `auto`, you must send the `TranslateText` request in a region that supports Amazon Comprehend. Otherwise, the request returns an error indicating that autodetect is not supported.
*/
public val sourceLanguageCode: kotlin.String? = builder.sourceLanguageCode
/**
* The language code requested for the language of the target text. For a list of language codes, see [Supported languages](https://docs.aws.amazon.com/translate/latest/dg/what-is-languages.html).
*/
public val targetLanguageCode: kotlin.String? = builder.targetLanguageCode
/**
* The name of a terminology list file to add to the translation job. This file provides source terms and the desired translation for each term. A terminology list can contain a maximum of 256 terms. You can use one custom terminology resource in your translation request.
*
* Use the ListTerminologies operation to get the available terminology lists.
*
* For more information about custom terminology lists, see [Custom terminology](https://docs.aws.amazon.com/translate/latest/dg/how-custom-terminology.html).
*/
public val terminologyNames: List? = builder.terminologyNames
/**
* The text to translate. The text string can be a maximum of 10,000 bytes long. Depending on your character set, this may be fewer than 10,000 characters.
*/
public val text: kotlin.String? = builder.text
public companion object {
public operator fun invoke(block: Builder.() -> kotlin.Unit): aws.sdk.kotlin.services.translate.model.TranslateTextRequest = Builder().apply(block).build()
}
override fun toString(): kotlin.String = buildString {
append("TranslateTextRequest(")
append("settings=$settings,")
append("sourceLanguageCode=$sourceLanguageCode,")
append("targetLanguageCode=$targetLanguageCode,")
append("terminologyNames=$terminologyNames,")
append("text=$text")
append(")")
}
override fun hashCode(): kotlin.Int {
var result = settings?.hashCode() ?: 0
result = 31 * result + (sourceLanguageCode?.hashCode() ?: 0)
result = 31 * result + (targetLanguageCode?.hashCode() ?: 0)
result = 31 * result + (terminologyNames?.hashCode() ?: 0)
result = 31 * result + (text?.hashCode() ?: 0)
return result
}
override fun equals(other: kotlin.Any?): kotlin.Boolean {
if (this === other) return true
if (other == null || this::class != other::class) return false
other as TranslateTextRequest
if (settings != other.settings) return false
if (sourceLanguageCode != other.sourceLanguageCode) return false
if (targetLanguageCode != other.targetLanguageCode) return false
if (terminologyNames != other.terminologyNames) return false
if (text != other.text) return false
return true
}
public inline fun copy(block: Builder.() -> kotlin.Unit = {}): aws.sdk.kotlin.services.translate.model.TranslateTextRequest = Builder(this).apply(block).build()
@SdkDsl
public class Builder {
/**
* Settings to configure your translation output. You can configure the following options:
* + Brevity: reduces the length of the translated output for most translations.
* + Formality: sets the formality level of the output text.
* + Profanity: masks profane words and phrases in your translation output.
*/
public var settings: aws.sdk.kotlin.services.translate.model.TranslationSettings? = null
/**
* The language code for the language of the source text. For a list of language codes, see [Supported languages](https://docs.aws.amazon.com/translate/latest/dg/what-is-languages.html).
*
* To have Amazon Translate determine the source language of your text, you can specify `auto` in the `SourceLanguageCode` field. If you specify `auto`, Amazon Translate will call [Amazon Comprehend](https://docs.aws.amazon.com/comprehend/latest/dg/comprehend-general.html) to determine the source language.
*
* If you specify `auto`, you must send the `TranslateText` request in a region that supports Amazon Comprehend. Otherwise, the request returns an error indicating that autodetect is not supported.
*/
public var sourceLanguageCode: kotlin.String? = null
/**
* The language code requested for the language of the target text. For a list of language codes, see [Supported languages](https://docs.aws.amazon.com/translate/latest/dg/what-is-languages.html).
*/
public var targetLanguageCode: kotlin.String? = null
/**
* The name of a terminology list file to add to the translation job. This file provides source terms and the desired translation for each term. A terminology list can contain a maximum of 256 terms. You can use one custom terminology resource in your translation request.
*
* Use the ListTerminologies operation to get the available terminology lists.
*
* For more information about custom terminology lists, see [Custom terminology](https://docs.aws.amazon.com/translate/latest/dg/how-custom-terminology.html).
*/
public var terminologyNames: List? = null
/**
* The text to translate. The text string can be a maximum of 10,000 bytes long. Depending on your character set, this may be fewer than 10,000 characters.
*/
public var text: kotlin.String? = null
@PublishedApi
internal constructor()
@PublishedApi
internal constructor(x: aws.sdk.kotlin.services.translate.model.TranslateTextRequest) : this() {
this.settings = x.settings
this.sourceLanguageCode = x.sourceLanguageCode
this.targetLanguageCode = x.targetLanguageCode
this.terminologyNames = x.terminologyNames
this.text = x.text
}
@PublishedApi
internal fun build(): aws.sdk.kotlin.services.translate.model.TranslateTextRequest = TranslateTextRequest(this)
/**
* construct an [aws.sdk.kotlin.services.translate.model.TranslationSettings] inside the given [block]
*/
public fun settings(block: aws.sdk.kotlin.services.translate.model.TranslationSettings.Builder.() -> kotlin.Unit) {
this.settings = aws.sdk.kotlin.services.translate.model.TranslationSettings.invoke(block)
}
internal fun correctErrors(): Builder {
return this
}
}
}