Package-level declarations

Types

Link copied to clipboard
object BooleanToNumber : KSerializer<Boolean>

0 -> false other -> true, decode true to 1

Link copied to clipboard
data class Gateway(val url: String) : GatewayInfo

[https://bot.q.qq.com/wiki/develop/api/openapi/wss/url_get.html#%E8%BF%94%E5%9B%9E] 一个用于连接 websocket 的地址。

Link copied to clipboard
Link copied to clipboard
sealed class GatewayInfo

Base sealed class for Gateway and GatewayWithShard.

Link copied to clipboard
data class GatewayWithShard(val url: String, val shards: Int, val sessionStartLimit: SessionStartLimit) : GatewayInfo

[https://bot.q.qq.com/wiki/develop/api/openapi/wss/shard_url_get.html#%E8%BF%94%E5%9B%9E] 一个用于连接 websocket 的地址。同时返回建议的分片数,以及目前连接数使用情况。

Link copied to clipboard
abstract class GetTencentApi<R> : TencentApi<R>
Link copied to clipboard
fun interface ParametersAppender
Link copied to clipboard
class RouteInfoBuilder(val parametersAppender: ParametersAppender)
Link copied to clipboard
data class SessionStartLimit(val total: Int, val remaining: Int, val resetAfter: Int, val maxConcurrency: Int)

https://bot.q.qq.com/wiki/develop/api/openapi/wss/shard_url_get.html#sessionstartlimit

Link copied to clipboard
abstract class TencentApi<out R>

表示为一个腾讯频道的API。

Link copied to clipboard
Link copied to clipboard
sealed class TencentCacheableApi<R> : TencentApi<R>

支持结果缓存的 TencentApi 实现, 会通过一定的策略对目标 TencentApi 的结果进行缓存,并在 doRequest 中进行获取并跳过请求环节。

Functions

Link copied to clipboard
fun <R> doRequest(api: TencentApi<R>, client: HttpClient, server: String, token: String, decoder: StringFormat = defaultJson): R

for Java

Link copied to clipboard
@Api4J
fun newHttpClient(): HttpClient
Link copied to clipboard
fun newJson(build: Consumer<JsonBuilder> = Consumer { it.apply { isLenient = true ignoreUnknownKeys = true } }): Json
Link copied to clipboard
suspend fun <R> TencentApi<R>.request(client: HttpClient, server: Url, token: String, decoder: StringFormat = defaultJson): R

通过提供的参数,对此api进行请求并得到最终结果。