commonMain.app.bsky.feed.getPostThread.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.feed
import kotlin.Any
import kotlin.Long
import kotlin.Pair
import kotlin.String
import kotlin.Suppress
import kotlin.collections.List
import kotlin.jvm.JvmInline
import kotlinx.serialization.KSerializer
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import sh.christian.ozone.api.AtUri
import sh.christian.ozone.api.model.JsonContent
import sh.christian.ozone.api.runtime.valueClassSerializer
@Serializable
public sealed interface GetPostThreadResponseThreadUnion {
public class ThreadViewPostSerializer : KSerializer by valueClassSerializer(
serialName = "app.bsky.feed.defs#threadViewPost",
constructor = ::ThreadViewPost,
valueProvider = ThreadViewPost::value,
valueSerializerProvider = { app.bsky.feed.ThreadViewPost.serializer() },
)
@JvmInline
@Serializable(with = ThreadViewPostSerializer::class)
@SerialName("app.bsky.feed.defs#threadViewPost")
public value class ThreadViewPost(
public val `value`: app.bsky.feed.ThreadViewPost,
) : GetPostThreadResponseThreadUnion
public class NotFoundPostSerializer : KSerializer by valueClassSerializer(
serialName = "app.bsky.feed.defs#notFoundPost",
constructor = ::NotFoundPost,
valueProvider = NotFoundPost::value,
valueSerializerProvider = { app.bsky.feed.NotFoundPost.serializer() },
)
@JvmInline
@Serializable(with = NotFoundPostSerializer::class)
@SerialName("app.bsky.feed.defs#notFoundPost")
public value class NotFoundPost(
public val `value`: app.bsky.feed.NotFoundPost,
) : GetPostThreadResponseThreadUnion
public class BlockedPostSerializer : KSerializer by valueClassSerializer(
serialName = "app.bsky.feed.defs#blockedPost",
constructor = ::BlockedPost,
valueProvider = BlockedPost::value,
valueSerializerProvider = { app.bsky.feed.BlockedPost.serializer() },
)
@JvmInline
@Serializable(with = BlockedPostSerializer::class)
@SerialName("app.bsky.feed.defs#blockedPost")
public value class BlockedPost(
public val `value`: app.bsky.feed.BlockedPost,
) : GetPostThreadResponseThreadUnion
@JvmInline
@Serializable
public value class Unknown(
public val `value`: JsonContent,
) : GetPostThreadResponseThreadUnion
}
/**
* @param uri Reference (AT-URI) to post record.
* @param depth How many levels of reply depth should be included in response.
* @param parentHeight How many levels of parent (and grandparent, etc) post to include.
*/
@Serializable
public data class GetPostThreadQueryParams(
/**
* Reference (AT-URI) to post record.
*/
public val uri: AtUri,
/**
* How many levels of reply depth should be included in response.
*/
public val depth: Long? = 6,
/**
* How many levels of parent (and grandparent, etc) post to include.
*/
public val parentHeight: Long? = 80,
) {
init {
require(depth == null || depth >= 0) {
"depth must be >= 0, but was $depth"
}
require(depth == null || depth <= 1_000) {
"depth must be <= 1_000, but was $depth"
}
require(parentHeight == null || parentHeight >= 0) {
"parentHeight must be >= 0, but was $parentHeight"
}
require(parentHeight == null || parentHeight <= 1_000) {
"parentHeight must be <= 1_000, but was $parentHeight"
}
}
public fun asList(): List> = buildList {
add("uri" to uri)
add("depth" to depth)
add("parentHeight" to parentHeight)
}
}
@Serializable
public data class GetPostThreadResponse(
public val thread: GetPostThreadResponseThreadUnion,
public val threadgate: ThreadgateView? = null,
)
© 2015 - 2024 Weber Informatics LLC | Privacy Policy