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

commonMain.aws.sdk.kotlin.services.connectcontactlens.serde.TranscriptDocumentDeserializer.kt Maven / Gradle / Ivy

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

package aws.sdk.kotlin.services.connectcontactlens.serde

import aws.sdk.kotlin.services.connectcontactlens.model.IssueDetected
import aws.sdk.kotlin.services.connectcontactlens.model.SentimentValue
import aws.sdk.kotlin.services.connectcontactlens.model.Transcript
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 deserializeTranscriptDocument(deserializer: Deserializer): Transcript {
    val builder = Transcript.Builder()
    val BEGINOFFSETMILLIS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("BeginOffsetMillis"))
    val CONTENT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Content"))
    val ENDOFFSETMILLIS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("EndOffsetMillis"))
    val ID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Id"))
    val ISSUESDETECTED_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("IssuesDetected"))
    val PARTICIPANTID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("ParticipantId"))
    val PARTICIPANTROLE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("ParticipantRole"))
    val SENTIMENT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("Sentiment"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(BEGINOFFSETMILLIS_DESCRIPTOR)
        field(CONTENT_DESCRIPTOR)
        field(ENDOFFSETMILLIS_DESCRIPTOR)
        field(ID_DESCRIPTOR)
        field(ISSUESDETECTED_DESCRIPTOR)
        field(PARTICIPANTID_DESCRIPTOR)
        field(PARTICIPANTROLE_DESCRIPTOR)
        field(SENTIMENT_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                BEGINOFFSETMILLIS_DESCRIPTOR.index -> builder.beginOffsetMillis = deserializeInt()
                CONTENT_DESCRIPTOR.index -> builder.content = deserializeString()
                ENDOFFSETMILLIS_DESCRIPTOR.index -> builder.endOffsetMillis = deserializeInt()
                ID_DESCRIPTOR.index -> builder.id = deserializeString()
                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
                    }
                PARTICIPANTID_DESCRIPTOR.index -> builder.participantId = deserializeString()
                PARTICIPANTROLE_DESCRIPTOR.index -> builder.participantRole = deserializeString()
                SENTIMENT_DESCRIPTOR.index -> builder.sentiment = deserializeString().let { SentimentValue.fromValue(it) }
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy