commonMain.net.folivo.trixnity.clientserverapi.model.uia.UIAState.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of trixnity-clientserverapi-model Show documentation
Show all versions of trixnity-clientserverapi-model Show documentation
Multiplatform Kotlin SDK for matrix-protocol
package net.folivo.trixnity.clientserverapi.model.uia
import kotlinx.serialization.KSerializer
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import kotlinx.serialization.SerializationException
import kotlinx.serialization.descriptors.SerialDescriptor
import kotlinx.serialization.descriptors.buildClassSerialDescriptor
import kotlinx.serialization.encoding.Decoder
import kotlinx.serialization.encoding.Encoder
import kotlinx.serialization.json.*
import net.folivo.trixnity.clientserverapi.model.uia.UIAState.Parameter
import net.folivo.trixnity.clientserverapi.model.uia.UIAState.Parameter.TermsOfService.PolicyDefinition
@Serializable
data class UIAState(
@SerialName("completed") val completed: List = listOf(),
@SerialName("flows") val flows: Set = setOf(),
@SerialName("params") val parameter: @Serializable(with = UIAStateParameterMapSerializer::class) Map? = null,
@SerialName("session") val session: String? = null
) {
@Serializable
data class FlowInformation(
@SerialName("stages") val stages: List
)
sealed interface Parameter {
@Serializable
data class TermsOfService(
@SerialName("policies")
val policies: Map
) : Parameter {
@Serializable(with = PolicyDefinitionSerializer::class)
data class PolicyDefinition(
val version: String,
val translations: Map,
) {
@Serializable
data class PolicyTranslation(
@SerialName("name") val name: String,
@SerialName("url") val url: String,
)
}
}
@Serializable
data class Unknown(val raw: JsonElement) : Parameter
}
}
class UIAStateParameterMapSerializer : KSerializer