2022-08-24 08:09:41 +03:00
|
|
|
from abc import ABC, abstractmethod
|
2022-08-27 14:27:42 +03:00
|
|
|
from configparser import SectionProxy
|
2022-08-26 18:37:36 +03:00
|
|
|
from typing import Optional
|
2022-08-24 08:09:41 +03:00
|
|
|
|
2022-08-24 08:28:18 +03:00
|
|
|
from mastoposter.types import Status
|
2022-08-24 08:09:41 +03:00
|
|
|
|
|
|
|
|
|
|
|
class BaseIntegration(ABC):
|
2022-11-01 12:55:23 +03:00
|
|
|
# TODO: make a registry of integrations
|
|
|
|
def __init__(self):
|
2022-08-24 08:09:41 +03:00
|
|
|
pass
|
|
|
|
|
2022-11-01 12:55:23 +03:00
|
|
|
@classmethod
|
|
|
|
def from_section(cls, section: SectionProxy) -> "BaseIntegration":
|
|
|
|
raise NotImplementedError
|
|
|
|
|
2022-08-24 08:09:41 +03:00
|
|
|
@abstractmethod
|
2022-08-29 10:28:51 +03:00
|
|
|
async def __call__(self, status: Status) -> Optional[str]:
|
2022-08-27 14:27:42 +03:00
|
|
|
raise NotImplementedError
|