blitz_api/app/apps/service.py
fusion44 00e56ba155
feat(#237): implement app_status_advanced endpoint (#238)
Some apps might give status information that is computationally to
expensive to include in the normal status endpoint which can be polled
more often.

closes #237
2024-02-18 12:10:35 +01:00

40 lines
1,013 B
Python

from decouple import config
from app.system.models import APIPlatform
PLATFORM = config("platform", default=APIPlatform.RASPIBLITZ)
apps = None
if PLATFORM == APIPlatform.RASPIBLITZ:
from app.apps.impl.raspiblitz import RaspiBlitzApps as Apps
elif PLATFORM == APIPlatform.NATIVE_PYTHON:
from app.apps.impl.native_python import NativePythonApps as Apps
apps = Apps()
if apps is None:
raise RuntimeError(f"Unknown platform {PLATFORM}")
async def get_app_status_single(app_id: str):
return await apps.get_app_status_single(app_id)
async def get_app_status():
return await apps.get_app_status()
async def get_app_status_advanced(app_id: str):
return await apps.get_app_status_advanced(app_id)
async def get_app_status_sub():
return await apps.get_app_status_sub()
async def install_app_sub(app_id: str):
return await apps.install_app_sub(app_id)
async def uninstall_app_sub(app_id: str, delete_data: bool):
return await apps.uninstall_app_sub(app_id, delete_data)