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

commonMain.aws.sdk.kotlin.services.lexruntimev2.model.AudioInputEvent.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

/**
 * Represents a chunk of audio sent from the client application to Amazon Lex V2. The audio is all or part of an utterance from the user.
 *
 * Amazon Lex V2 accumulates audio chunks until it recognizes a natural pause in speech before processing the input.
 */
public class AudioInputEvent private constructor(builder: Builder) {
    /**
     * An encoded stream of audio.
     */
    public val audioChunk: kotlin.ByteArray? = builder.audioChunk
    /**
     * 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
    /**
     * The encoding used for the audio chunk. You must use 8 KHz PCM 16-bit mono-channel little-endian format. The value of the field should be:
     *
     * `audio/lpcm; sample-rate=8000; sample-size-bits=16; channel-count=1; is-big-endian=false`
     */
    public val contentType: kotlin.String = requireNotNull(builder.contentType) { "A non-null value must be provided for contentType" }
    /**
     * 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

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

    override fun toString(): kotlin.String = buildString {
        append("AudioInputEvent(")
        append("audioChunk=$audioChunk,")
        append("clientTimestampMillis=$clientTimestampMillis,")
        append("contentType=$contentType,")
        append("eventId=$eventId")
        append(")")
    }

    override fun hashCode(): kotlin.Int {
        var result = audioChunk?.contentHashCode() ?: 0
        result = 31 * result + (clientTimestampMillis.hashCode())
        result = 31 * result + (contentType.hashCode())
        result = 31 * result + (eventId?.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 AudioInputEvent

        if (audioChunk != null) {
            if (other.audioChunk == null) return false
            if (!audioChunk.contentEquals(other.audioChunk)) return false
        } else if (other.audioChunk != null) return false
        if (clientTimestampMillis != other.clientTimestampMillis) return false
        if (contentType != other.contentType) return false
        if (eventId != other.eventId) return false

        return true
    }

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

    @SdkDsl
    public class Builder {
        /**
         * An encoded stream of audio.
         */
        public var audioChunk: kotlin.ByteArray? = null
        /**
         * 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
        /**
         * The encoding used for the audio chunk. You must use 8 KHz PCM 16-bit mono-channel little-endian format. The value of the field should be:
         *
         * `audio/lpcm; sample-rate=8000; sample-size-bits=16; channel-count=1; is-big-endian=false`
         */
        public var contentType: kotlin.String? = null
        /**
         * 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

        @PublishedApi
        internal constructor()
        @PublishedApi
        internal constructor(x: aws.sdk.kotlin.services.lexruntimev2.model.AudioInputEvent) : this() {
            this.audioChunk = x.audioChunk
            this.clientTimestampMillis = x.clientTimestampMillis
            this.contentType = x.contentType
            this.eventId = x.eventId
        }

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy