All Downloads are FREE. Search and download functionalities are using the official Maven repository.

commonMain.aws.sdk.kotlin.services.translate.model.TranslateDocumentRequest.kt Maven / Gradle / Ivy

There is a newer version: 1.3.78
Show newest version
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!

package aws.sdk.kotlin.services.translate.model

import aws.smithy.kotlin.runtime.SdkDsl

public class TranslateDocumentRequest private constructor(builder: Builder) {
    /**
     * The content and content type for the document to be translated. The document size must not exceed 100 KB.
     */
    public val document: aws.sdk.kotlin.services.translate.model.Document? = builder.document
    /**
     * Settings to configure your translation output. You can configure the following options:
     * + Brevity: not supported.
     * + 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 supported 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 `TranslateDocument` 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 translated document. For a list of supported 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

    public companion object {
        public operator fun invoke(block: Builder.() -> kotlin.Unit): aws.sdk.kotlin.services.translate.model.TranslateDocumentRequest = Builder().apply(block).build()
    }

    override fun toString(): kotlin.String = buildString {
        append("TranslateDocumentRequest(")
        append("document=$document,")
        append("settings=$settings,")
        append("sourceLanguageCode=$sourceLanguageCode,")
        append("targetLanguageCode=$targetLanguageCode,")
        append("terminologyNames=$terminologyNames")
        append(")")
    }

    override fun hashCode(): kotlin.Int {
        var result = document?.hashCode() ?: 0
        result = 31 * result + (settings?.hashCode() ?: 0)
        result = 31 * result + (sourceLanguageCode?.hashCode() ?: 0)
        result = 31 * result + (targetLanguageCode?.hashCode() ?: 0)
        result = 31 * result + (terminologyNames?.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 TranslateDocumentRequest

        if (document != other.document) return false
        if (settings != other.settings) return false
        if (sourceLanguageCode != other.sourceLanguageCode) return false
        if (targetLanguageCode != other.targetLanguageCode) return false
        if (terminologyNames != other.terminologyNames) return false

        return true
    }

    public inline fun copy(block: Builder.() -> kotlin.Unit = {}): aws.sdk.kotlin.services.translate.model.TranslateDocumentRequest = Builder(this).apply(block).build()

    @SdkDsl
    public class Builder {
        /**
         * The content and content type for the document to be translated. The document size must not exceed 100 KB.
         */
        public var document: aws.sdk.kotlin.services.translate.model.Document? = null
        /**
         * Settings to configure your translation output. You can configure the following options:
         * + Brevity: not supported.
         * + 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 supported 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 `TranslateDocument` 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 translated document. For a list of supported 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

        @PublishedApi
        internal constructor()
        @PublishedApi
        internal constructor(x: aws.sdk.kotlin.services.translate.model.TranslateDocumentRequest) : this() {
            this.document = x.document
            this.settings = x.settings
            this.sourceLanguageCode = x.sourceLanguageCode
            this.targetLanguageCode = x.targetLanguageCode
            this.terminologyNames = x.terminologyNames
        }

        @PublishedApi
        internal fun build(): aws.sdk.kotlin.services.translate.model.TranslateDocumentRequest = TranslateDocumentRequest(this)

        /**
         * construct an [aws.sdk.kotlin.services.translate.model.Document] inside the given [block]
         */
        public fun document(block: aws.sdk.kotlin.services.translate.model.Document.Builder.() -> kotlin.Unit) {
            this.document = aws.sdk.kotlin.services.translate.model.Document.invoke(block)
        }

        /**
         * 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
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy