commonMain.com.atproto.label.queryLabels.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 com.atproto.label
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.Did
import sh.christian.ozone.api.model.ReadOnlyList
/**
* @param uriPatterns List of AT URI patterns to match (boolean 'OR'). Each may be a prefix (ending
* with '*'; will match inclusive of the string leading to '*'), or a full URI.
* @param sources Optional list of label sources (DIDs) to filter on.
*/
@Serializable
public data class QueryLabelsQueryParams(
/**
* List of AT URI patterns to match (boolean 'OR'). Each may be a prefix (ending with '*'; will
* match inclusive of the string leading to '*'), or a full URI.
*/
public val uriPatterns: ReadOnlyList,
/**
* Optional list of label sources (DIDs) to filter on.
*/
public val sources: ReadOnlyList = persistentListOf(),
public val limit: Long? = 50,
public val cursor: String? = null,
) {
init {
require(limit == null || limit >= 1) {
"limit must be >= 1, but was $limit"
}
require(limit == null || limit <= 250) {
"limit must be <= 250, but was $limit"
}
}
public fun asList(): ReadOnlyList> = buildList {
uriPatterns.forEach {
add("uriPatterns" to it)
}
sources.forEach {
add("sources" to it)
}
add("limit" to limit)
add("cursor" to cursor)
}.toImmutableList()
}
@Serializable
public data class QueryLabelsResponse(
public val cursor: String? = null,
public val labels: ReadOnlyList