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

commonMain.com.xebia.functional.openai.generated.model.RunStepDetailsToolCallsCodeObjectCodeInterpreterOutputsInner.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.RunStepDetailsToolCallsCodeOutputImageObject
import com.xebia.functional.openai.generated.model.RunStepDetailsToolCallsCodeOutputImageObjectImage
import com.xebia.functional.openai.generated.model.RunStepDetailsToolCallsCodeOutputLogsObject
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 = RunStepDetailsToolCallsCodeObjectCodeInterpreterOutputsInnerSerializer::class)
sealed interface RunStepDetailsToolCallsCodeObjectCodeInterpreterOutputsInner {

  @JvmInline
  @Serializable
  value class CaseRunStepDetailsToolCallsCodeOutputImageObject(val value: RunStepDetailsToolCallsCodeOutputImageObject): RunStepDetailsToolCallsCodeObjectCodeInterpreterOutputsInner
  @JvmInline
  @Serializable
  value class CaseRunStepDetailsToolCallsCodeOutputLogsObject(val value: RunStepDetailsToolCallsCodeOutputLogsObject): RunStepDetailsToolCallsCodeObjectCodeInterpreterOutputsInner

}

object RunStepDetailsToolCallsCodeObjectCodeInterpreterOutputsInnerSerializer : KSerializer {
    @OptIn(InternalSerializationApi::class, ExperimentalSerializationApi::class)
    override val descriptor: SerialDescriptor = buildSerialDescriptor("RunStepDetailsToolCallsCodeObjectCodeInterpreterOutputsInner", PolymorphicKind.SEALED) { 
      element("1", RunStepDetailsToolCallsCodeOutputImageObject.serializer().descriptor)
      element("2", RunStepDetailsToolCallsCodeOutputLogsObject.serializer().descriptor)
    }

    override fun deserialize(decoder: Decoder): RunStepDetailsToolCallsCodeObjectCodeInterpreterOutputsInner {
      val jsonSerde = Json { ignoreUnknownKeys = true }
      val json = decoder.decodeSerializableValue(JsonElement.serializer())
      return attemptDeserialize(json, 
        Pair(RunStepDetailsToolCallsCodeObjectCodeInterpreterOutputsInner.CaseRunStepDetailsToolCallsCodeOutputImageObject::class) {
          RunStepDetailsToolCallsCodeObjectCodeInterpreterOutputsInner.CaseRunStepDetailsToolCallsCodeOutputImageObject(jsonSerde.decodeFromJsonElement(RunStepDetailsToolCallsCodeOutputImageObject.serializer(), json))
      },
        Pair(RunStepDetailsToolCallsCodeObjectCodeInterpreterOutputsInner.CaseRunStepDetailsToolCallsCodeOutputLogsObject::class) {
          RunStepDetailsToolCallsCodeObjectCodeInterpreterOutputsInner.CaseRunStepDetailsToolCallsCodeOutputLogsObject(jsonSerde.decodeFromJsonElement(RunStepDetailsToolCallsCodeOutputLogsObject.serializer(), json))
      })
    }

    override fun serialize(encoder: Encoder, value: RunStepDetailsToolCallsCodeObjectCodeInterpreterOutputsInner) =
      when(value) { 
        is RunStepDetailsToolCallsCodeObjectCodeInterpreterOutputsInner.CaseRunStepDetailsToolCallsCodeOutputImageObject ->
        encoder.encodeSerializableValue(RunStepDetailsToolCallsCodeOutputImageObject.serializer(), value.value)

        is RunStepDetailsToolCallsCodeObjectCodeInterpreterOutputsInner.CaseRunStepDetailsToolCallsCodeOutputLogsObject ->
        encoder.encodeSerializableValue(RunStepDetailsToolCallsCodeOutputLogsObject.serializer(), value.value)
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy