This commit is contained in:
:NoBody: committed 2026-03-21 23:32:01 +08:00
1 parent bc32432808
commit 12bedd5de7
11 files changed
+303 -4

No files matched your search

+34
View File
@@ -1 +1,35 @@
use anyhow::Result;
use async_trait::async_trait;
#[async_trait]
pub trait Sender {
async fn send(&self, message: OutboundMessage) -> Result<String>;
}
#[async_trait]
pub trait Receiver {
// Pull user inputs from upstream and return a cursor for incremental sync.
async fn poll_inputs(&self, cursor: Option<&str>, limit: usize) -> Result<InputBatch>;
}
#[derive(Debug, Clone)]
pub struct OutboundMessage {
pub channel_id: String,
pub text: String,
pub reply_to_event_id: Option<String>,
}
#[derive(Debug, Clone)]
pub struct InboundMessage {
pub event_id: String,
pub channel_id: String,
pub user_id: String,
pub text: String,
pub timestamp_ms: u64,
}
#[derive(Debug, Clone, Default)]
pub struct InputBatch {
pub messages: Vec<InboundMessage>,
pub next_cursor: Option<String>,
}