"""Abstract admin server interface."""
from abc import ABC, abstractmethod
from typing import Sequence
[docs]class BaseAdminServer(ABC):
"""Admin HTTP server class."""
[docs] @abstractmethod
async def start(self) -> None:
"""
Start the webserver.
Raises:
AdminSetupError: If there was an error starting the webserver
"""
[docs] @abstractmethod
async def stop(self) -> None:
"""Stop the webserver."""
[docs] @abstractmethod
def add_webhook_target(
self,
target_url: str,
topic_filter: Sequence[str] = None,
max_attempts: int = None,
):
"""Add a webhook target."""
[docs] @abstractmethod
def remove_webhook_target(self, target_url: str):
"""Remove a webhook target."""
[docs] @abstractmethod
async def send_webhook(self, topic: str, payload: dict):
"""Add a webhook to the queue, to send to all registered targets."""