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

commonMain.aws.sdk.kotlin.services.translate.model.TranslateDocumentResponse.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 TranslateDocumentResponse private constructor(builder: Builder) {
    /**
     * Settings to configure your translation output. You can configure the following options:
     * + Brevity: reduces the length of the translation output for most translations. Available for `TranslateText` only.
     * + Formality: sets the formality level of the translation output.
     * + Profanity: masks profane words and phrases in 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 to produce the translated text document.
     */
    public val appliedTerminologies: List? = builder.appliedTerminologies
    /**
     * The language code of the source document.
     */
    public val sourceLanguageCode: kotlin.String = requireNotNull(builder.sourceLanguageCode) { "A non-null value must be provided for sourceLanguageCode" }
    /**
     * The language code of the translated document.
     */
    public val targetLanguageCode: kotlin.String = requireNotNull(builder.targetLanguageCode) { "A non-null value must be provided for targetLanguageCode" }
    /**
     * The document containing the translated content. The document format matches the source document format.
     */
    public val translatedDocument: aws.sdk.kotlin.services.translate.model.TranslatedDocument? = builder.translatedDocument

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

    override fun toString(): kotlin.String = buildString {
        append("TranslateDocumentResponse(")
        append("appliedSettings=$appliedSettings,")
        append("appliedTerminologies=$appliedTerminologies,")
        append("sourceLanguageCode=$sourceLanguageCode,")
        append("targetLanguageCode=$targetLanguageCode,")
        append("translatedDocument=$translatedDocument")
        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 + (translatedDocument?.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 TranslateDocumentResponse

        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 (translatedDocument != other.translatedDocument) return false

        return true
    }

    public inline fun copy(block: Builder.() -> kotlin.Unit = {}): aws.sdk.kotlin.services.translate.model.TranslateDocumentResponse = 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 translation output for most translations. Available for `TranslateText` only.
         * + Formality: sets the formality level of the translation output.
         * + Profanity: masks profane words and phrases in 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 to produce the translated text document.
         */
        public var appliedTerminologies: List? = null
        /**
         * The language code of the source document.
         */
        public var sourceLanguageCode: kotlin.String? = null
        /**
         * The language code of the translated document.
         */
        public var targetLanguageCode: kotlin.String? = null
        /**
         * The document containing the translated content. The document format matches the source document format.
         */
        public var translatedDocument: aws.sdk.kotlin.services.translate.model.TranslatedDocument? = null

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

        @PublishedApi
        internal fun build(): aws.sdk.kotlin.services.translate.model.TranslateDocumentResponse = TranslateDocumentResponse(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)
        }

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

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




© 2015 - 2024 Weber Informatics LLC | Privacy Policy