Package-level declarations

Types

Link copied to clipboard
sealed interface BasicOneBotApi<T : Any>

基础性的针对 OneBot API 的定义。

Link copied to clipboard
data class CanSendImageResult @ApiResultConstructor constructor(val yes: Boolean)

CanSendImageApi 的响应体。

Link copied to clipboard
data class CanSendRecordResult @ApiResultConstructor constructor(val yes: Boolean)

CanSendRecordApi 的响应体。

Link copied to clipboard

定制化的 OneBot API。

Link copied to clipboard

一个用于动态构建定制化 OneBot API 的构建器, 可以在不直接实现 BasicOneBotApi 的情况下以 DSL 或链式 API 的形式构建一个 BasicOneBotApi

Link copied to clipboard
Link copied to clipboard

反序列化 OneBotApiResult 结果的函数类型。

Link copied to clipboard

CustomOneBotApi 相关的 API 尚在实验阶段,不保证稳定性,可能会在未来随时发生变更或被移除。

Link copied to clipboard
data class GetCookiesResult @ApiResultConstructor constructor(val cookies: String)

GetCookiesApi 的响应体。

Link copied to clipboard
data class GetCredentialsResult @ApiResultConstructor constructor(val cookies: String, val csrfToken: Int)

GetCredentialsApi 的响应体。

Link copied to clipboard
data class GetCsrfTokenResult @ApiResultConstructor constructor(val token: Int)

GetCsrfTokenApi 的响应体。

Link copied to clipboard
class GetForwardMsgResult @ApiResultConstructor constructor(messageInternal: List<OneBotForwardNode>? = null, messagesInternal: List<OneBotForwardNode>? = null)

GetForwardMsgApi 的响应体。

Link copied to clipboard
data class GetFriendListResult @ApiResultConstructor constructor(val userId: LongID, val nickname: String, val remark: String)

GetFriendListApi 的响应体。

Link copied to clipboard
data class GetGroupHonorInfoResult @ApiResultConstructor constructor(val groupId: LongID, val currentTalkative: GetGroupHonorInfoResult.CurrentTalkative? = null, val talkativeList: List<GetGroupHonorInfoResult.HonorInfo>? = null, val performerList: List<GetGroupHonorInfoResult.HonorInfo>? = null, val legendList: List<GetGroupHonorInfoResult.HonorInfo>? = null, val strongNewbieList: List<GetGroupHonorInfoResult.HonorInfo>? = null, val emotionList: List<GetGroupHonorInfoResult.HonorInfo>? = null)

GetGroupHonorInfoApi 的响应体。

Link copied to clipboard
data class GetGroupInfoResult @ApiResultConstructor constructor(val groupId: LongID, val groupName: String, val memberCount: Int, val maxMemberCount: Int)

GetGroupInfoApi 的响应体。

Link copied to clipboard
data class GetGroupMemberInfoResult @ApiResultConstructor constructor(val groupId: LongID, val userId: LongID, val nickname: String, val card: String = "", val sex: String = "unknown", val age: Int = -1, val area: String = "", val joinTime: Int = -1, val lastSentTime: Int = -1, val level: String = "", val role: String = "member", val unfriendly: Boolean = false, val title: String = "", val titleExpireTime: Int = -1, val cardChangeable: Boolean = false)

GetGroupMemberInfoApi 的响应体。

Link copied to clipboard
data class GetImageResult @ApiResultConstructor constructor(val file: String)

GetImageApi 的响应体。

Link copied to clipboard
data class GetLoginInfoResult @ApiResultConstructor constructor(val userId: LongID, val nickname: String)

GetLoginInfoApi 的响应体。

Link copied to clipboard
Link copied to clipboard
data class GetMsgResult @ApiResultConstructor constructor(val time: Int, val messageType: String, val messageId: IntID, val realId: IntID, val sender: JsonObject, val message: List<OneBotMessageSegment> = emptyList())

GetMsgApi 的响应体。

Link copied to clipboard
data class GetRecordResult @ApiResultConstructor constructor(val file: String)

GetRecordApi 的响应体。

Link copied to clipboard
data class GetStrangerInfoResult @ApiResultConstructor constructor(val userId: LongID, val nickname: String, val sex: String, val age: Int)

GetStrangerInfoApi 的响应体。

Link copied to clipboard
data class GetVersionInfoResult @ApiResultConstructor constructor(val appName: String, val appVersion: String, val protocolVersion: String)

GetVersionInfoApi 的响应体。

