commonMain.com.xebia.functional.openai.generated.model.CreateSpeechRequestModel.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 Show documentation
Show all versions of xef-openai-client 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.CreateSpeechRequestModel.Supported.tts_1
import com.xebia.functional.openai.generated.model.CreateSpeechRequestModel.Supported.tts_1_hd
/**
* One of the available [TTS models](/docs/models/tts): `tts-1` or `tts-1-hd`
*/
// We define a serializer for the parent sum type, and then use it to serialize the child types
@Suppress("SERIALIZER_TYPE_INCOMPATIBLE")
@Serializable(with = CreateSpeechRequestModelSerializer::class)
sealed interface CreateSpeechRequestModel {
val value: kotlin.String
@Serializable(with = CreateSpeechRequestModelSerializer::class)
enum class Supported(override val value: kotlin.String) : CreateSpeechRequestModel {
@SerialName(value = "tts-1") tts_1("tts-1"),@SerialName(value = "tts-1-hd") tts_1_hd("tts-1-hd");
override fun toString(): kotlin.String = value
}
@Serializable(with = CreateSpeechRequestModelSerializer::class)
data class Custom(override val value: kotlin.String) : CreateSpeechRequestModel
companion object {
@JvmStatic
fun valueOf(value: kotlin.String): CreateSpeechRequestModel =
values().firstOrNull { it.value == value } ?: Custom(value)
inline val tts_1: CreateSpeechRequestModel
get() = Supported.tts_1
inline val tts_1_hd: CreateSpeechRequestModel
get() = Supported.tts_1_hd
@JvmStatic fun values(): List = Supported.entries
}
}
object CreateSpeechRequestModelSerializer : KSerializer {
private val valueSerializer = kotlin.String.serializer()
override val descriptor = valueSerializer.descriptor
override fun deserialize(decoder: Decoder): CreateSpeechRequestModel {
val value = decoder.decodeSerializableValue(valueSerializer)
return CreateSpeechRequestModel.valueOf(value)
}
override fun serialize(encoder: Encoder, value: CreateSpeechRequestModel) {
encoder.encodeSerializableValue(valueSerializer, value.value)
}
}