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

commonMain.com.xebia.functional.openai.generated.model.RunStepStreamEvent.kt Maven / Gradle / Ivy

There is a newer version: 0.0.5-alpha.118
Show newest version
/**
 *
 * Please note:
 * This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * Do not edit this file manually.
 *
 */

@file:Suppress(
    "ArrayInDataClass",
    "EnumEntryName",
    "RemoveRedundantQualifierName",
    "UnusedImport"
)

package com.xebia.functional.openai.generated.model

import com.xebia.functional.openai.generated.model.RunStepObject
import com.xebia.functional.openai.generated.model.RunStepStreamEventOneOf
import com.xebia.functional.openai.generated.model.RunStepStreamEventOneOf1
import com.xebia.functional.openai.generated.model.RunStepStreamEventOneOf2
import com.xebia.functional.openai.generated.model.RunStepStreamEventOneOf3
import com.xebia.functional.openai.generated.model.RunStepStreamEventOneOf4
import com.xebia.functional.openai.generated.model.RunStepStreamEventOneOf5
import com.xebia.functional.openai.generated.model.RunStepStreamEventOneOf6
import com.xebia.functional.openai.attemptDeserialize
import kotlin.jvm.JvmInline
import kotlinx.serialization.*
import kotlinx.serialization.builtins.*
import kotlinx.serialization.descriptors.*
import kotlinx.serialization.encoding.*
import kotlinx.serialization.json.*

@Serializable(with = RunStepStreamEventSerializer::class)
sealed interface RunStepStreamEvent {

  @JvmInline
  @Serializable
  value class CaseRunStepStreamEventOneOf(val value: RunStepStreamEventOneOf): RunStepStreamEvent
  @JvmInline
  @Serializable
  value class CaseRunStepStreamEventOneOf1(val value: RunStepStreamEventOneOf1): RunStepStreamEvent
  @JvmInline
  @Serializable
  value class CaseRunStepStreamEventOneOf2(val value: RunStepStreamEventOneOf2): RunStepStreamEvent
  @JvmInline
  @Serializable
  value class CaseRunStepStreamEventOneOf3(val value: RunStepStreamEventOneOf3): RunStepStreamEvent
  @JvmInline
  @Serializable
  value class CaseRunStepStreamEventOneOf4(val value: RunStepStreamEventOneOf4): RunStepStreamEvent
  @JvmInline
  @Serializable
  value class CaseRunStepStreamEventOneOf5(val value: RunStepStreamEventOneOf5): RunStepStreamEvent
  @JvmInline
  @Serializable
  value class CaseRunStepStreamEventOneOf6(val value: RunStepStreamEventOneOf6): RunStepStreamEvent

}

object RunStepStreamEventSerializer : KSerializer {
    @OptIn(InternalSerializationApi::class, ExperimentalSerializationApi::class)
    override val descriptor: SerialDescriptor = buildSerialDescriptor("RunStepStreamEvent", PolymorphicKind.SEALED) { 
      element("1", RunStepStreamEventOneOf.serializer().descriptor)
      element("2", RunStepStreamEventOneOf1.serializer().descriptor)
      element("3", RunStepStreamEventOneOf2.serializer().descriptor)
      element("4", RunStepStreamEventOneOf3.serializer().descriptor)
      element("5", RunStepStreamEventOneOf4.serializer().descriptor)
      element("6", RunStepStreamEventOneOf5.serializer().descriptor)
      element("7", RunStepStreamEventOneOf6.serializer().descriptor)
    }

    override fun deserialize(decoder: Decoder): RunStepStreamEvent {
      val jsonSerde = Json { ignoreUnknownKeys = true }
      val json = decoder.decodeSerializableValue(JsonElement.serializer())
      return attemptDeserialize(json, 
        Pair(RunStepStreamEvent.CaseRunStepStreamEventOneOf::class) {
          RunStepStreamEvent.CaseRunStepStreamEventOneOf(jsonSerde.decodeFromJsonElement(RunStepStreamEventOneOf.serializer(), json))
      },
        Pair(RunStepStreamEvent.CaseRunStepStreamEventOneOf1::class) {
          RunStepStreamEvent.CaseRunStepStreamEventOneOf1(jsonSerde.decodeFromJsonElement(RunStepStreamEventOneOf1.serializer(), json))
      },
        Pair(RunStepStreamEvent.CaseRunStepStreamEventOneOf2::class) {
          RunStepStreamEvent.CaseRunStepStreamEventOneOf2(jsonSerde.decodeFromJsonElement(RunStepStreamEventOneOf2.serializer(), json))
      },
        Pair(RunStepStreamEvent.CaseRunStepStreamEventOneOf3::class) {
          RunStepStreamEvent.CaseRunStepStreamEventOneOf3(jsonSerde.decodeFromJsonElement(RunStepStreamEventOneOf3.serializer(), json))
      },
        Pair(RunStepStreamEvent.CaseRunStepStreamEventOneOf4::class) {
          RunStepStreamEvent.CaseRunStepStreamEventOneOf4(jsonSerde.decodeFromJsonElement(RunStepStreamEventOneOf4.serializer(), json))
      },
        Pair(RunStepStreamEvent.CaseRunStepStreamEventOneOf5::class) {
          RunStepStreamEvent.CaseRunStepStreamEventOneOf5(jsonSerde.decodeFromJsonElement(RunStepStreamEventOneOf5.serializer(), json))
      },
        Pair(RunStepStreamEvent.CaseRunStepStreamEventOneOf6::class) {
          RunStepStreamEvent.CaseRunStepStreamEventOneOf6(jsonSerde.decodeFromJsonElement(RunStepStreamEventOneOf6.serializer(), json))
      })
    }

    override fun serialize(encoder: Encoder, value: RunStepStreamEvent) =
      when(value) { 
        is RunStepStreamEvent.CaseRunStepStreamEventOneOf ->
        encoder.encodeSerializableValue(RunStepStreamEventOneOf.serializer(), value.value)

        is RunStepStreamEvent.CaseRunStepStreamEventOneOf1 ->
        encoder.encodeSerializableValue(RunStepStreamEventOneOf1.serializer(), value.value)

        is RunStepStreamEvent.CaseRunStepStreamEventOneOf2 ->
        encoder.encodeSerializableValue(RunStepStreamEventOneOf2.serializer(), value.value)

        is RunStepStreamEvent.CaseRunStepStreamEventOneOf3 ->
        encoder.encodeSerializableValue(RunStepStreamEventOneOf3.serializer(), value.value)

        is RunStepStreamEvent.CaseRunStepStreamEventOneOf4 ->
        encoder.encodeSerializableValue(RunStepStreamEventOneOf4.serializer(), value.value)

        is RunStepStreamEvent.CaseRunStepStreamEventOneOf5 ->
        encoder.encodeSerializableValue(RunStepStreamEventOneOf5.serializer(), value.value)

        is RunStepStreamEvent.CaseRunStepStreamEventOneOf6 ->
        encoder.encodeSerializableValue(RunStepStreamEventOneOf6.serializer(), value.value)
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy