2024-09-20 13:55:09 +08:00
|
|
|
from core.plugin.manager.base import BasePluginManager
|
|
|
|
|
|
|
|
|
|
|
|
class PluginAssetManager(BasePluginManager):
|
2024-09-29 00:13:53 +08:00
|
|
|
def fetch_asset(self, tenant_id: str, id: str) -> bytes:
|
2024-09-20 14:43:01 +08:00
|
|
|
"""
|
|
|
|
Fetch an asset by id.
|
|
|
|
"""
|
2024-09-29 00:13:53 +08:00
|
|
|
response = self._request(method="GET", path=f"plugin/{tenant_id}/assets/{id}")
|
2024-09-20 14:43:01 +08:00
|
|
|
if response.status_code != 200:
|
|
|
|
raise ValueError(f"can not found asset {id}")
|
|
|
|
return response.content
|