commonMain.com.xebia.functional.openai.generated.model.MessageDeltaContentTextObjectTextAnnotationsInner.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of xef-openai-client-jvm Show documentation
Show all versions of xef-openai-client-jvm Show documentation
Building applications with LLMs through composability in Kotlin
/**
*
* 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.MessageDeltaContentTextAnnotationsFileCitationObject
import com.xebia.functional.openai.generated.model.MessageDeltaContentTextAnnotationsFileCitationObjectFileCitation
import com.xebia.functional.openai.generated.model.MessageDeltaContentTextAnnotationsFilePathObject
import com.xebia.functional.openai.generated.model.MessageDeltaContentTextAnnotationsFilePathObjectFilePath
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 = MessageDeltaContentTextObjectTextAnnotationsInnerSerializer::class)
sealed interface MessageDeltaContentTextObjectTextAnnotationsInner {
@JvmInline
@Serializable
value class CaseMessageDeltaContentTextAnnotationsFileCitationObject(val value: MessageDeltaContentTextAnnotationsFileCitationObject): MessageDeltaContentTextObjectTextAnnotationsInner
@JvmInline
@Serializable
value class CaseMessageDeltaContentTextAnnotationsFilePathObject(val value: MessageDeltaContentTextAnnotationsFilePathObject): MessageDeltaContentTextObjectTextAnnotationsInner
}
object MessageDeltaContentTextObjectTextAnnotationsInnerSerializer : KSerializer {
@OptIn(InternalSerializationApi::class, ExperimentalSerializationApi::class)
override val descriptor: SerialDescriptor = buildSerialDescriptor("MessageDeltaContentTextObjectTextAnnotationsInner", PolymorphicKind.SEALED) {
element("1", MessageDeltaContentTextAnnotationsFileCitationObject.serializer().descriptor)
element("2", MessageDeltaContentTextAnnotationsFilePathObject.serializer().descriptor)
}
override fun deserialize(decoder: Decoder): MessageDeltaContentTextObjectTextAnnotationsInner {
val jsonSerde = Json { ignoreUnknownKeys = true }
val json = decoder.decodeSerializableValue(JsonElement.serializer())
return attemptDeserialize(json,
Pair(MessageDeltaContentTextObjectTextAnnotationsInner.CaseMessageDeltaContentTextAnnotationsFileCitationObject::class) {
MessageDeltaContentTextObjectTextAnnotationsInner.CaseMessageDeltaContentTextAnnotationsFileCitationObject(jsonSerde.decodeFromJsonElement(MessageDeltaContentTextAnnotationsFileCitationObject.serializer(), json))
},
Pair(MessageDeltaContentTextObjectTextAnnotationsInner.CaseMessageDeltaContentTextAnnotationsFilePathObject::class) {
MessageDeltaContentTextObjectTextAnnotationsInner.CaseMessageDeltaContentTextAnnotationsFilePathObject(jsonSerde.decodeFromJsonElement(MessageDeltaContentTextAnnotationsFilePathObject.serializer(), json))
})
}
override fun serialize(encoder: Encoder, value: MessageDeltaContentTextObjectTextAnnotationsInner) =
when(value) {
is MessageDeltaContentTextObjectTextAnnotationsInner.CaseMessageDeltaContentTextAnnotationsFileCitationObject ->
encoder.encodeSerializableValue(MessageDeltaContentTextAnnotationsFileCitationObject.serializer(), value.value)
is MessageDeltaContentTextObjectTextAnnotationsInner.CaseMessageDeltaContentTextAnnotationsFilePathObject ->
encoder.encodeSerializableValue(MessageDeltaContentTextAnnotationsFilePathObject.serializer(), value.value)
}
}