Skip to main content

ChannelAdapter

Trait ChannelAdapter 

Source
pub trait ChannelAdapter: Send + Sync {
    // Required methods
    fn name(&self) -> &str;
    fn display_name(&self) -> &str;
    fn supports_threads(&self) -> bool;
    fn supports_media(&self) -> bool;
    fn start<'life0, 'async_trait>(
        &'life0 self,
        host: Arc<dyn ChannelAdapterHost>,
        cancel: CancellationToken,
    ) -> Pin<Box<dyn Future<Output = Result<(), PluginError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;
    fn send<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        target: &'life1 str,
        payload: &'life2 MessagePayload,
    ) -> Pin<Box<dyn Future<Output = Result<String, PluginError>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
}
Expand description

A channel adapter for connecting to external messaging platforms.

Replaces the existing Channel trait with a plugin-oriented design that supports MessagePayload variants for text, structured, and binary (voice) content.

Required Methods§

Source

fn name(&self) -> &str

Unique channel identifier (e.g., "telegram", "slack").

Source

fn display_name(&self) -> &str

Human-readable display name.

Source

fn supports_threads(&self) -> bool

Whether this adapter supports threaded conversations.

Source

fn supports_media(&self) -> bool

Whether this adapter supports media/binary payloads.

Source

fn start<'life0, 'async_trait>( &'life0 self, host: Arc<dyn ChannelAdapterHost>, cancel: CancellationToken, ) -> Pin<Box<dyn Future<Output = Result<(), PluginError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Start receiving messages. Long-lived – runs until cancelled.

Source

fn send<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, target: &'life1 str, payload: &'life2 MessagePayload, ) -> Pin<Box<dyn Future<Output = Result<String, PluginError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Send a message payload through this channel.

Returns a message ID on success.

Implementors§