mastoposter-oss_images/mastoposter/integrations/base.py

20 lines
492 B
Python
Raw Normal View History

2022-08-24 08:09:41 +03:00
from abc import ABC, abstractmethod
from configparser import SectionProxy
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):
# TODO: make a registry of integrations
def __init__(self):
2022-08-24 08:09:41 +03:00
pass
@classmethod
def from_section(cls, section: SectionProxy) -> "BaseIntegration":
raise NotImplementedError
2022-08-24 08:09:41 +03:00
@abstractmethod
async def __call__(self, status: Status) -> Optional[str]:
raise NotImplementedError