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

commonMain.aws.sdk.kotlin.services.transcribestreaming.serde.UtteranceEventDocumentDeserializer.kt Maven / Gradle / Ivy

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

package aws.sdk.kotlin.services.transcribestreaming.serde

import aws.sdk.kotlin.services.transcribestreaming.model.CallAnalyticsEntity
import aws.sdk.kotlin.services.transcribestreaming.model.CallAnalyticsItem
import aws.sdk.kotlin.services.transcribestreaming.model.IssueDetected
import aws.sdk.kotlin.services.transcribestreaming.model.ParticipantRole
import aws.sdk.kotlin.services.transcribestreaming.model.Sentiment
import aws.sdk.kotlin.services.transcribestreaming.model.UtteranceEvent
import aws.smithy.kotlin.runtime.serde.Deserializer
import aws.smithy.kotlin.runtime.serde.SdkFieldDescriptor
import aws.smithy.kotlin.runtime.serde.SdkObjectDescriptor
import aws.smithy.kotlin.runtime.serde.SerialKind
import aws.smithy.kotlin.runtime.serde.asSdkSerializable
import aws.smithy.kotlin.runtime.serde.deserializeList
import aws.smithy.kotlin.runtime.serde.deserializeMap
import aws.smithy.kotlin.runtime.serde.deserializeStruct
import aws.smithy.kotlin.runtime.serde.field
import aws.smithy.kotlin.runtime.serde.json.JsonDeserializer
import aws.smithy.kotlin.runtime.serde.json.JsonSerialName
import aws.smithy.kotlin.runtime.serde.serializeList
import aws.smithy.kotlin.runtime.serde.serializeMap
import aws.smithy.kotlin.runtime.serde.serializeStruct
import kotlin.collections.mutableListOf

internal fun deserializeUtteranceEventDocument(deserializer: Deserializer): UtteranceEvent {
    val builder = UtteranceEvent.Builder()
    val BEGINOFFSETMILLIS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Long, JsonSerialName("BeginOffsetMillis"))
    val ENDOFFSETMILLIS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Long, JsonSerialName("EndOffsetMillis"))
    val ENTITIES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("Entities"))
    val ISPARTIAL_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, JsonSerialName("IsPartial"))
    val ISSUESDETECTED_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("IssuesDetected"))
    val ITEMS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("Items"))
    val PARTICIPANTROLE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("ParticipantRole"))
    val SENTIMENT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("Sentiment"))
    val TRANSCRIPT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Transcript"))
    val UTTERANCEID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("UtteranceId"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(BEGINOFFSETMILLIS_DESCRIPTOR)
        field(ENDOFFSETMILLIS_DESCRIPTOR)
        field(ENTITIES_DESCRIPTOR)
        field(ISPARTIAL_DESCRIPTOR)
        field(ISSUESDETECTED_DESCRIPTOR)
        field(ITEMS_DESCRIPTOR)
        field(PARTICIPANTROLE_DESCRIPTOR)
        field(SENTIMENT_DESCRIPTOR)
        field(TRANSCRIPT_DESCRIPTOR)
        field(UTTERANCEID_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                BEGINOFFSETMILLIS_DESCRIPTOR.index -> builder.beginOffsetMillis = deserializeLong()
                ENDOFFSETMILLIS_DESCRIPTOR.index -> builder.endOffsetMillis = deserializeLong()
                ENTITIES_DESCRIPTOR.index -> builder.entities =
                    deserializer.deserializeList(ENTITIES_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeCallAnalyticsEntityDocument(deserializer) } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                ISPARTIAL_DESCRIPTOR.index -> builder.isPartial = deserializeBoolean()
                ISSUESDETECTED_DESCRIPTOR.index -> builder.issuesDetected =
                    deserializer.deserializeList(ISSUESDETECTED_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeIssueDetectedDocument(deserializer) } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                ITEMS_DESCRIPTOR.index -> builder.items =
                    deserializer.deserializeList(ITEMS_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeCallAnalyticsItemDocument(deserializer) } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                PARTICIPANTROLE_DESCRIPTOR.index -> builder.participantRole = deserializeString().let { ParticipantRole.fromValue(it) }
                SENTIMENT_DESCRIPTOR.index -> builder.sentiment = deserializeString().let { Sentiment.fromValue(it) }
                TRANSCRIPT_DESCRIPTOR.index -> builder.transcript = deserializeString()
                UTTERANCEID_DESCRIPTOR.index -> builder.utteranceId = deserializeString()
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy