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

commonMain.aws.sdk.kotlin.services.translate.model.Document.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

/**
 * The content and content type of a document.
 */
public class Document private constructor(builder: Builder) {
    /**
     * The `Content`field type is Binary large object (blob). This object contains the document content converted into base64-encoded binary data. If you use one of the AWS SDKs, the SDK performs the Base64-encoding on this field before sending the request.
     */
    public val content: kotlin.ByteArray = requireNotNull(builder.content) { "A non-null value must be provided for content" }
    /**
     * Describes the format of the document. You can specify one of the following:
     * + `text/html` - The input data consists of HTML content. Amazon Translate translates only the text in the HTML element.
     * + `text/plain` - The input data consists of unformatted text. Amazon Translate translates every character in the content.
     * + `application/vnd.openxmlformats-officedocument.wordprocessingml.document` - The input data consists of a Word document (.docx).
     */
    public val contentType: kotlin.String = requireNotNull(builder.contentType) { "A non-null value must be provided for contentType" }

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

    override fun toString(): kotlin.String = buildString {
        append("Document(")
        append("content=*** Sensitive Data Redacted ***,")
        append("contentType=$contentType")
        append(")")
    }

    override fun hashCode(): kotlin.Int {
        var result = content.contentHashCode()
        result = 31 * result + (contentType.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 Document

        if (content != null) {
            if (other.content == null) return false
            if (!content.contentEquals(other.content)) return false
        } else if (other.content != null) return false
        if (contentType != other.contentType) return false

        return true
    }

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

    @SdkDsl
    public class Builder {
        /**
         * The `Content`field type is Binary large object (blob). This object contains the document content converted into base64-encoded binary data. If you use one of the AWS SDKs, the SDK performs the Base64-encoding on this field before sending the request.
         */
        public var content: kotlin.ByteArray? = null
        /**
         * Describes the format of the document. You can specify one of the following:
         * + `text/html` - The input data consists of HTML content. Amazon Translate translates only the text in the HTML element.
         * + `text/plain` - The input data consists of unformatted text. Amazon Translate translates every character in the content.
         * + `application/vnd.openxmlformats-officedocument.wordprocessingml.document` - The input data consists of a Word document (.docx).
         */
        public var contentType: kotlin.String? = null

        @PublishedApi
        internal constructor()
        @PublishedApi
        internal constructor(x: aws.sdk.kotlin.services.translate.model.Document) : this() {
            this.content = x.content
            this.contentType = x.contentType
        }

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

        internal fun correctErrors(): Builder {
            if (content == null) content = ByteArray(0)
            if (contentType == null) contentType = ""
            return this
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy