commonMain.com.xebia.functional.openai.generated.model.CreateImageRequestModel.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 kotlinx.serialization.*
import kotlinx.serialization.builtins.*
import kotlinx.serialization.encoding.*
import kotlin.jvm.JvmStatic
import com.xebia.functional.openai.generated.model.CreateImageRequestModel.Supported.dall_e_2
import com.xebia.functional.openai.generated.model.CreateImageRequestModel.Supported.dall_e_3
/**
* The model to use for image generation.
*/
// We define a serializer for the parent sum type, and then use it to serialize the child types
@Suppress("SERIALIZER_TYPE_INCOMPATIBLE")
@Serializable(with = CreateImageRequestModelSerializer::class)
sealed interface CreateImageRequestModel {
val value: kotlin.String
@Serializable(with = CreateImageRequestModelSerializer::class)
enum class Supported(override val value: kotlin.String) : CreateImageRequestModel {
@SerialName(value = "dall-e-2") dall_e_2("dall-e-2"),@SerialName(value = "dall-e-3") dall_e_3("dall-e-3");
override fun toString(): kotlin.String = value
}
@Serializable(with = CreateImageRequestModelSerializer::class)
data class Custom(override val value: kotlin.String) : CreateImageRequestModel
companion object {
@JvmStatic
fun valueOf(value: kotlin.String): CreateImageRequestModel =
values().firstOrNull { it.value == value } ?: Custom(value)
inline val dall_e_2: CreateImageRequestModel
get() = Supported.dall_e_2
inline val dall_e_3: CreateImageRequestModel
get() = Supported.dall_e_3
@JvmStatic fun values(): List = Supported.entries
}
}
object CreateImageRequestModelSerializer : KSerializer {
private val valueSerializer = kotlin.String.serializer()
override val descriptor = valueSerializer.descriptor
override fun deserialize(decoder: Decoder): CreateImageRequestModel {
val value = decoder.decodeSerializableValue(valueSerializer)
return CreateImageRequestModel.valueOf(value)
}
override fun serialize(encoder: Encoder, value: CreateImageRequestModel) {
encoder.encodeSerializableValue(valueSerializer, value.value)
}
}