Link copied to clipboard
Link copied to clipboard
interface OneBotApi<T : Any> : BasicOneBotApi<T>

针对一个 OneBot API 的定义实现, 在 BasicOneBotApi 的基础上,使用基于 kotlinx-serialization 的反序列化器来实现 deserialize

Link copied to clipboard

与 OneBot 的 Api 相关的异常。

Link copied to clipboard

可以用于执行 BasicOneBotApi 的执行器接口描述。

Link copied to clipboard

OneBotApiExecutable 的基础上提供更多作用域API, 允许在 Kotlin 中使用DSL的风格请求API。

Link copied to clipboard
open class OneBotApiResponseNotSuccessException(val status: HttpStatusCode, message: String? = "status: ", cause: Throwable? = null) : OneBotApiException

OneBotApi 请求的响应结果状态码不是成功状态 (即不是2xx)

Link copied to clipboard
data class OneBotApiResult<T : Any>(val retcode: Int, val status: String? = null, val data: T? = null)
Link copied to clipboard

代表一个用于OneBot API中作为 message 发送的消息内容。 它是一个仅用于序列化的类型。

Link copied to clipboard

OneBotMessageOutgoing 的序列化器实现。 仅保证序列化,反序列化很可能会产生异常,且尽可能避免使用。

Link copied to clipboard
Link copied to clipboard
data class SendMsgResult @ApiResultConstructor constructor(val messageId: IntID)

SendMsgApi 的响应体。

Properties

Link copied to clipboard

用于在对 BasicOneBotApi 发起请求时或得到想用后输出相关日志日志收集器。

Functions

Link copied to clipboard
inline fun <T : Any> CustomOneBotApi(action: String, method: HttpMethod = HttpMethod.Post, block: CustomOneBotApiBuilder<T>.() -> Unit): CustomOneBotApi<T>

CustomOneBotApi DSL builder function.

Link copied to clipboard
inline fun <T> withExecutableScope(executable: OneBotApiExecutable, action: OneBotApiExecutableScope.() -> T): T

OneBotApiExecutableScope 的作用域下执行 action

Inherited functions

Link copied to clipboard

提供一个 OneBotApiResult.data 的类型 T 的序列化器, 来作为 CustomOneBotApiBuilder 的反序列化方案。

Link copied to clipboard
inline suspend fun OneBotApiExecutable.execute(action: String, method: HttpMethod = HttpMethod.Post, body: Any? = null, block: CustomOneBotApiBuilder<*>.() -> Unit = {}): HttpResponse

基于 CustomOneBotApi 直接构建一个 Api 并发起请求。

Link copied to clipboard
inline suspend fun <T : Any> OneBotApiExecutable.executeData(action: String, method: HttpMethod = HttpMethod.Post, body: Any? = null, block: CustomOneBotApiBuilder<T>.() -> Unit): T
inline suspend fun <T : Any> OneBotApiExecutable.executeData(action: String, dataSerializer: KSerializer<T>, method: HttpMethod = HttpMethod.Post, body: Any? = null, block: CustomOneBotApiBuilder<T>.() -> Unit = {}): T

基于 CustomOneBotApi 直接构建一个 Api 并发起请求,得到对应的 OneBotApiResult

Link copied to clipboard
inline suspend fun <T : Any> OneBotApiExecutable.executeResult(action: String, method: HttpMethod = HttpMethod.Post, body: Any? = null, block: CustomOneBotApiBuilder<T>.() -> Unit): OneBotApiResult<T>

基于 CustomOneBotApi 直接构建一个 Api 并发起请求,得到对应的 OneBotApiResult

Link copied to clipboard

OneBotApiExecutableScope 的作用域下执行 action

Link copied to clipboard
suspend fun BasicOneBotApi<*>.request(client: HttpClient, host: Url, accessToken: String? = null, actionSuffixes: Collection<String>? = null): HttpResponse
suspend fun BasicOneBotApi<*>.request(client: HttpClient, host: String, accessToken: String? = null, actionSuffixes: Collection<String>? = null): HttpResponse

this 发起一次请求,并得到相应的 HttpResponse 响应。

Link copied to clipboard
fun BasicOneBotApi<*>.requestAsync(client: HttpClient, host: Url, accessToken: String? = null, actionSuffixes: Collection<String>? = null, scope: CoroutineScope? = null): CompletableFuture<out HttpResponse>
fun BasicOneBotApi<*>.requestAsync(client: HttpClient, host: String, accessToken: String? = null, actionSuffixes: Collection<String>? = null, scope: CoroutineScope? = null): CompletableFuture<out HttpResponse>

异步地请求 BasicOneBotApi.

Link copied to clipboard
fun BasicOneBotApi<*>.requestBlocking(client: HttpClient, host: Url, accessToken: String? = null, actionSuffixes: Collection<String>? = null): HttpResponse
fun BasicOneBotApi<*>.requestBlocking(client: HttpClient, host: String, accessToken: String? = null, actionSuffixes: Collection<String>? = null): HttpResponse

阻塞地请求 BasicOneBotApi.

Link copied to clipboard
suspend fun <T : Any> BasicOneBotApi<T>.requestData(client: HttpClient, host: Url, accessToken: String? = null, actionSuffixes: Collection<String>? = null, charset: Charset = Charsets.UTF_8, decoder: Json = OneBot11.DefaultJson): T

this 发起一次请求,并得到响应体的 T 类型结果。

suspend fun <T : Any> BasicOneBotApi<T>.requestData(client: HttpClient, host: String, accessToken: String? = null, actionSuffixes: Collection<String>? = null, charset: Charset = Charsets.UTF_8, decoder: Json = OneBot11.DefaultJson): T

this 发起一次请求,并得到响应体的 T 结果。

Link copied to clipboard
fun <T : Any> BasicOneBotApi<T>.requestDataAsync(client: HttpClient, host: Url, accessToken: String? = null, actionSuffixes: Collection<String>? = null, charset: Charset = Charsets.UTF_8, scope: CoroutineScope? = null, decoder: Json = OneBot11.DefaultJson): CompletableFuture<out T>
fun <T : Any> BasicOneBotApi<T>.requestDataAsync(client: HttpClient, host: String, accessToken: String? = null, actionSuffixes: Collection<String>? = null, charset: Charset = Charsets.UTF_8, scope: CoroutineScope? = null, decoder: Json = OneBot11.DefaultJson): CompletableFuture<out T>

异步地请求 BasicOneBotApi.

Link copied to clipboard
fun <T : Any> BasicOneBotApi<T>.requestDataBlocking(client: HttpClient, host: Url, accessToken: String? = null, actionSuffixes: Collection<String>? = null, charset: Charset = Charsets.UTF_8, decoder: Json = OneBot11.DefaultJson): T
fun <T : Any> BasicOneBotApi<T>.requestDataBlocking(client: HttpClient, host: String, accessToken: String? = null, actionSuffixes: Collection<String>? = null, charset: Charset = Charsets.UTF_8, decoder: Json = OneBot11.DefaultJson): T

阻塞地请求 BasicOneBotApi.

Link copied to clipboard
fun <T : Any> BasicOneBotApi<T>.requestDataReserve(client: HttpClient, host: Url, accessToken: String? = null, actionSuffixes: Collection<String>? = null, charset: Charset = Charsets.UTF_8, scope: CoroutineScope? = null, decoder: Json = OneBot11.DefaultJson): SuspendReserve<T>
fun <T : Any> BasicOneBotApi<T>.requestDataReserve(client: HttpClient, host: String, accessToken: String? = null, actionSuffixes: Collection<String>? = null, charset: Charset = Charsets.UTF_8, scope: CoroutineScope? = null, decoder: Json = OneBot11.DefaultJson): SuspendReserve<T>

异步地请求 BasicOneBotApi.

Link copied to clipboard
suspend fun BasicOneBotApi<*>.requestRaw(client: HttpClient, host: Url, accessToken: String? = null, actionSuffixes: Collection<String>? = null, charset: Charset = Charsets.UTF_8): String
suspend fun BasicOneBotApi<*>.requestRaw(client: HttpClient, host: String, accessToken: String? = null, actionSuffixes: Collection<String>? = null, charset: Charset = Charsets.UTF_8): String

this 发起一次请求,并得到响应体的字符串内容。

Link copied to clipboard
fun BasicOneBotApi<*>.requestRawAsync(client: HttpClient, host: Url, accessToken: String? = null, actionSuffixes: Collection<String>? = null, charset: Charset = Charsets.UTF_8, scope: CoroutineScope? = null): CompletableFuture<out String>
fun BasicOneBotApi<*>.requestRawAsync(client: HttpClient, host: String, accessToken: String? = null, actionSuffixes: Collection<String>? = null, charset: Charset = Charsets.UTF_8, scope: CoroutineScope? = null): CompletableFuture<out String>

异步地请求 BasicOneBotApi.

Link copied to clipboard
fun BasicOneBotApi<*>.requestRawBlocking(client: HttpClient, host: Url, accessToken: String? = null, actionSuffixes: Collection<String>? = null, charset: Charset = Charsets.UTF_8): String
fun BasicOneBotApi<*>.requestRawBlocking(client: HttpClient, host: String, accessToken: String? = null, actionSuffixes: Collection<String>? = null, charset: Charset = Charsets.UTF_8): String

阻塞地请求 BasicOneBotApi.

Link copied to clipboard
fun BasicOneBotApi<*>.requestRawReserve(client: HttpClient, host: Url, accessToken: String? = null, actionSuffixes: Collection<String>? = null, charset: Charset = Charsets.UTF_8, scope: CoroutineScope? = null): SuspendReserve<String>
fun BasicOneBotApi<*>.requestRawReserve(client: HttpClient, host: String, accessToken: String? = null, actionSuffixes: Collection<String>? = null, charset: Charset = Charsets.UTF_8, scope: CoroutineScope? = null): SuspendReserve<String>

异步地请求 BasicOneBotApi.

Link copied to clipboard
fun BasicOneBotApi<*>.requestReserve(client: HttpClient, host: Url, accessToken: String? = null, actionSuffixes: Collection<String>? = null, scope: CoroutineScope? = null): SuspendReserve<HttpResponse>
fun BasicOneBotApi<*>.requestReserve(client: HttpClient, host: String, accessToken: String? = null, actionSuffixes: Collection<String>? = null, scope: CoroutineScope? = null): SuspendReserve<HttpResponse>

异步地请求 BasicOneBotApi.

Link copied to clipboard
suspend fun <T : Any> BasicOneBotApi<T>.requestResult(client: HttpClient, host: Url, accessToken: String? = null, actionSuffixes: Collection<String>? = null, charset: Charset = Charsets.UTF_8, decoder: Json = OneBot11.DefaultJson): OneBotApiResult<T>
suspend fun <T : Any> BasicOneBotApi<T>.requestResult(client: HttpClient, host: String, accessToken: String? = null, actionSuffixes: Collection<String>? = null, charset: Charset = Charsets.UTF_8, decoder: Json = OneBot11.DefaultJson): OneBotApiResult<T>

this 发起一次请求,并得到响应体的 OneBotApiResult 结果。

Link copied to clipboard
fun <T : Any> BasicOneBotApi<T>.requestResultAsync(client: HttpClient, host: Url, accessToken: String? = null, actionSuffixes: Collection<String>? = null, charset: Charset = Charsets.UTF_8, scope: CoroutineScope? = null, decoder: Json = OneBot11.DefaultJson): CompletableFuture<out OneBotApiResult<T>>
fun <T : Any> BasicOneBotApi<T>.requestResultAsync(client: HttpClient, host: String, accessToken: String? = null, actionSuffixes: Collection<String>? = null, charset: Charset = Charsets.UTF_8, scope: CoroutineScope? = null, decoder: Json = OneBot11.DefaultJson): CompletableFuture<out OneBotApiResult<T>>

异步地请求 BasicOneBotApi.

Link copied to clipboard
fun <T : Any> BasicOneBotApi<T>.requestResultBlocking(client: HttpClient, host: Url, accessToken: String? = null, actionSuffixes: Collection<String>? = null, charset: Charset = Charsets.UTF_8, decoder: Json = OneBot11.DefaultJson): OneBotApiResult<T>
fun <T : Any> BasicOneBotApi<T>.requestResultBlocking(client: HttpClient, host: String, accessToken: String? = null, actionSuffixes: Collection<String>? = null, charset: Charset = Charsets.UTF_8, decoder: Json = OneBot11.DefaultJson): OneBotApiResult<T>

阻塞地请求 BasicOneBotApi.

Link copied to clipboard
fun <T : Any> BasicOneBotApi<T>.requestResultReserve(client: HttpClient, host: Url, accessToken: String? = null, actionSuffixes: Collection<String>? = null, charset: Charset = Charsets.UTF_8, scope: CoroutineScope? = null, decoder: Json = OneBot11.DefaultJson): SuspendReserve<OneBotApiResult<T>>
fun <T : Any> BasicOneBotApi<T>.requestResultReserve(client: HttpClient, host: String, accessToken: String? = null, actionSuffixes: Collection<String>? = null, charset: Charset = Charsets.UTF_8, scope: CoroutineScope? = null, decoder: Json = OneBot11.DefaultJson): SuspendReserve<OneBotApiResult<T>>

异步地请求 BasicOneBotApi.

Link copied to clipboard