feat(client): add mci-server event poster

This commit is contained in:
2026-07-10 12:06:21 +08:00
parent 41cb52daa1
commit 96ec929378

View File

@@ -0,0 +1,19 @@
from __future__ import annotations
import httpx
from app.models.event import OutboundEvent
class MciServerClient:
def __init__(self, base_url: str, timeout: float = 10.0):
self.base_url = base_url.rstrip("/")
self.timeout = timeout
async def post_event(self, event: OutboundEvent) -> None:
async with httpx.AsyncClient(timeout=self.timeout) as client:
response = await client.post(
f"{self.base_url}/api/v1/channel-account/event",
json=event.to_payload(),
)
response.raise_for_status()