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

commonMain.aws.sdk.kotlin.services.mediapackage.serde.HlsPackageDocumentDeserializer.kt Maven / Gradle / Ivy

The newest version!
// Code generated by smithy-kotlin-codegen. DO NOT EDIT!

package aws.sdk.kotlin.services.mediapackage.serde

import aws.sdk.kotlin.services.mediapackage.model.AdMarkers
import aws.sdk.kotlin.services.mediapackage.model.AdTriggersElement
import aws.sdk.kotlin.services.mediapackage.model.AdsOnDeliveryRestrictions
import aws.sdk.kotlin.services.mediapackage.model.HlsPackage
import aws.sdk.kotlin.services.mediapackage.model.PlaylistType
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 deserializeHlsPackageDocument(deserializer: Deserializer): HlsPackage {
    val builder = HlsPackage.Builder()
    val ADMARKERS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("adMarkers"))
    val ADTRIGGERS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.List, JsonSerialName("adTriggers"))
    val ADSONDELIVERYRESTRICTIONS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("adsOnDeliveryRestrictions"))
    val ENCRYPTION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("encryption"))
    val INCLUDEDVBSUBTITLES_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, JsonSerialName("includeDvbSubtitles"))
    val INCLUDEIFRAMEONLYSTREAM_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, JsonSerialName("includeIframeOnlyStream"))
    val PLAYLISTTYPE_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Enum, JsonSerialName("playlistType"))
    val PLAYLISTWINDOWSECONDS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("playlistWindowSeconds"))
    val PROGRAMDATETIMEINTERVALSECONDS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("programDateTimeIntervalSeconds"))
    val SEGMENTDURATIONSECONDS_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Integer, JsonSerialName("segmentDurationSeconds"))
    val STREAMSELECTION_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Struct, JsonSerialName("streamSelection"))
    val USEAUDIORENDITIONGROUP_DESCRIPTOR = SdkFieldDescriptor(SerialKind.Boolean, JsonSerialName("useAudioRenditionGroup"))
    val OBJ_DESCRIPTOR = SdkObjectDescriptor.build {
        field(ADMARKERS_DESCRIPTOR)
        field(ADTRIGGERS_DESCRIPTOR)
        field(ADSONDELIVERYRESTRICTIONS_DESCRIPTOR)
        field(ENCRYPTION_DESCRIPTOR)
        field(INCLUDEDVBSUBTITLES_DESCRIPTOR)
        field(INCLUDEIFRAMEONLYSTREAM_DESCRIPTOR)
        field(PLAYLISTTYPE_DESCRIPTOR)
        field(PLAYLISTWINDOWSECONDS_DESCRIPTOR)
        field(PROGRAMDATETIMEINTERVALSECONDS_DESCRIPTOR)
        field(SEGMENTDURATIONSECONDS_DESCRIPTOR)
        field(STREAMSELECTION_DESCRIPTOR)
        field(USEAUDIORENDITIONGROUP_DESCRIPTOR)
    }

    deserializer.deserializeStruct(OBJ_DESCRIPTOR) {
        loop@while (true) {
            when (findNextFieldIndex()) {
                ADMARKERS_DESCRIPTOR.index -> builder.adMarkers = deserializeString().let { AdMarkers.fromValue(it) }
                ADTRIGGERS_DESCRIPTOR.index -> builder.adTriggers =
                    deserializer.deserializeList(ADTRIGGERS_DESCRIPTOR) {
                        val col0 = mutableListOf()
                        while (hasNextElement()) {
                            val el0 = if (nextHasValue()) { deserializeString().let { AdTriggersElement.fromValue(it) } } else { deserializeNull(); continue }
                            col0.add(el0)
                        }
                        col0
                    }
                ADSONDELIVERYRESTRICTIONS_DESCRIPTOR.index -> builder.adsOnDeliveryRestrictions = deserializeString().let { AdsOnDeliveryRestrictions.fromValue(it) }
                ENCRYPTION_DESCRIPTOR.index -> builder.encryption = deserializeHlsEncryptionDocument(deserializer)
                INCLUDEDVBSUBTITLES_DESCRIPTOR.index -> builder.includeDvbSubtitles = deserializeBoolean()
                INCLUDEIFRAMEONLYSTREAM_DESCRIPTOR.index -> builder.includeIframeOnlyStream = deserializeBoolean()
                PLAYLISTTYPE_DESCRIPTOR.index -> builder.playlistType = deserializeString().let { PlaylistType.fromValue(it) }
                PLAYLISTWINDOWSECONDS_DESCRIPTOR.index -> builder.playlistWindowSeconds = deserializeInt()
                PROGRAMDATETIMEINTERVALSECONDS_DESCRIPTOR.index -> builder.programDateTimeIntervalSeconds = deserializeInt()
                SEGMENTDURATIONSECONDS_DESCRIPTOR.index -> builder.segmentDurationSeconds = deserializeInt()
                STREAMSELECTION_DESCRIPTOR.index -> builder.streamSelection = deserializeStreamSelectionDocument(deserializer)
                USEAUDIORENDITIONGROUP_DESCRIPTOR.index -> builder.useAudioRenditionGroup = deserializeBoolean()
                null -> break@loop
                else -> skipValue()
            }
        }
    }
    builder.correctErrors()
    return builder.build()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy