ciab_core/traits/
channel.rs1use async_trait::async_trait;
2use tokio::sync::mpsc;
3
4use crate::error::CiabResult;
5use crate::types::channel::{ChannelState, InboundMessage};
6
7#[async_trait]
9pub trait ChannelAdapter: Send + Sync {
10 fn provider_name(&self) -> &str;
12
13 async fn start(&self) -> CiabResult<mpsc::Receiver<InboundMessage>>;
15
16 async fn send(&self, recipient_id: &str, content: &str) -> CiabResult<()>;
18
19 fn state(&self) -> ChannelState;
21
22 fn qr_code(&self) -> Option<String> {
24 None
25 }
26
27 async fn shutdown(&self) -> CiabResult<()>;
29}