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

commonMain.aws.sdk.kotlin.services.pinpointemail.model.Message.kt Maven / Gradle / Ivy

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

package aws.sdk.kotlin.services.pinpointemail.model

import aws.smithy.kotlin.runtime.SdkDsl

/**
 * Represents the email message that you're sending. The `Message` object consists of a subject line and a message body.
 */
public class Message private constructor(builder: Builder) {
    /**
     * The body of the message. You can specify an HTML version of the message, a text-only version of the message, or both.
     */
    public val body: aws.sdk.kotlin.services.pinpointemail.model.Body? = builder.body
    /**
     * The subject line of the email. The subject line can only contain 7-bit ASCII characters. However, you can specify non-ASCII characters in the subject line by using encoded-word syntax, as described in [RFC 2047](https://tools.ietf.org/html/rfc2047).
     */
    public val subject: aws.sdk.kotlin.services.pinpointemail.model.Content? = builder.subject

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

    override fun toString(): kotlin.String = buildString {
        append("Message(")
        append("body=$body,")
        append("subject=$subject")
        append(")")
    }

    override fun hashCode(): kotlin.Int {
        var result = body?.hashCode() ?: 0
        result = 31 * result + (subject?.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 Message

        if (body != other.body) return false
        if (subject != other.subject) return false

        return true
    }

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

    @SdkDsl
    public class Builder {
        /**
         * The body of the message. You can specify an HTML version of the message, a text-only version of the message, or both.
         */
        public var body: aws.sdk.kotlin.services.pinpointemail.model.Body? = null
        /**
         * The subject line of the email. The subject line can only contain 7-bit ASCII characters. However, you can specify non-ASCII characters in the subject line by using encoded-word syntax, as described in [RFC 2047](https://tools.ietf.org/html/rfc2047).
         */
        public var subject: aws.sdk.kotlin.services.pinpointemail.model.Content? = null

        @PublishedApi
        internal constructor()
        @PublishedApi
        internal constructor(x: aws.sdk.kotlin.services.pinpointemail.model.Message) : this() {
            this.body = x.body
            this.subject = x.subject
        }

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

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

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

        internal fun correctErrors(): Builder {
            return this
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy