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

commonMain.aws.sdk.kotlin.services.lexruntimev2.model.ConfigurationEvent.kt Maven / Gradle / Ivy

// Code generated by smithy-kotlin-codegen. DO NOT EDIT!

package aws.sdk.kotlin.services.lexruntimev2.model

import aws.smithy.kotlin.runtime.SdkDsl

/**
 * The initial event sent from the application to Amazon Lex V2 to configure the conversation, including session and request attributes and the response content type.
 */
public class ConfigurationEvent private constructor(builder: Builder) {
    /**
     * A timestamp set by the client of the date and time that the event was sent to Amazon Lex V2.
     */
    public val clientTimestampMillis: kotlin.Long = builder.clientTimestampMillis
    /**
     * Determines whether Amazon Lex V2 should send audio responses to the client application.
     *
     * Set this field to false when the client is operating in a playback mode where audio responses are played to the user. If the client isn't operating in playback mode, such as a text chat application, set this to true so that Amazon Lex V2 doesn't wait for the prompt to finish playing on the client.
     */
    public val disablePlayback: kotlin.Boolean = builder.disablePlayback
    /**
     * A unique identifier that your application assigns to the event. You can use this to identify events in logs.
     */
    public val eventId: kotlin.String? = builder.eventId
    /**
     * Request-specific information passed between the client application and Amazon Lex V2.
     *
     * The namespace `x-amz-lex:` is reserved for special attributes. Don't create any request attributes for prefix `x-amz-lex:`.
     */
    public val requestAttributes: Map? = builder.requestAttributes
    /**
     * The message that Amazon Lex V2 returns in the response can be either text or speech based on the `responseContentType` value.
     * + If the value is `text/plain;charset=utf-8`, Amazon Lex V2 returns text in the response.
     * + If the value begins with `audio/`, Amazon Lex V2 returns speech in the response. Amazon Lex V2 uses Amazon Polly to generate the speech using the configuration that you specified in the `requestContentType` parameter. For example, if you specify `audio/mpeg` as the value, Amazon Lex V2 returns speech in the MPEG format.
     * + If the value is `audio/pcm`, the speech returned is audio/pcm in 16-bit, little-endian format.
     * + The following are the accepted values:
     *    + audio/mpeg
     *    + audio/ogg
     *    + audio/pcm
     *    + audio/* (defaults to mpeg)
     *    + text/plain; charset=utf-8
     */
    public val responseContentType: kotlin.String = requireNotNull(builder.responseContentType) { "A non-null value must be provided for responseContentType" }
    /**
     * The state of the user's session with Amazon Lex V2.
     */
    public val sessionState: aws.sdk.kotlin.services.lexruntimev2.model.SessionState? = builder.sessionState
    /**
     * A list of messages to send to the user.
     *
     * If you set the `welcomeMessage` field, you must also set the `DialogAction`[](https://docs.aws.amazon.com/lexv2/latest/dg/API_runtime_DialogAction.html) structure's `type`[](https://docs.aws.amazon.com/lexv2/latest/dg/API_runtime_DialogAction.html#lexv2-Type-runtime_DialogAction-type) field.
     */
    public val welcomeMessages: List? = builder.welcomeMessages

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

    override fun toString(): kotlin.String = buildString {
        append("ConfigurationEvent(")
        append("clientTimestampMillis=$clientTimestampMillis,")
        append("disablePlayback=$disablePlayback,")
        append("eventId=$eventId,")
        append("requestAttributes=$requestAttributes,")
        append("responseContentType=$responseContentType,")
        append("sessionState=$sessionState,")
        append("welcomeMessages=$welcomeMessages")
        append(")")
    }

    override fun hashCode(): kotlin.Int {
        var result = clientTimestampMillis.hashCode()
        result = 31 * result + (disablePlayback.hashCode())
        result = 31 * result + (eventId?.hashCode() ?: 0)
        result = 31 * result + (requestAttributes?.hashCode() ?: 0)
        result = 31 * result + (responseContentType.hashCode())
        result = 31 * result + (sessionState?.hashCode() ?: 0)
        result = 31 * result + (welcomeMessages?.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 ConfigurationEvent

        if (clientTimestampMillis != other.clientTimestampMillis) return false
        if (disablePlayback != other.disablePlayback) return false
        if (eventId != other.eventId) return false
        if (requestAttributes != other.requestAttributes) return false
        if (responseContentType != other.responseContentType) return false
        if (sessionState != other.sessionState) return false
        if (welcomeMessages != other.welcomeMessages) return false

        return true
    }

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

    @SdkDsl
    public class Builder {
        /**
         * A timestamp set by the client of the date and time that the event was sent to Amazon Lex V2.
         */
        public var clientTimestampMillis: kotlin.Long = 0L
        /**
         * Determines whether Amazon Lex V2 should send audio responses to the client application.
         *
         * Set this field to false when the client is operating in a playback mode where audio responses are played to the user. If the client isn't operating in playback mode, such as a text chat application, set this to true so that Amazon Lex V2 doesn't wait for the prompt to finish playing on the client.
         */
        public var disablePlayback: kotlin.Boolean = false
        /**
         * A unique identifier that your application assigns to the event. You can use this to identify events in logs.
         */
        public var eventId: kotlin.String? = null
        /**
         * Request-specific information passed between the client application and Amazon Lex V2.
         *
         * The namespace `x-amz-lex:` is reserved for special attributes. Don't create any request attributes for prefix `x-amz-lex:`.
         */
        public var requestAttributes: Map? = null
        /**
         * The message that Amazon Lex V2 returns in the response can be either text or speech based on the `responseContentType` value.
         * + If the value is `text/plain;charset=utf-8`, Amazon Lex V2 returns text in the response.
         * + If the value begins with `audio/`, Amazon Lex V2 returns speech in the response. Amazon Lex V2 uses Amazon Polly to generate the speech using the configuration that you specified in the `requestContentType` parameter. For example, if you specify `audio/mpeg` as the value, Amazon Lex V2 returns speech in the MPEG format.
         * + If the value is `audio/pcm`, the speech returned is audio/pcm in 16-bit, little-endian format.
         * + The following are the accepted values:
         *    + audio/mpeg
         *    + audio/ogg
         *    + audio/pcm
         *    + audio/* (defaults to mpeg)
         *    + text/plain; charset=utf-8
         */
        public var responseContentType: kotlin.String? = null
        /**
         * The state of the user's session with Amazon Lex V2.
         */
        public var sessionState: aws.sdk.kotlin.services.lexruntimev2.model.SessionState? = null
        /**
         * A list of messages to send to the user.
         *
         * If you set the `welcomeMessage` field, you must also set the `DialogAction`[](https://docs.aws.amazon.com/lexv2/latest/dg/API_runtime_DialogAction.html) structure's `type`[](https://docs.aws.amazon.com/lexv2/latest/dg/API_runtime_DialogAction.html#lexv2-Type-runtime_DialogAction-type) field.
         */
        public var welcomeMessages: List? = null

        @PublishedApi
        internal constructor()
        @PublishedApi
        internal constructor(x: aws.sdk.kotlin.services.lexruntimev2.model.ConfigurationEvent) : this() {
            this.clientTimestampMillis = x.clientTimestampMillis
            this.disablePlayback = x.disablePlayback
            this.eventId = x.eventId
            this.requestAttributes = x.requestAttributes
            this.responseContentType = x.responseContentType
            this.sessionState = x.sessionState
            this.welcomeMessages = x.welcomeMessages
        }

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

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy