Skip to content

Commit

Permalink
Test for llob get_file
Browse files Browse the repository at this point in the history
  • Loading branch information
ForteScarlet committed Nov 26, 2024
1 parent d6ced13 commit 4d65bf0
Showing 1 changed file with 50 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import kotlinx.serialization.DeserializationStrategy
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import love.forte.simbot.component.onebot.v11.core.api.OneBotApi
import love.forte.simbot.component.onebot.v11.core.api.OneBotApiResult

// LLOneBot GetFile API

class GetFileApi private constructor(
override val body: Any
) : OneBotApi<GetFileResult> {

override val action: String
get() = ACTION

override val resultDeserializer: DeserializationStrategy<GetFileResult>
get() = GetFileResult.serializer()

override val apiResultDeserializer: DeserializationStrategy<OneBotApiResult<GetFileResult>>
get() = RESULT_RES

companion object {
private const val ACTION: String = "get_file"
private val RESULT_RES = OneBotApiResult.serializer(GetFileResult.serializer())

@JvmStatic
fun create(fileId: String): GetFileApi {
return GetFileApi(Body(fileId))
}
}

@Serializable
internal data class Body(
@SerialName("file_id")
internal val fileId: String,
)
}

@Serializable
data class GetFileResult(
/**
* 文件的绝对路径
*/
val file: String,
@SerialName("file_name")
val fileName: String = "",
@SerialName("file_size")
val fileSize: Long = -1L,
val base64: String = "",
)

0 comments on commit 4d65bf0

Please sign in to comment.