commonMain.tools.ozone.setting.listOptions.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 tools.ozone.setting
import kotlin.Any
import kotlin.Long
import kotlin.Pair
import kotlin.String
import kotlin.Suppress
import kotlinx.collections.immutable.persistentListOf
import kotlinx.collections.immutable.toImmutableList
import kotlinx.serialization.Serializable
import sh.christian.ozone.api.Nsid
import sh.christian.ozone.api.model.ReadOnlyList
/**
* @param prefix Filter keys by prefix
* @param keys Filter for only the specified keys. Ignored if prefix is provided
*/
@Serializable
public data class ListOptionsQueryParams(
public val limit: Long? = 50,
public val cursor: String? = null,
public val scope: ListOptionsScope? = ListOptionsScope.Instance,
/**
* Filter keys by prefix
*/
public val prefix: String? = null,
/**
* Filter for only the specified keys. Ignored if prefix is provided
*/
public val keys: ReadOnlyList = persistentListOf(),
) {
init {
require(limit == null || limit >= 1) {
"limit must be >= 1, but was $limit"
}
require(limit == null || limit <= 100) {
"limit must be <= 100, but was $limit"
}
require(keys.count() <= 100) {
"keys.count() must be <= 100, but was ${keys.count()}"
}
}
public fun asList(): ReadOnlyList> = buildList {
add("limit" to limit)
add("cursor" to cursor)
add("scope" to scope)
add("prefix" to prefix)
keys.forEach {
add("keys" to it)
}
}.toImmutableList()
}
@Serializable
public data class ListOptionsResponse(
public val cursor: String? = null,
public val options: ReadOnlyList