23 lines
466 B
Python
23 lines
466 B
Python
from __future__ import annotations
|
|
|
|
from abc import ABC, abstractmethod
|
|
from collections.abc import Sequence
|
|
from dataclasses import dataclass
|
|
|
|
|
|
@dataclass(frozen=True)
|
|
class Message:
|
|
title: str
|
|
body: str
|
|
link: str | None
|
|
urgent: bool
|
|
|
|
|
|
class NotifierError(Exception):
|
|
pass
|
|
|
|
|
|
class Notifier(ABC):
|
|
@abstractmethod
|
|
def send(self, messages: Sequence[Message]) -> None:
|
|
"""Deliver messages. Raise NotifierError if delivery failed."""
|