57 lines
No EOL
1.7 KiB
Python
57 lines
No EOL
1.7 KiB
Python
from abc import ABC, abstractmethod
|
|
from typing import List, Optional
|
|
from fediverse_types import FediverseNotification, FediversePost, Visibility
|
|
|
|
|
|
class FediverseService(ABC):
|
|
"""Abstract interface for Fediverse platform services (Misskey, Pleroma, etc.)"""
|
|
|
|
@abstractmethod
|
|
def get_notifications(self, since_id: Optional[str] = None) -> List[FediverseNotification]:
|
|
"""
|
|
Retrieve notifications from the Fediverse instance.
|
|
|
|
Args:
|
|
since_id: Optional ID to get notifications newer than this ID
|
|
|
|
Returns:
|
|
List of FediverseNotification objects
|
|
"""
|
|
pass
|
|
|
|
@abstractmethod
|
|
def create_post(
|
|
self,
|
|
text: str,
|
|
reply_to_id: Optional[str] = None,
|
|
visibility: Visibility = Visibility.HOME,
|
|
file_ids: Optional[List[str]] = None,
|
|
visible_user_ids: Optional[List[str]] = None
|
|
) -> str:
|
|
"""
|
|
Create a new post on the Fediverse instance.
|
|
|
|
Args:
|
|
text: The text content of the post
|
|
reply_to_id: Optional ID of post to reply to
|
|
visibility: Visibility level for the post
|
|
file_ids: Optional list of file IDs to attach
|
|
visible_user_ids: Optional list of user IDs who can see the post (for specified visibility)
|
|
|
|
Returns:
|
|
ID of the created post
|
|
"""
|
|
pass
|
|
|
|
@abstractmethod
|
|
def get_post_by_id(self, post_id: str) -> Optional[FediversePost]:
|
|
"""
|
|
Retrieve a specific post by its ID.
|
|
|
|
Args:
|
|
post_id: The ID of the post to retrieve
|
|
|
|
Returns:
|
|
FediversePost object if found, None otherwise
|
|
"""
|
|
pass |