_protocols.py 886 B

12345678910111213141516171819202122
  1. from typing import Any, Protocol, runtime_checkable
  2. from .types import DayInfo, Reservation
  3. @runtime_checkable
  4. class ServiceClient(Protocol):
  5. async def get_calendar(self, date_from: str, date_to: str) -> dict[str, DayInfo]: ...
  6. async def get_reservations(self, date_from: str, date_to: str) -> list[Reservation]: ...
  7. async def set_price(self, d: str, price: int) -> None: ...
  8. async def set_availability(self, d: str, available: bool) -> None: ...
  9. async def probe(self) -> None:
  10. """Liveness check used by the health monitor. Raises ServiceAuthError on failure."""
  11. ...
  12. @runtime_checkable
  13. class ChatClient(ServiceClient, Protocol):
  14. # chat_id maps to each platform's native thread/conversation identifier
  15. async def get_thread(self, chat_id: str) -> Any: ...
  16. async def send_message(self, chat_id: str, body: str) -> None: ...
  17. def send_ready(self) -> bool: ...