QQGuildApi

interface QQGuildApi<out R : Any> : ApiDefinition<R> (source)

表示为一个QQ频道的API。

通过 requestData 发起一次请求。

日志

QQGuildApi 在进行请求的过程中会通过名称 love.forte.simbot.qguild.api 输出 DEBUG 日志,其中:

[   GET /foo/bar] =====> api.xxx.com, body: xxx

向右箭头的日志代表 request 相关的信息,

[   GET /foo/bar] <===== status: xxx, body: xxx

向左的日志则代表 response 相关的信息。

如果希望关闭日志中 request method 的染色,添加JVM参数

-Dsimbot.qguild.api.logger.color.enable=false

Inheritors

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
abstract override val body: Any?

此次请求所发送的数据。为null则代表没有参数。

Link copied to clipboard
abstract override val method: HttpMethod

此api请求方式

Link copied to clipboard

得到响应值的反序列化器.

Link copied to clipboard
abstract override val url: Url

最终用于请求的目标地址。 默认会使用 QQGuild.URL 作为其域名地址。

Inherited properties

Link copied to clipboard
open val headers: Headers

Inherited functions

Link copied to clipboard
suspend fun <R : Any> QQGuildApi<R>.request(client: HttpClient, token: String? = null, server: Url? = null, appId: String? = null): HttpResponse

使用 client 向当前目标 API QQGuildApi 发起请求。

Link copied to clipboard
fun QQGuildApi<*>.requestAsync(client: HttpClient, token: String, server: Url = QQGuild.URL, scope: CoroutineScope? = null, appId: String? = null): CompletableFuture<HttpResponse>
Link copied to clipboard
fun QQGuildApi<*>.requestBlocking(client: HttpClient, token: String?, server: Url = QQGuild.URL, appId: String? = null): HttpResponse
Link copied to clipboard
suspend fun <R : Any> QQGuildApi<R>.requestData(client: HttpClient, token: String?, server: Url? = QQGuild.URL, decoder: Json = QQGuild.DefaultJson, appId: String? = null): R

使用此api发起一次请求,并得到预期中的结果。

Link copied to clipboard
fun <R : Any> QQGuildApi<R>.requestDataAsync(client: HttpClient, token: String, server: Url = QQGuild.URL, scope: CoroutineScope? = null, appId: String? = null): CompletableFuture<R>
Link copied to clipboard
fun <R : Any> QQGuildApi<R>.requestDataBlocking(client: HttpClient, token: String?, server: Url = QQGuild.URL, appId: String? = null): R
Link copied to clipboard
fun <R : Any> QQGuildApi<R>.requestDataReserve(client: HttpClient, token: String, server: Url = QQGuild.URL, scope: CoroutineScope? = null, appId: String? = null): SuspendReserve<R>
Link copied to clipboard
fun QQGuildApi<*>.requestReserve(client: HttpClient, token: String, server: Url = QQGuild.URL, scope: CoroutineScope? = null, appId: String? = null): SuspendReserve<HttpResponse>
Link copied to clipboard
inline suspend fun <R : Any> QQGuildApi<R>.requestText(client: HttpClient, token: String?, server: Url? = QQGuild.URL, appId: String? = null, useResp: (HttpResponse) -> Unit = {}): String

通过 request 得到响应,读取为文本并输出debug日志后返回。 不会进行校验。

Link copied to clipboard
fun QQGuildApi<*>.requestTextAsync(client: HttpClient, token: String, server: Url = QQGuild.URL, scope: CoroutineScope? = null, appId: String? = null): CompletableFuture<String>
Link copied to clipboard
fun QQGuildApi<*>.requestTextBlocking(client: HttpClient, token: String?, server: Url = QQGuild.URL, appId: String? = null): String
Link copied to clipboard
fun QQGuildApi<*>.requestTextReserve(client: HttpClient, token: String, server: Url = QQGuild.URL, scope: CoroutineScope? = null, appId: String? = null): SuspendReserve<String>