From f89c2d1006de82d27900bc59996559a0db63b094 Mon Sep 17 00:00:00 2001 From: "jiahua.liu" Date: Mon, 30 Mar 2020 19:05:33 +0800 Subject: [PATCH] Plugin Center --- .../mirai/console/center/CuiPluginCenter.kt | 12 +++++ .../mirai/console/center/PluginCenter.kt | 49 +++++++++++++++++++ 2 files changed, 61 insertions(+) create mode 100644 mirai-console/src/main/kotlin/net/mamoe/mirai/console/center/CuiPluginCenter.kt create mode 100644 mirai-console/src/main/kotlin/net/mamoe/mirai/console/center/PluginCenter.kt diff --git a/mirai-console/src/main/kotlin/net/mamoe/mirai/console/center/CuiPluginCenter.kt b/mirai-console/src/main/kotlin/net/mamoe/mirai/console/center/CuiPluginCenter.kt new file mode 100644 index 000000000..73198157a --- /dev/null +++ b/mirai-console/src/main/kotlin/net/mamoe/mirai/console/center/CuiPluginCenter.kt @@ -0,0 +1,12 @@ +package net.mamoe.mirai.console.center + +object CuiPluginCenter: PluginCenter{ + override suspend fun fetchPlugin(page: Int): Map { + TODO("Not yet implemented") + } + + override suspend fun findPlugin(name: String): PluginCenter.PluginInfo? { + TODO("Not yet implemented") + } + +} \ No newline at end of file diff --git a/mirai-console/src/main/kotlin/net/mamoe/mirai/console/center/PluginCenter.kt b/mirai-console/src/main/kotlin/net/mamoe/mirai/console/center/PluginCenter.kt new file mode 100644 index 000000000..5da74fd9d --- /dev/null +++ b/mirai-console/src/main/kotlin/net/mamoe/mirai/console/center/PluginCenter.kt @@ -0,0 +1,49 @@ +package net.mamoe.mirai.console.center + +interface PluginCenter { + + companion object{ + val Default:PluginCenter = CuiPluginCenter + } + + data class PluginInsight( + val name:String, + val version:String, + val coreVersion:String, + val consoleVersion:String, + val author:String, + val description: String, + val tags:List, + val commands:List, + ) + + data class PluginInfo( + val name:String, + val version:String, + val coreVersion:String, + val consoleVersion:String, + val tags:List, + val author:String, + val contact:String, + val description: String, + val usage:String, + val vcs:String, + val commands:String, + val changeLog:List + ) + + /** + * 获取一些中心的插件基本信息, + * 能获取到多少由实际的PluginCenter决定 + * 返回 插件名->Insight + */ + suspend fun fetchPlugin(page: Int) :Map + + /** + * 尝试获取到某个插件by全名, case sensitive + * null则没有 + */ + suspend fun findPlugin(name:String):PluginInfo? + +} +