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

commonMain.aws.sdk.kotlin.services.translate.model.TranslateTextResponse.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 TranslateTextResponse private constructor(builder: Builder) {
    /**
     * Optional settings that modify the translation output.
     */
    public val appliedSettings: aws.sdk.kotlin.services.translate.model.TranslationSettings? = builder.appliedSettings
    /**
     * The names of the custom terminologies applied to the input text by Amazon Translate for the translated text response.
     */
    public val appliedTerminologies: List? = builder.appliedTerminologies
    /**
     * The language code for the language of the source text.
     */
    public val sourceLanguageCode: kotlin.String = requireNotNull(builder.sourceLanguageCode) { "A non-null value must be provided for sourceLanguageCode" }
    /**
     * The language code for the language of the target text.
     */
    public val targetLanguageCode: kotlin.String = requireNotNull(builder.targetLanguageCode) { "A non-null value must be provided for targetLanguageCode" }
    /**
     * The translated text.
     */
    public val translatedText: kotlin.String = requireNotNull(builder.translatedText) { "A non-null value must be provided for translatedText" }

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

    override fun toString(): kotlin.String = buildString {
        append("TranslateTextResponse(")
        append("appliedSettings=$appliedSettings,")
        append("appliedTerminologies=$appliedTerminologies,")
        append("sourceLanguageCode=$sourceLanguageCode,")
        append("targetLanguageCode=$targetLanguageCode,")
        append("translatedText=$translatedText")
        append(")")
    }

    override fun hashCode(): kotlin.Int {
        var result = appliedSettings?.hashCode() ?: 0
        result = 31 * result + (appliedTerminologies?.hashCode() ?: 0)
        result = 31 * result + (sourceLanguageCode.hashCode())
        result = 31 * result + (targetLanguageCode.hashCode())
        result = 31 * result + (translatedText.hashCode())
        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 TranslateTextResponse

        if (appliedSettings != other.appliedSettings) return false
        if (appliedTerminologies != other.appliedTerminologies) return false
        if (sourceLanguageCode != other.sourceLanguageCode) return false
        if (targetLanguageCode != other.targetLanguageCode) return false
        if (translatedText != other.translatedText) return false

        return true
    }

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

    @SdkDsl
    public class Builder {
        /**
         * Optional settings that modify the translation output.
         */
        public var appliedSettings: aws.sdk.kotlin.services.translate.model.TranslationSettings? = null
        /**
         * The names of the custom terminologies applied to the input text by Amazon Translate for the translated text response.
         */
        public var appliedTerminologies: List? = null
        /**
         * The language code for the language of the source text.
         */
        public var sourceLanguageCode: kotlin.String? = null
        /**
         * The language code for the language of the target text.
         */
        public var targetLanguageCode: kotlin.String? = null
        /**
         * The translated text.
         */
        public var translatedText: kotlin.String? = null

        @PublishedApi
        internal constructor()
        @PublishedApi
        internal constructor(x: aws.sdk.kotlin.services.translate.model.TranslateTextResponse) : this() {
            this.appliedSettings = x.appliedSettings
            this.appliedTerminologies = x.appliedTerminologies
            this.sourceLanguageCode = x.sourceLanguageCode
            this.targetLanguageCode = x.targetLanguageCode
            this.translatedText = x.translatedText
        }

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

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

        internal fun correctErrors(): Builder {
            if (sourceLanguageCode == null) sourceLanguageCode = ""
            if (targetLanguageCode == null) targetLanguageCode = ""
            if (translatedText == null) translatedText = ""
            return this
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy