Skip to main content

PlatformSender

Trait PlatformSender 

Source
pub trait PlatformSender: Send + Sync {
    // Required methods
    fn send<'life0, 'life1, 'life2, 'async_trait>(
        &'life0 self,
        chat_id: &'life1 str,
        text: &'life2 str,
    ) -> Pin<Box<dyn Future<Output = Result<SendResult>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait;
    fn edit<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        chat_id: &'life1 str,
        msg_id: &'life2 str,
        text: &'life3 str,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn upload_file<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        chat_id: &'life1 str,
        file_path: &'life2 str,
        media_type: &'life3 str,
    ) -> Pin<Box<dyn Future<Output = Result<UploadResult>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait;
    fn send_media_message<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>(
        &'life0 self,
        chat_id: &'life1 str,
        file_url: &'life2 str,
        file_name: &'life3 str,
        media_type: &'life4 str,
    ) -> Pin<Box<dyn Future<Output = Result<SendResult>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait,
             'life4: 'async_trait;
    fn capabilities(&self) -> PlatformCaps;
}
Expand description

Abstracted message sending capability (platform-agnostic).

ChatbotFrontend talks to the platform through this trait rather than PlatformAdapter directly, so the manager can supply a bridge that wraps the concrete adapter.

Required Methods§

Source

fn send<'life0, 'life1, 'life2, 'async_trait>( &'life0 self, chat_id: &'life1 str, text: &'life2 str, ) -> Pin<Box<dyn Future<Output = Result<SendResult>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait,

Send a text message to a chat; returns the platform message ID.

Source

fn edit<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, chat_id: &'life1 str, msg_id: &'life2 str, text: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Edit a previously-sent message in place.

Source

fn upload_file<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, chat_id: &'life1 str, file_path: &'life2 str, media_type: &'life3 str, ) -> Pin<Box<dyn Future<Output = Result<UploadResult>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

Upload a file to the platform. Returns the platform file URL/ID.

Source

fn send_media_message<'life0, 'life1, 'life2, 'life3, 'life4, 'async_trait>( &'life0 self, chat_id: &'life1 str, file_url: &'life2 str, file_name: &'life3 str, media_type: &'life4 str, ) -> Pin<Box<dyn Future<Output = Result<SendResult>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait, 'life4: 'async_trait,

Send a media message (image/file) to a chat.

Source

fn capabilities(&self) -> PlatformCaps

Platform capabilities (drives streaming strategy).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§