feat: endpoint management

This commit is contained in:
Yeuoly
2024-09-26 12:49:00 +08:00
parent 153dc5b3f3
commit ea497f828f
7 changed files with 268 additions and 10 deletions

View File

@ -1,5 +1,6 @@
from collections.abc import Generator
from core.plugin.entities.plugin import PluginEntity
from core.plugin.entities.plugin_daemon import InstallPluginMessage
from core.plugin.manager.base import BasePluginManager
@ -12,6 +13,14 @@ class PluginInstallationManager(BasePluginManager):
"GET", f"plugin/{tenant_id}/fetch/identifier", bool, params={"plugin_unique_identifier": identifier}
)
def list_plugins(self, tenant_id: str) -> list[PluginEntity]:
return self._request_with_plugin_daemon_response(
"GET",
f"plugin/{tenant_id}/management/list",
list[PluginEntity],
params={"page": 1, "page_size": 256},
)
def install_from_pkg(self, tenant_id: str, pkg: bytes) -> Generator[InstallPluginMessage, None, None]:
"""
Install a plugin from a package.