ForcePilot/backend/package/yuxi/channels/protocols/messaging.py

30 lines
923 B
Python
Raw Normal View History

from __future__ import annotations
from collections.abc import AsyncIterator
from typing import Any, Protocol, runtime_checkable
from yuxi.channels.models import ChannelMessage
@runtime_checkable
class ChannelMessagingProtocol(Protocol):
async def receive(self) -> AsyncIterator[ChannelMessage]: ...
async def download_media(self, file_id: str) -> bytes: ...
async def get_user_info(self, channel_user_id: str) -> dict: ...
def normalize_target(self, raw: Any) -> str: ...
def resolve_inbound_conversation(self, from_: str, to: str, thread_id: str) -> dict: ...
def resolve_delivery_target(self, conversation_id: str) -> dict: ...
def infer_target_chat_type(self, to: str) -> str: ...
def parse_explicit_target(self, raw: str) -> dict: ...
def transform_reply_payload(self, payload: dict) -> dict: ...
def resolve_outbound_session_route(self, target: dict) -> dict: ...