Jelajahi Sumber

feat(interfaces): add ResponsesPorts

Librellium 1 Minggu lalu
induk
melakukan
616292f7b9
3 mengubah file dengan 28 tambahan dan 0 penghapusan
  1. 4 0
      anonflow/interfaces/__init__.py
  2. 13 0
      anonflow/interfaces/post.py
  3. 11 0
      anonflow/interfaces/user.py

+ 4 - 0
anonflow/interfaces/__init__.py

@@ -0,0 +1,4 @@
+from .post import PostResponsesPort
+from .user import UserResponsesPort
+
+__all__ = ["PostResponsesPort", "UserResponsesPort"]

+ 13 - 0
anonflow/interfaces/post.py

@@ -0,0 +1,13 @@
+from typing import Protocol, Union
+
+from anonflow.services.transport.content import (
+    ContentGroup,
+    ContentItem
+)
+from anonflow.services.transport.types import RequestContext
+
+
+class PostResponsesPort(Protocol):
+    async def post_prepared(self, context: RequestContext, content: Union[ContentItem, ContentGroup], is_approved: bool): ...
+    async def post_moderation_decision(self, context: RequestContext, is_approved: bool, reason: str): ...
+    async def post_moderation_started(self, context: RequestContext): ...

+ 11 - 0
anonflow/interfaces/user.py

@@ -0,0 +1,11 @@
+from typing import Protocol
+
+from anonflow.services.transport.types import RequestContext
+
+
+class UserResponsesPort(Protocol):
+    async def user_banned(self, context: RequestContext): ...
+    async def user_not_registered(self, context: RequestContext): ...
+    async def user_start(self, context: RequestContext): ...
+    async def user_subscription_required(self, context: RequestContext): ...
+    async def user_throttled(self, context: RequestContext, remaining_time: int): ...