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

commonMain.aws.sdk.kotlin.services.iotwireless.serde.LoRaWanDeviceMetadataDocumentDeserializer.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.iotwireless.serde

import aws.sdk.kotlin.services.iotwireless.model.LoRaWanDeviceMetadata
import aws.sdk.kotlin.services.iotwireless.model.LoRaWanGatewayMetadata
import aws.sdk.kotlin.services.iotwireless.model.LoRaWanPublicGatewayMetadata
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 deserializeLoRaWanDeviceMetadataDocument(deserializer: Deserializer): LoRaWanDeviceMetadata {
    val builder = LoRaWanDeviceMetadata.Builder()
    val DATARATE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("DataRate"))
    val DEVEUI_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("DevEui"))
    val FPORT_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("FPort"))
    val FREQUENCY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("Frequency"))
    val GATEWAYS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("Gateways"))
    val PUBLICGATEWAYS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("PublicGateways"))
    val TIMESTAMP_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Timestamp"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(DATARATE_DESCRIPTOR)
        field(DEVEUI_DESCRIPTOR)
        field(FPORT_DESCRIPTOR)
        field(FREQUENCY_DESCRIPTOR)
        field(GATEWAYS_DESCRIPTOR)
        field(PUBLICGATEWAYS_DESCRIPTOR)
        field(TIMESTAMP_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                DATARATE_DESCRIPTOR.index -> builder.dataRate = deserializeInt()
                DEVEUI_DESCRIPTOR.index -> builder.devEui = deserializeString()
                FPORT_DESCRIPTOR.index -> builder.fPort = deserializeInt()
                FREQUENCY_DESCRIPTOR.index -> builder.frequency = deserializeInt()
                GATEWAYS_DESCRIPTOR.index -> builder.gateways =
                    deserializer.deserializeList(GATEWAYS_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeLoRaWanGatewayMetadataDocument(deserializer) } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                PUBLICGATEWAYS_DESCRIPTOR.index -> builder.publicGateways =
                    deserializer.deserializeList(PUBLICGATEWAYS_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeLoRaWanPublicGatewayMetadataDocument(deserializer) } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                TIMESTAMP_DESCRIPTOR.index -> builder.timestamp = deserializeString()
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy