blitz_api/app/apps/impl/apps_base.py

37 lines
1.1 KiB
Python
Raw Permalink Normal View History

2022-09-11 10:08:50 +02:00
from abc import abstractmethod
from typing import AsyncGenerator, TypeAlias
2022-09-11 10:08:50 +02:00
from app.api.error_report.report import Report
from app.apps.models import (
AppId,
AppManageTaskMessage,
AppStatus,
AppStatusQueryResult,
AppUninstallInput,
)
from app.external.result_type.src.result import Result
AppManageResult: TypeAlias = AsyncGenerator[Result[AppManageTaskMessage, Report], None]
2022-09-11 10:08:50 +02:00
class AppsBase:
2022-09-11 10:08:50 +02:00
@abstractmethod
async def get_app_status_single(self, app_id: str) -> Result[AppStatus, Report]:
raise NotImplementedError()
2022-09-11 10:08:50 +02:00
@abstractmethod
async def get_app_status(self) -> Result[AppStatusQueryResult, Report]:
raise NotImplementedError()
@abstractmethod
async def get_app_status_advanced(self, app_id: str) -> Result[AppStatus, Report]:
raise NotImplementedError()
2022-09-11 10:08:50 +02:00
@abstractmethod
def install_app(self, app_id: AppId) -> AppManageResult:
raise NotImplementedError()
2022-09-11 10:08:50 +02:00
@abstractmethod
def uninstall_app(self, input: AppUninstallInput) -> AppManageResult:
raise NotImplementedError()