commonMain.app.bsky.feed.postgate.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bluesky-jvm Show documentation
Show all versions of bluesky-jvm Show documentation
Bluesky Social API bindings for Kotlin.
The newest version!
@file:Suppress("DEPRECATION")
package app.bsky.feed
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.AtUri
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 PostgateEmbeddingRuleUnion {
public class DisableRuleSerializer : KSerializer by valueClassSerializer(
serialName = "app.bsky.feed.postgate#disableRule",
constructor = ::DisableRule,
valueProvider = DisableRule::value,
valueSerializerProvider = { PostgateDisableRule.serializer() },
)
@Serializable(with = DisableRuleSerializer::class)
@JvmInline
@SerialName("app.bsky.feed.postgate#disableRule")
public value class DisableRule(
public val `value`: PostgateDisableRule,
) : PostgateEmbeddingRuleUnion
}
/**
* @param post Reference (AT-URI) to the post record.
* @param detachedEmbeddingUris List of AT-URIs embedding this post that the author has detached
* from.
*/
@Serializable
public data class Postgate(
public val createdAt: Timestamp,
/**
* Reference (AT-URI) to the post record.
*/
public val post: AtUri,
/**
* List of AT-URIs embedding this post that the author has detached from.
*/
public val detachedEmbeddingUris: ReadOnlyList = persistentListOf(),
public val embeddingRules: ReadOnlyList = persistentListOf(),
) {
init {
require(detachedEmbeddingUris.count() <= 50) {
"detachedEmbeddingUris.count() must be <= 50, but was ${detachedEmbeddingUris.count()}"
}
require(embeddingRules.count() <= 5) {
"embeddingRules.count() must be <= 5, but was ${embeddingRules.count()}"
}
}
}