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

commonMain.aws.sdk.kotlin.services.wisdom.serde.ContentDataDocumentDeserializer.kt Maven / Gradle / Ivy

There is a newer version: 1.3.80
Show newest version
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!

package aws.sdk.kotlin.services.wisdom.serde

import aws.sdk.kotlin.services.wisdom.model.ContentData
import aws.sdk.kotlin.services.wisdom.model.ContentStatus
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 aws.smithy.kotlin.runtime.time.Instant
import aws.smithy.kotlin.runtime.time.TimestampFormat
import kotlin.collections.mutableMapOf

internal fun deserializeContentDataDocument(deserializer: Deserializer): ContentData {
    val builder = ContentData.Builder()
    val CONTENTARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("contentArn"))
    val CONTENTID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("contentId"))
    val CONTENTTYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("contentType"))
    val KNOWLEDGEBASEARN_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("knowledgeBaseArn"))
    val KNOWLEDGEBASEID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("knowledgeBaseId"))
    val LINKOUTURI_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("linkOutUri"))
    val METADATA_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Map, JsonSerialName("metadata"))
    val NAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("name"))
    val REVISIONID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("revisionId"))
    val STATUS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("status"))
    val TAGS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Map, JsonSerialName("tags"))
    val TITLE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("title"))
    val URL_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("url"))
    val URLEXPIRY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("urlExpiry"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(CONTENTARN_DESCRIPTOR)
        field(CONTENTID_DESCRIPTOR)
        field(CONTENTTYPE_DESCRIPTOR)
        field(KNOWLEDGEBASEARN_DESCRIPTOR)
        field(KNOWLEDGEBASEID_DESCRIPTOR)
        field(LINKOUTURI_DESCRIPTOR)
        field(METADATA_DESCRIPTOR)
        field(NAME_DESCRIPTOR)
        field(REVISIONID_DESCRIPTOR)
        field(STATUS_DESCRIPTOR)
        field(TAGS_DESCRIPTOR)
        field(TITLE_DESCRIPTOR)
        field(URL_DESCRIPTOR)
        field(URLEXPIRY_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                CONTENTARN_DESCRIPTOR.index -> builder.contentArn = deserializeString()
                CONTENTID_DESCRIPTOR.index -> builder.contentId = deserializeString()
                CONTENTTYPE_DESCRIPTOR.index -> builder.contentType = deserializeString()
                KNOWLEDGEBASEARN_DESCRIPTOR.index -> builder.knowledgeBaseArn = deserializeString()
                KNOWLEDGEBASEID_DESCRIPTOR.index -> builder.knowledgeBaseId = deserializeString()
                LINKOUTURI_DESCRIPTOR.index -> builder.linkOutUri = deserializeString()
                METADATA_DESCRIPTOR.index -> builder.metadata =
                    deserializer.deserializeMap(METADATA_DESCRIPTOR) {
                        val map0 = mutableMapOf()
                        while (hasNextEntry()) {
                            val k0 = key()
                            val v0 = if (nextHasValue()) { deserializeString() } else { deserializeNull(); continue }
                            map0[k0] = v0
                        }
                        map0
                    }
                NAME_DESCRIPTOR.index -> builder.name = deserializeString()
                REVISIONID_DESCRIPTOR.index -> builder.revisionId = deserializeString()
                STATUS_DESCRIPTOR.index -> builder.status = deserializeString().let { ContentStatus.fromValue(it) }
                TAGS_DESCRIPTOR.index -> builder.tags =
                    deserializer.deserializeMap(TAGS_DESCRIPTOR) {
                        val map0 = mutableMapOf()
                        while (hasNextEntry()) {
                            val k0 = key()
                            val v0 = if (nextHasValue()) { deserializeString() } else { deserializeNull(); continue }
                            map0[k0] = v0
                        }
                        map0
                    }
                TITLE_DESCRIPTOR.index -> builder.title = deserializeString()
                URL_DESCRIPTOR.index -> builder.url = deserializeString()
                URLEXPIRY_DESCRIPTOR.index -> builder.urlExpiry = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy