mirror of
https://github.com/fusion44/blitz_api.git
synced 2026-08-14 12:02:46 +02:00
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
40 lines
1,013 B
Python
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)
|