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

commonMain.aws.sdk.kotlin.services.transcribestreaming.serde.ResultDocumentDeserializer.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.Alternative
import aws.sdk.kotlin.services.transcribestreaming.model.LanguageCode
import aws.sdk.kotlin.services.transcribestreaming.model.LanguageWithScore
import aws.sdk.kotlin.services.transcribestreaming.model.Result
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 deserializeResultDocument(deserializer: Deserializer): Result {
    val builder = Result.Builder()
    val ALTERNATIVES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("Alternatives"))
    val CHANNELID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("ChannelId"))
    val ENDTIME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Double, JsonSerialName("EndTime"))
    val ISPARTIAL_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, JsonSerialName("IsPartial"))
    val LANGUAGECODE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("LanguageCode"))
    val LANGUAGEIDENTIFICATION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("LanguageIdentification"))
    val RESULTID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("ResultId"))
    val STARTTIME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Double, JsonSerialName("StartTime"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(ALTERNATIVES_DESCRIPTOR)
        field(CHANNELID_DESCRIPTOR)
        field(ENDTIME_DESCRIPTOR)
        field(ISPARTIAL_DESCRIPTOR)
        field(LANGUAGECODE_DESCRIPTOR)
        field(LANGUAGEIDENTIFICATION_DESCRIPTOR)
        field(RESULTID_DESCRIPTOR)
        field(STARTTIME_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                ALTERNATIVES_DESCRIPTOR.index -> builder.alternatives =
                    deserializer.deserializeList(ALTERNATIVES_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeAlternativeDocument(deserializer) } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                CHANNELID_DESCRIPTOR.index -> builder.channelId = deserializeString()
                ENDTIME_DESCRIPTOR.index -> builder.endTime = deserializeDouble()
                ISPARTIAL_DESCRIPTOR.index -> builder.isPartial = deserializeBoolean()
                LANGUAGECODE_DESCRIPTOR.index -> builder.languageCode = deserializeString().let { LanguageCode.fromValue(it) }
                LANGUAGEIDENTIFICATION_DESCRIPTOR.index -> builder.languageIdentification =
                    deserializer.deserializeList(LANGUAGEIDENTIFICATION_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeLanguageWithScoreDocument(deserializer) } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                RESULTID_DESCRIPTOR.index -> builder.resultId = deserializeString()
                STARTTIME_DESCRIPTOR.index -> builder.startTime = deserializeDouble()
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy