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

commonMain.com.xebia.functional.openai.generated.model.RunStepDeltaStepDetailsToolCallsObjectToolCallsInner.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.RunStepDeltaStepDetailsToolCallsCodeObject
import com.xebia.functional.openai.generated.model.RunStepDeltaStepDetailsToolCallsCodeObjectCodeInterpreter
import com.xebia.functional.openai.generated.model.RunStepDeltaStepDetailsToolCallsFileSearchObject
import com.xebia.functional.openai.generated.model.RunStepDeltaStepDetailsToolCallsFunctionObject
import com.xebia.functional.openai.generated.model.RunStepDeltaStepDetailsToolCallsFunctionObjectFunction
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 = RunStepDeltaStepDetailsToolCallsObjectToolCallsInnerSerializer::class)
sealed interface RunStepDeltaStepDetailsToolCallsObjectToolCallsInner {

  @JvmInline
  @Serializable
  value class CaseRunStepDeltaStepDetailsToolCallsCodeObject(val value: RunStepDeltaStepDetailsToolCallsCodeObject): RunStepDeltaStepDetailsToolCallsObjectToolCallsInner
  @JvmInline
  @Serializable
  value class CaseRunStepDeltaStepDetailsToolCallsFileSearchObject(val value: RunStepDeltaStepDetailsToolCallsFileSearchObject): RunStepDeltaStepDetailsToolCallsObjectToolCallsInner
  @JvmInline
  @Serializable
  value class CaseRunStepDeltaStepDetailsToolCallsFunctionObject(val value: RunStepDeltaStepDetailsToolCallsFunctionObject): RunStepDeltaStepDetailsToolCallsObjectToolCallsInner

}

object RunStepDeltaStepDetailsToolCallsObjectToolCallsInnerSerializer : KSerializer {
    @OptIn(InternalSerializationApi::class, ExperimentalSerializationApi::class)
    override val descriptor: SerialDescriptor = buildSerialDescriptor("RunStepDeltaStepDetailsToolCallsObjectToolCallsInner", PolymorphicKind.SEALED) { 
      element("1", RunStepDeltaStepDetailsToolCallsCodeObject.serializer().descriptor)
      element("2", RunStepDeltaStepDetailsToolCallsFileSearchObject.serializer().descriptor)
      element("3", RunStepDeltaStepDetailsToolCallsFunctionObject.serializer().descriptor)
    }

    override fun deserialize(decoder: Decoder): RunStepDeltaStepDetailsToolCallsObjectToolCallsInner {
      val jsonSerde = Json { ignoreUnknownKeys = true }
      val json = decoder.decodeSerializableValue(JsonElement.serializer())
      return attemptDeserialize(json, 
        Pair(RunStepDeltaStepDetailsToolCallsObjectToolCallsInner.CaseRunStepDeltaStepDetailsToolCallsCodeObject::class) {
          RunStepDeltaStepDetailsToolCallsObjectToolCallsInner.CaseRunStepDeltaStepDetailsToolCallsCodeObject(jsonSerde.decodeFromJsonElement(RunStepDeltaStepDetailsToolCallsCodeObject.serializer(), json))
      },
        Pair(RunStepDeltaStepDetailsToolCallsObjectToolCallsInner.CaseRunStepDeltaStepDetailsToolCallsFileSearchObject::class) {
          RunStepDeltaStepDetailsToolCallsObjectToolCallsInner.CaseRunStepDeltaStepDetailsToolCallsFileSearchObject(jsonSerde.decodeFromJsonElement(RunStepDeltaStepDetailsToolCallsFileSearchObject.serializer(), json))
      },
        Pair(RunStepDeltaStepDetailsToolCallsObjectToolCallsInner.CaseRunStepDeltaStepDetailsToolCallsFunctionObject::class) {
          RunStepDeltaStepDetailsToolCallsObjectToolCallsInner.CaseRunStepDeltaStepDetailsToolCallsFunctionObject(jsonSerde.decodeFromJsonElement(RunStepDeltaStepDetailsToolCallsFunctionObject.serializer(), json))
      })
    }

    override fun serialize(encoder: Encoder, value: RunStepDeltaStepDetailsToolCallsObjectToolCallsInner) =
      when(value) { 
        is RunStepDeltaStepDetailsToolCallsObjectToolCallsInner.CaseRunStepDeltaStepDetailsToolCallsCodeObject ->
        encoder.encodeSerializableValue(RunStepDeltaStepDetailsToolCallsCodeObject.serializer(), value.value)

        is RunStepDeltaStepDetailsToolCallsObjectToolCallsInner.CaseRunStepDeltaStepDetailsToolCallsFileSearchObject ->
        encoder.encodeSerializableValue(RunStepDeltaStepDetailsToolCallsFileSearchObject.serializer(), value.value)

        is RunStepDeltaStepDetailsToolCallsObjectToolCallsInner.CaseRunStepDeltaStepDetailsToolCallsFunctionObject ->
        encoder.encodeSerializableValue(RunStepDeltaStepDetailsToolCallsFunctionObject.serializer(), value.value)
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy