_protocols.py 756 B

12345678910111213141516171819
  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. @runtime_checkable
  10. class ChatClient(ServiceClient, Protocol):
  11. # chat_id maps to each platform's native thread/conversation identifier
  12. async def get_thread(self, chat_id: str) -> Any: ...
  13. async def send_message(self, chat_id: str, body: str) -> None: ...
  14. def send_ready(self) -> bool: ...