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

commonMain.aws.sdk.kotlin.services.route53domains.serde.ContactDetailDocumentDeserializer.kt Maven / Gradle / Ivy

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

package aws.sdk.kotlin.services.route53domains.serde

import aws.sdk.kotlin.services.route53domains.model.ContactDetail
import aws.sdk.kotlin.services.route53domains.model.ContactType
import aws.sdk.kotlin.services.route53domains.model.CountryCode
import aws.sdk.kotlin.services.route53domains.model.ExtraParam
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 deserializeContactDetailDocument(deserializer: Deserializer): ContactDetail {
    val builder = ContactDetail.Builder()
    val ADDRESSLINE1_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("AddressLine1"))
    val ADDRESSLINE2_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("AddressLine2"))
    val CITY_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("City"))
    val CONTACTTYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("ContactType"))
    val COUNTRYCODE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("CountryCode"))
    val EMAIL_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Email"))
    val EXTRAPARAMS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("ExtraParams"))
    val FAX_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("Fax"))
    val FIRSTNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("FirstName"))
    val LASTNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("LastName"))
    val ORGANIZATIONNAME_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("OrganizationName"))
    val PHONENUMBER_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("PhoneNumber"))
    val STATE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("State"))
    val ZIPCODE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("ZipCode"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(ADDRESSLINE1_DESCRIPTOR)
        field(ADDRESSLINE2_DESCRIPTOR)
        field(CITY_DESCRIPTOR)
        field(CONTACTTYPE_DESCRIPTOR)
        field(COUNTRYCODE_DESCRIPTOR)
        field(EMAIL_DESCRIPTOR)
        field(EXTRAPARAMS_DESCRIPTOR)
        field(FAX_DESCRIPTOR)
        field(FIRSTNAME_DESCRIPTOR)
        field(LASTNAME_DESCRIPTOR)
        field(ORGANIZATIONNAME_DESCRIPTOR)
        field(PHONENUMBER_DESCRIPTOR)
        field(STATE_DESCRIPTOR)
        field(ZIPCODE_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                ADDRESSLINE1_DESCRIPTOR.index -> builder.addressLine1 = deserializeString()
                ADDRESSLINE2_DESCRIPTOR.index -> builder.addressLine2 = deserializeString()
                CITY_DESCRIPTOR.index -> builder.city = deserializeString()
                CONTACTTYPE_DESCRIPTOR.index -> builder.contactType = deserializeString().let { ContactType.fromValue(it) }
                COUNTRYCODE_DESCRIPTOR.index -> builder.countryCode = deserializeString().let { CountryCode.fromValue(it) }
                EMAIL_DESCRIPTOR.index -> builder.email = deserializeString()
                EXTRAPARAMS_DESCRIPTOR.index -> builder.extraParams =
                    deserializer.deserializeList(EXTRAPARAMS_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeExtraParamDocument(deserializer) } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                FAX_DESCRIPTOR.index -> builder.fax = deserializeString()
                FIRSTNAME_DESCRIPTOR.index -> builder.firstName = deserializeString()
                LASTNAME_DESCRIPTOR.index -> builder.lastName = deserializeString()
                ORGANIZATIONNAME_DESCRIPTOR.index -> builder.organizationName = deserializeString()
                PHONENUMBER_DESCRIPTOR.index -> builder.phoneNumber = deserializeString()
                STATE_DESCRIPTOR.index -> builder.state = deserializeString()
                ZIPCODE_DESCRIPTOR.index -> builder.zipCode = deserializeString()
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy