File tree Expand file tree Collapse file tree 1 file changed +50
-0
lines changed
simbot-component-onebot-v11/simbot-component-onebot-v11-core/src/jvmTest/kotlin Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Original file line number Diff line number Diff line change 1+ import kotlinx.serialization.DeserializationStrategy
2+ import kotlinx.serialization.SerialName
3+ import kotlinx.serialization.Serializable
4+ import love.forte.simbot.component.onebot.v11.core.api.OneBotApi
5+ import love.forte.simbot.component.onebot.v11.core.api.OneBotApiResult
6+
7+ // LLOneBot GetFile API
8+
9+ class GetFileApi private constructor(
10+ override val body : Any
11+ ) : OneBotApi<GetFileResult> {
12+
13+ override val action: String
14+ get() = ACTION
15+
16+ override val resultDeserializer: DeserializationStrategy <GetFileResult >
17+ get() = GetFileResult .serializer()
18+
19+ override val apiResultDeserializer: DeserializationStrategy <OneBotApiResult <GetFileResult >>
20+ get() = RESULT_RES
21+
22+ companion object {
23+ private const val ACTION : String = " get_file"
24+ private val RESULT_RES = OneBotApiResult .serializer(GetFileResult .serializer())
25+
26+ @JvmStatic
27+ fun create (fileId : String ): GetFileApi {
28+ return GetFileApi (Body (fileId))
29+ }
30+ }
31+
32+ @Serializable
33+ internal data class Body (
34+ @SerialName(" file_id" )
35+ internal val fileId : String ,
36+ )
37+ }
38+
39+ @Serializable
40+ data class GetFileResult (
41+ /* *
42+ * 文件的绝对路径
43+ */
44+ val file : String ,
45+ @SerialName(" file_name" )
46+ val fileName : String = " " ,
47+ @SerialName(" file_size" )
48+ val fileSize : Long = -1L ,
49+ val base64 : String = " " ,
50+ )
You can’t perform that action at this time.
0 commit comments