32 lines
669 B
Python
32 lines
669 B
Python
from abc import ABC, abstractmethod
|
|
from dataclasses import dataclass
|
|
|
|
from infrasynth.shared.results import Result
|
|
|
|
|
|
@dataclass
|
|
class Attachment:
|
|
filename: str
|
|
content: bytes
|
|
mime_type: str
|
|
cid: str | None = None
|
|
inline: bool = False
|
|
|
|
|
|
class BaseChannel(ABC):
|
|
@abstractmethod
|
|
def send(
|
|
self,
|
|
recipient: str,
|
|
subject: str,
|
|
body: str,
|
|
is_html: bool = True,
|
|
attachments: list[Attachment] | None = None,
|
|
) -> Result[bool, str]: ...
|
|
|
|
@abstractmethod
|
|
def health_check(self) -> bool: ...
|
|
|
|
@classmethod
|
|
@abstractmethod
|
|
def from_config(cls, config: dict) -> "BaseChannel": ...
|