commonMain.aws.sdk.kotlin.services.outposts.serde.OrderSummaryDocumentDeserializer.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of outposts-jvm Show documentation
Show all versions of outposts-jvm Show documentation
The AWS SDK for Kotlin client for Outposts
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!
package aws.sdk.kotlin.services.outposts.serde
import aws.sdk.kotlin.services.outposts.model.LineItemStatus
import aws.sdk.kotlin.services.outposts.model.OrderStatus
import aws.sdk.kotlin.services.outposts.model.OrderSummary
import aws.sdk.kotlin.services.outposts.model.OrderType
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 kotlin.collections.mutableMapOf
internal fun deserializeOrderSummaryDocument(deserializer: Deserializer): OrderSummary {
val builder = OrderSummary.Builder()
val LINEITEMCOUNTSBYSTATUS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Map, JsonSerialName("LineItemCountsByStatus"))
val ORDERFULFILLEDDATE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("OrderFulfilledDate"))
val ORDERID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("OrderId"))
val ORDERSUBMISSIONDATE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Timestamp, JsonSerialName("OrderSubmissionDate"))
val ORDERTYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("OrderType"))
val OUTPOSTID_DESCRIPTOR = SdkFieldDescriptor(SerialKind.String, JsonSerialName("OutpostId"))
val STATUS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("Status"))
val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
field(LINEITEMCOUNTSBYSTATUS_DESCRIPTOR)
field(ORDERFULFILLEDDATE_DESCRIPTOR)
field(ORDERID_DESCRIPTOR)
field(ORDERSUBMISSIONDATE_DESCRIPTOR)
field(ORDERTYPE_DESCRIPTOR)
field(OUTPOSTID_DESCRIPTOR)
field(STATUS_DESCRIPTOR)
}
deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
loop@while (true) {
when (findNextFieldIndex()) {
LINEITEMCOUNTSBYSTATUS_DESCRIPTOR.index -> builder.lineItemCountsByStatus =
deserializer.deserializeMap(LINEITEMCOUNTSBYSTATUS_DESCRIPTOR) {
val map0 = mutableMapOf()
while (hasNextEntry()) {
val k0 = LineItemStatus.fromValue(key())
val v0 = if (nextHasValue()) { deserializeInt() } else { deserializeNull(); continue }
map0[k0] = v0
}
map0
}
ORDERFULFILLEDDATE_DESCRIPTOR.index -> builder.orderFulfilledDate = deserializeString().let { Instant.fromEpochSeconds(it) }
ORDERID_DESCRIPTOR.index -> builder.orderId = deserializeString()
ORDERSUBMISSIONDATE_DESCRIPTOR.index -> builder.orderSubmissionDate = deserializeString().let { Instant.fromEpochSeconds(it) }
ORDERTYPE_DESCRIPTOR.index -> builder.orderType = deserializeString().let { OrderType.fromValue(it) }
OUTPOSTID_DESCRIPTOR.index -> builder.outpostId = deserializeString()
STATUS_DESCRIPTOR.index -> builder.status = deserializeString().let { OrderStatus.fromValue(it) }
null -> break@loop
else -> skipValue()
}
}
}
builder.correctErrors()
return builder.build()
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy