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

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

There is a newer version: 0.0.5-alpha.119
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.RunObject
import com.xebia.functional.openai.generated.model.RunStreamEventOneOf
import com.xebia.functional.openai.generated.model.RunStreamEventOneOf1
import com.xebia.functional.openai.generated.model.RunStreamEventOneOf2
import com.xebia.functional.openai.generated.model.RunStreamEventOneOf3
import com.xebia.functional.openai.generated.model.RunStreamEventOneOf4
import com.xebia.functional.openai.generated.model.RunStreamEventOneOf5
import com.xebia.functional.openai.generated.model.RunStreamEventOneOf6
import com.xebia.functional.openai.generated.model.RunStreamEventOneOf7
import com.xebia.functional.openai.generated.model.RunStreamEventOneOf8
import com.xebia.functional.openai.generated.model.RunStreamEventOneOf9
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 = RunStreamEventSerializer::class)
sealed interface RunStreamEvent {

  @JvmInline
  @Serializable
  value class CaseRunStreamEventOneOf(val value: RunStreamEventOneOf): RunStreamEvent
  @JvmInline
  @Serializable
  value class CaseRunStreamEventOneOf1(val value: RunStreamEventOneOf1): RunStreamEvent
  @JvmInline
  @Serializable
  value class CaseRunStreamEventOneOf2(val value: RunStreamEventOneOf2): RunStreamEvent
  @JvmInline
  @Serializable
  value class CaseRunStreamEventOneOf3(val value: RunStreamEventOneOf3): RunStreamEvent
  @JvmInline
  @Serializable
  value class CaseRunStreamEventOneOf4(val value: RunStreamEventOneOf4): RunStreamEvent
  @JvmInline
  @Serializable
  value class CaseRunStreamEventOneOf5(val value: RunStreamEventOneOf5): RunStreamEvent
  @JvmInline
  @Serializable
  value class CaseRunStreamEventOneOf6(val value: RunStreamEventOneOf6): RunStreamEvent
  @JvmInline
  @Serializable
  value class CaseRunStreamEventOneOf7(val value: RunStreamEventOneOf7): RunStreamEvent
  @JvmInline
  @Serializable
  value class CaseRunStreamEventOneOf8(val value: RunStreamEventOneOf8): RunStreamEvent
  @JvmInline
  @Serializable
  value class CaseRunStreamEventOneOf9(val value: RunStreamEventOneOf9): RunStreamEvent

}

object RunStreamEventSerializer : KSerializer {
    @OptIn(InternalSerializationApi::class, ExperimentalSerializationApi::class)
    override val descriptor: SerialDescriptor = buildSerialDescriptor("RunStreamEvent", PolymorphicKind.SEALED) { 
      element("1", RunStreamEventOneOf.serializer().descriptor)
      element("2", RunStreamEventOneOf1.serializer().descriptor)
      element("3", RunStreamEventOneOf2.serializer().descriptor)
      element("4", RunStreamEventOneOf3.serializer().descriptor)
      element("5", RunStreamEventOneOf4.serializer().descriptor)
      element("6", RunStreamEventOneOf5.serializer().descriptor)
      element("7", RunStreamEventOneOf6.serializer().descriptor)
      element("8", RunStreamEventOneOf7.serializer().descriptor)
      element("9", RunStreamEventOneOf8.serializer().descriptor)
      element("10", RunStreamEventOneOf9.serializer().descriptor)
    }

    override fun deserialize(decoder: Decoder): RunStreamEvent {
      val jsonSerde = Json { ignoreUnknownKeys = true }
      val json = decoder.decodeSerializableValue(JsonElement.serializer())
      return attemptDeserialize(json, 
        Pair(RunStreamEvent.CaseRunStreamEventOneOf::class) {
          RunStreamEvent.CaseRunStreamEventOneOf(jsonSerde.decodeFromJsonElement(RunStreamEventOneOf.serializer(), json))
      },
        Pair(RunStreamEvent.CaseRunStreamEventOneOf1::class) {
          RunStreamEvent.CaseRunStreamEventOneOf1(jsonSerde.decodeFromJsonElement(RunStreamEventOneOf1.serializer(), json))
      },
        Pair(RunStreamEvent.CaseRunStreamEventOneOf2::class) {
          RunStreamEvent.CaseRunStreamEventOneOf2(jsonSerde.decodeFromJsonElement(RunStreamEventOneOf2.serializer(), json))
      },
        Pair(RunStreamEvent.CaseRunStreamEventOneOf3::class) {
          RunStreamEvent.CaseRunStreamEventOneOf3(jsonSerde.decodeFromJsonElement(RunStreamEventOneOf3.serializer(), json))
      },
        Pair(RunStreamEvent.CaseRunStreamEventOneOf4::class) {
          RunStreamEvent.CaseRunStreamEventOneOf4(jsonSerde.decodeFromJsonElement(RunStreamEventOneOf4.serializer(), json))
      },
        Pair(RunStreamEvent.CaseRunStreamEventOneOf5::class) {
          RunStreamEvent.CaseRunStreamEventOneOf5(jsonSerde.decodeFromJsonElement(RunStreamEventOneOf5.serializer(), json))
      },
        Pair(RunStreamEvent.CaseRunStreamEventOneOf6::class) {
          RunStreamEvent.CaseRunStreamEventOneOf6(jsonSerde.decodeFromJsonElement(RunStreamEventOneOf6.serializer(), json))
      },
        Pair(RunStreamEvent.CaseRunStreamEventOneOf7::class) {
          RunStreamEvent.CaseRunStreamEventOneOf7(jsonSerde.decodeFromJsonElement(RunStreamEventOneOf7.serializer(), json))
      },
        Pair(RunStreamEvent.CaseRunStreamEventOneOf8::class) {
          RunStreamEvent.CaseRunStreamEventOneOf8(jsonSerde.decodeFromJsonElement(RunStreamEventOneOf8.serializer(), json))
      },
        Pair(RunStreamEvent.CaseRunStreamEventOneOf9::class) {
          RunStreamEvent.CaseRunStreamEventOneOf9(jsonSerde.decodeFromJsonElement(RunStreamEventOneOf9.serializer(), json))
      })
    }

    override fun serialize(encoder: Encoder, value: RunStreamEvent) =
      when(value) { 
        is RunStreamEvent.CaseRunStreamEventOneOf ->
        encoder.encodeSerializableValue(RunStreamEventOneOf.serializer(), value.value)

        is RunStreamEvent.CaseRunStreamEventOneOf1 ->
        encoder.encodeSerializableValue(RunStreamEventOneOf1.serializer(), value.value)

        is RunStreamEvent.CaseRunStreamEventOneOf2 ->
        encoder.encodeSerializableValue(RunStreamEventOneOf2.serializer(), value.value)

        is RunStreamEvent.CaseRunStreamEventOneOf3 ->
        encoder.encodeSerializableValue(RunStreamEventOneOf3.serializer(), value.value)

        is RunStreamEvent.CaseRunStreamEventOneOf4 ->
        encoder.encodeSerializableValue(RunStreamEventOneOf4.serializer(), value.value)

        is RunStreamEvent.CaseRunStreamEventOneOf5 ->
        encoder.encodeSerializableValue(RunStreamEventOneOf5.serializer(), value.value)

        is RunStreamEvent.CaseRunStreamEventOneOf6 ->
        encoder.encodeSerializableValue(RunStreamEventOneOf6.serializer(), value.value)

        is RunStreamEvent.CaseRunStreamEventOneOf7 ->
        encoder.encodeSerializableValue(RunStreamEventOneOf7.serializer(), value.value)

        is RunStreamEvent.CaseRunStreamEventOneOf8 ->
        encoder.encodeSerializableValue(RunStreamEventOneOf8.serializer(), value.value)

        is RunStreamEvent.CaseRunStreamEventOneOf9 ->
        encoder.encodeSerializableValue(RunStreamEventOneOf9.serializer(), value.value)
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy