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

commonMain.aws.sdk.kotlin.services.appstream.serde.ThemeDocumentDeserializer.kt Maven / Gradle / Ivy

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

package aws.sdk.kotlin.services.appstream.serde

import aws.sdk.kotlin.services.appstream.model.Theme
import aws.sdk.kotlin.services.appstream.model.ThemeFooterLink
import aws.sdk.kotlin.services.appstream.model.ThemeState
import aws.sdk.kotlin.services.appstream.model.ThemeStyling
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.mutableListOf

internal fun deserializeThemeDocument(deserializer: Deserializer): Theme {
    val builder = Theme.Builder()
    val CREATEDTIME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("CreatedTime"))
    val STACKNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("StackName"))
    val STATE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("State"))
    val THEMEFAVICONURL_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("ThemeFaviconURL"))
    val THEMEFOOTERLINKS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("ThemeFooterLinks"))
    val THEMEORGANIZATIONLOGOURL_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("ThemeOrganizationLogoURL"))
    val THEMESTYLING_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("ThemeStyling"))
    val THEMETITLETEXT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("ThemeTitleText"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(CREATEDTIME_DESCRIPTOR)
        field(STACKNAME_DESCRIPTOR)
        field(STATE_DESCRIPTOR)
        field(THEMEFAVICONURL_DESCRIPTOR)
        field(THEMEFOOTERLINKS_DESCRIPTOR)
        field(THEMEORGANIZATIONLOGOURL_DESCRIPTOR)
        field(THEMESTYLING_DESCRIPTOR)
        field(THEMETITLETEXT_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                CREATEDTIME_DESCRIPTOR.index -> builder.createdTime = deserializeInstant(TimestampFormat.EPOCH_SECONDS)
                STACKNAME_DESCRIPTOR.index -> builder.stackName = deserializeString()
                STATE_DESCRIPTOR.index -> builder.state = deserializeString().let { ThemeState.fromValue(it) }
                THEMEFAVICONURL_DESCRIPTOR.index -> builder.themeFaviconUrl = deserializeString()
                THEMEFOOTERLINKS_DESCRIPTOR.index -> builder.themeFooterLinks =
                    deserializer.deserializeList(THEMEFOOTERLINKS_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeThemeFooterLinkDocument(deserializer) } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                THEMEORGANIZATIONLOGOURL_DESCRIPTOR.index -> builder.themeOrganizationLogoUrl = deserializeString()
                THEMESTYLING_DESCRIPTOR.index -> builder.themeStyling = deserializeString().let { ThemeStyling.fromValue(it) }
                THEMETITLETEXT_DESCRIPTOR.index -> builder.themeTitleText = deserializeString()
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy