commonMain.app.bsky.graph.list.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bluesky Show documentation
Show all versions of bluesky Show documentation
Bluesky Social API bindings for Kotlin.
The newest version!
@file:Suppress("DEPRECATION")
package app.bsky.graph
import app.bsky.richtext.Facet
import kotlin.String
import kotlin.Suppress
import kotlin.jvm.JvmInline
import kotlinx.collections.immutable.persistentListOf
import kotlinx.serialization.KSerializer
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import sh.christian.ozone.api.model.Blob
import sh.christian.ozone.api.model.ReadOnlyList
import sh.christian.ozone.api.model.Timestamp
import sh.christian.ozone.api.runtime.valueClassSerializer
@Serializable
public sealed interface ListLabelsUnion {
public class SelfLabelsSerializer : KSerializer by valueClassSerializer(
serialName = "com.atproto.label.defs#selfLabels",
constructor = ::SelfLabels,
valueProvider = SelfLabels::value,
valueSerializerProvider = { com.atproto.label.SelfLabels.serializer() },
)
@Serializable(with = SelfLabelsSerializer::class)
@JvmInline
@SerialName("com.atproto.label.defs#selfLabels")
public value class SelfLabels(
public val `value`: com.atproto.label.SelfLabels,
) : ListLabelsUnion
}
/**
* @param purpose Defines the purpose of the list (aka, moderation-oriented or curration-oriented)
* @param name Display name for list; can not be empty.
*/
@Serializable
public data class List(
/**
* Defines the purpose of the list (aka, moderation-oriented or curration-oriented)
*/
public val purpose: Token,
/**
* Display name for list; can not be empty.
*/
public val name: String,
public val description: String? = null,
public val descriptionFacets: ReadOnlyList = persistentListOf(),
public val avatar: Blob? = null,
public val labels: ListLabelsUnion? = null,
public val createdAt: Timestamp,
) {
init {
require(name.count() >= 1) {
"name.count() must be >= 1, but was ${name.count()}"
}
require(name.count() <= 64) {
"name.count() must be <= 64, but was ${name.count()}"
}
require(description == null || description.count() <= 3_000) {
"description.count() must be <= 3_000, but was ${description?.count()}"
}
}
}