Skip to main content

BeeperClient

Struct BeeperClient 

Source
pub struct BeeperClient { /* private fields */ }
Expand description

Main Beeper API client

Stores the bearer token and base URL for API requests. All requests to the API will include the token in the Authorization header.

Implementationsยง

Sourceยง

impl BeeperClient

Source

pub async fn list_chats( &self, cursor: Option<&str>, direction: Option<&str>, ) -> Result<ListChatsOutput>

Lists all chats sorted by last activity

Combines all accounts into a single paginated list.

Examples found in repository?
examples/fetch_chats.rs (line 26)
5async fn main() -> Result<(), Box<dyn std::error::Error>> {
6    // Get authentication token from environment variable
7    let token = env::var("BEEPER_TOKEN")
8        .unwrap_or_else(|_| {
9            eprintln!("Error: BEEPER_TOKEN environment variable not set");
10            eprintln!("Usage: BEEPER_TOKEN=your_token cargo run --example fetch_chats");
11            std::process::exit(1);
12        });
13
14    // Get API base URL from environment variable or use default
15    let base_url = env::var("BEEPER_API_URL")
16        .unwrap_or_else(|_| "http://localhost:23373".to_string());
17
18    println!("Connecting to Beeper Desktop API at: {}", base_url);
19    println!();
20
21    // Create a client with the provided token
22    let client = BeeperClient::new(&token, &base_url);
23
24    // Fetch all chats
25    println!("๐Ÿ“‹ Fetching chats from Beeper...");
26    let chats_response = client.list_chats(None, None).await?;
27
28    // Extract chat names into a vector using the display_name method
29    let chat_names: Vec<String> = chats_response
30        .items
31        .iter()
32        .map(|chat| chat.display_name())
33        .collect();
34
35    // Display results
36    println!("โœ… Successfully retrieved {} chats:", chat_names.len());
37    println!();
38
39    if chat_names.is_empty() {
40        println!("No chats found.");
41    } else {
42        for (index, name) in chat_names.iter().enumerate() {
43            println!("  {}. {}", index + 1, name);
44        }
45    }
46
47    println!();
48    println!("Chat names as array:");
49    println!("{:#?}", chat_names);
50
51    Ok(())
52}
More examples
Hide additional examples
examples/send_message.rs (line 26)
5async fn main() -> Result<(), Box<dyn std::error::Error>> {
6    // Get authentication token from environment variable
7    let token = env::var("BEEPER_TOKEN")
8        .unwrap_or_else(|_| {
9            eprintln!("Error: BEEPER_TOKEN environment variable not set");
10            eprintln!("Usage: BEEPER_TOKEN=your_token cargo run --example send_message");
11            std::process::exit(1);
12        });
13
14    // Get API base URL from environment variable or use default
15    let base_url = env::var("BEEPER_API_URL")
16        .unwrap_or_else(|_| "http://localhost:23373".to_string());
17
18    println!("Connecting to Beeper Desktop API at: {}", base_url);
19    println!();
20
21    // Create a client with the provided token
22    let client = BeeperClient::new(&token, &base_url);
23
24    // Fetch all chats to find the first non-group chat
25    println!("๐Ÿ“‹ Fetching chats...");
26    let chats_response = client.list_chats(None, None).await?;
27
28    if chats_response.items.is_empty() {
29        println!("โŒ No chats found!");
30        return Ok(());
31    }
32
33    // Find the first single (non-group) chat
34    let single_chat = chats_response
35        .items
36        .iter()
37        .find(|chat| chat.chat_type == "single");
38
39    if let Some(chat) = single_chat {
40        let chat_id = &chat.id;
41        let chat_title = &chat.title;
42
43        println!("โœ… Found {} chats", chats_response.items.len());
44        println!();
45        println!("๐Ÿ’ฌ Sending message to first single chat: '{}'", chat_title);
46        println!("   Chat ID: {}", chat_id);
47        println!();
48
49        // Create the message input
50        let message_input = SendMessageInput {
51            text: "Hello".to_string(),
52            reply_to_id: None,
53        };
54
55        // Send the message
56        let response = client.send_message(chat_id, message_input).await?;
57
58        println!("โœ… Message sent successfully!");
59        println!();
60        println!("Message Details:");
61        println!("  Chat ID: {}", response.chat_id);
62        println!("  Pending Message ID: {}", response.pending_message_id);
63        println!();
64        println!("Full response (JSON):");
65        println!("{:#?}", response);
66    } else {
67        println!("โŒ No single (non-group) chats found!");
68        println!();
69        println!("Available chats:");
70        for (index, chat) in chats_response.items.iter().enumerate() {
71            println!("  {}. {} ({})", index + 1, chat.title, chat.chat_type);
72        }
73    }
74
75    Ok(())
76}
examples/fetch_messages.rs (line 26)
5async fn main() -> Result<(), Box<dyn std::error::Error>> {
6    // Get authentication token from environment variable
7    let token = env::var("BEEPER_TOKEN")
8        .unwrap_or_else(|_| {
9            eprintln!("Error: BEEPER_TOKEN environment variable not set");
10            eprintln!("Usage: BEEPER_TOKEN=your_token cargo run --example fetch_messages");
11            std::process::exit(1);
12        });
13
14    // Get API base URL from environment variable or use default
15    let base_url = env::var("BEEPER_API_URL")
16        .unwrap_or_else(|_| "http://localhost:23373".to_string());
17
18    println!("Connecting to Beeper Desktop API at: {}", base_url);
19    println!();
20
21    // Create a client with the provided token
22    let client = BeeperClient::new(&token, &base_url);
23
24    // Fetch all chats to find the first one
25    println!("๐Ÿ“‹ Fetching chats...");
26    let chats_response = client.list_chats(None, None).await?;
27
28    if chats_response.items.is_empty() {
29        println!("โŒ No chats found!");
30        return Ok(());
31    }
32
33    // Get the first chat
34    let first_chat = &chats_response.items[0];
35    let chat_id = &first_chat.id;
36    let chat_title = &first_chat.title;
37
38    println!("โœ… Found {} chats", chats_response.items.len());
39    println!();
40    println!("๐Ÿ“ฌ Fetching messages from first chat: '{}'", chat_title);
41    println!("   Chat ID: {}", chat_id);
42    println!();
43
44    // Fetch messages from the first chat
45    let messages_response = client.list_messages(chat_id, None, None).await?;
46
47    println!("โœ… Successfully retrieved {} messages:", messages_response.items.len());
48    println!();
49
50    if messages_response.items.is_empty() {
51        println!("No messages found in this chat.");
52    } else {
53        // Display messages with formatting
54        for (index, message) in messages_response.items.iter().enumerate() {
55            let sender = message.sender_name.as_deref().unwrap_or("Unknown");
56            let text = message.text.as_deref().unwrap_or("[No text content]");
57            let timestamp = &message.timestamp;
58
59            // Show attachments count if any
60            let attachment_info = if let Some(attachments) = &message.attachments {
61                format!(" [+{} attachment(s)]", attachments.len())
62            } else {
63                String::new()
64            };
65
66            // Show reactions count if any
67            let reaction_info = if let Some(reactions) = &message.reactions {
68                format!(" [+{} reaction(s)]", reactions.len())
69            } else {
70                String::new()
71            };
72
73            // Show reply indicator if replying to another message
74            let reply_info = if message.reply_to_id.is_some() {
75                " [โ†ฉ๏ธ Reply]".to_string()
76            } else {
77                String::new()
78            };
79
80            println!("  {}. [{}] {}: {}{}{}{}", 
81                index + 1, 
82                timestamp, 
83                sender, 
84                text,
85                attachment_info,
86                reaction_info,
87                reply_info
88            );
89        }
90    }
91
92    println!();
93    println!("Message details (JSON):");
94    println!("{:#?}", messages_response.items);
95
96    // Show pagination info if available
97    if messages_response.has_more {
98        println!();
99        println!("โ„น๏ธ  More messages available. Use pagination to fetch older/newer messages.");
100    }
101
102    Ok(())
103}
Source

pub async fn get_chat(&self, chat_id: &str) -> Result<Chat>

Retrieves details for a specific chat

Returns chat metadata, participants, and latest message

Source

pub async fn create_chat( &self, input: CreateChatInput, ) -> Result<CreateChatOutput>

Creates a new chat

Creates a single or group chat on a specific account using participant IDs

Source

pub async fn archive_chat(&self, chat_id: &str, archived: bool) -> Result<Chat>

Archives or unarchives a chat

Source

pub async fn set_chat_reminder( &self, chat_id: &str, timestamp: &str, ) -> Result<Chat>

Sets a reminder for a chat

Source

pub async fn clear_chat_reminder(&self, chat_id: &str) -> Result<Chat>

Clears a reminder from a chat

Sourceยง

impl BeeperClient

Source

pub async fn list_messages( &self, chat_id: &str, cursor: Option<&str>, direction: Option<&str>, ) -> Result<ListMessagesOutput>

Lists all messages in a chat

Paginated message list sorted by timestamp.

Examples found in repository?
examples/fetch_messages.rs (line 45)
5async fn main() -> Result<(), Box<dyn std::error::Error>> {
6    // Get authentication token from environment variable
7    let token = env::var("BEEPER_TOKEN")
8        .unwrap_or_else(|_| {
9            eprintln!("Error: BEEPER_TOKEN environment variable not set");
10            eprintln!("Usage: BEEPER_TOKEN=your_token cargo run --example fetch_messages");
11            std::process::exit(1);
12        });
13
14    // Get API base URL from environment variable or use default
15    let base_url = env::var("BEEPER_API_URL")
16        .unwrap_or_else(|_| "http://localhost:23373".to_string());
17
18    println!("Connecting to Beeper Desktop API at: {}", base_url);
19    println!();
20
21    // Create a client with the provided token
22    let client = BeeperClient::new(&token, &base_url);
23
24    // Fetch all chats to find the first one
25    println!("๐Ÿ“‹ Fetching chats...");
26    let chats_response = client.list_chats(None, None).await?;
27
28    if chats_response.items.is_empty() {
29        println!("โŒ No chats found!");
30        return Ok(());
31    }
32
33    // Get the first chat
34    let first_chat = &chats_response.items[0];
35    let chat_id = &first_chat.id;
36    let chat_title = &first_chat.title;
37
38    println!("โœ… Found {} chats", chats_response.items.len());
39    println!();
40    println!("๐Ÿ“ฌ Fetching messages from first chat: '{}'", chat_title);
41    println!("   Chat ID: {}", chat_id);
42    println!();
43
44    // Fetch messages from the first chat
45    let messages_response = client.list_messages(chat_id, None, None).await?;
46
47    println!("โœ… Successfully retrieved {} messages:", messages_response.items.len());
48    println!();
49
50    if messages_response.items.is_empty() {
51        println!("No messages found in this chat.");
52    } else {
53        // Display messages with formatting
54        for (index, message) in messages_response.items.iter().enumerate() {
55            let sender = message.sender_name.as_deref().unwrap_or("Unknown");
56            let text = message.text.as_deref().unwrap_or("[No text content]");
57            let timestamp = &message.timestamp;
58
59            // Show attachments count if any
60            let attachment_info = if let Some(attachments) = &message.attachments {
61                format!(" [+{} attachment(s)]", attachments.len())
62            } else {
63                String::new()
64            };
65
66            // Show reactions count if any
67            let reaction_info = if let Some(reactions) = &message.reactions {
68                format!(" [+{} reaction(s)]", reactions.len())
69            } else {
70                String::new()
71            };
72
73            // Show reply indicator if replying to another message
74            let reply_info = if message.reply_to_id.is_some() {
75                " [โ†ฉ๏ธ Reply]".to_string()
76            } else {
77                String::new()
78            };
79
80            println!("  {}. [{}] {}: {}{}{}{}", 
81                index + 1, 
82                timestamp, 
83                sender, 
84                text,
85                attachment_info,
86                reaction_info,
87                reply_info
88            );
89        }
90    }
91
92    println!();
93    println!("Message details (JSON):");
94    println!("{:#?}", messages_response.items);
95
96    // Show pagination info if available
97    if messages_response.has_more {
98        println!();
99        println!("โ„น๏ธ  More messages available. Use pagination to fetch older/newer messages.");
100    }
101
102    Ok(())
103}
Source

pub async fn send_message( &self, chat_id: &str, input: SendMessageInput, ) -> Result<SendMessageOutput>

Sends a message to a chat

Sends a text message to a specific chat. Supports replying to existing messages. Returns the sent message ID.

Examples found in repository?
examples/send_message.rs (line 56)
5async fn main() -> Result<(), Box<dyn std::error::Error>> {
6    // Get authentication token from environment variable
7    let token = env::var("BEEPER_TOKEN")
8        .unwrap_or_else(|_| {
9            eprintln!("Error: BEEPER_TOKEN environment variable not set");
10            eprintln!("Usage: BEEPER_TOKEN=your_token cargo run --example send_message");
11            std::process::exit(1);
12        });
13
14    // Get API base URL from environment variable or use default
15    let base_url = env::var("BEEPER_API_URL")
16        .unwrap_or_else(|_| "http://localhost:23373".to_string());
17
18    println!("Connecting to Beeper Desktop API at: {}", base_url);
19    println!();
20
21    // Create a client with the provided token
22    let client = BeeperClient::new(&token, &base_url);
23
24    // Fetch all chats to find the first non-group chat
25    println!("๐Ÿ“‹ Fetching chats...");
26    let chats_response = client.list_chats(None, None).await?;
27
28    if chats_response.items.is_empty() {
29        println!("โŒ No chats found!");
30        return Ok(());
31    }
32
33    // Find the first single (non-group) chat
34    let single_chat = chats_response
35        .items
36        .iter()
37        .find(|chat| chat.chat_type == "single");
38
39    if let Some(chat) = single_chat {
40        let chat_id = &chat.id;
41        let chat_title = &chat.title;
42
43        println!("โœ… Found {} chats", chats_response.items.len());
44        println!();
45        println!("๐Ÿ’ฌ Sending message to first single chat: '{}'", chat_title);
46        println!("   Chat ID: {}", chat_id);
47        println!();
48
49        // Create the message input
50        let message_input = SendMessageInput {
51            text: "Hello".to_string(),
52            reply_to_id: None,
53        };
54
55        // Send the message
56        let response = client.send_message(chat_id, message_input).await?;
57
58        println!("โœ… Message sent successfully!");
59        println!();
60        println!("Message Details:");
61        println!("  Chat ID: {}", response.chat_id);
62        println!("  Pending Message ID: {}", response.pending_message_id);
63        println!();
64        println!("Full response (JSON):");
65        println!("{:#?}", response);
66    } else {
67        println!("โŒ No single (non-group) chats found!");
68        println!();
69        println!("Available chats:");
70        for (index, chat) in chats_response.items.iter().enumerate() {
71            println!("  {}. {} ({})", index + 1, chat.title, chat.chat_type);
72        }
73    }
74
75    Ok(())
76}
Sourceยง

impl BeeperClient

Source

pub async fn get_accounts(&self) -> Result<GetAccountsOutput>

Lists all connected messaging accounts

Lists chat accounts across networks (WhatsApp, Telegram, Twitter/X, etc.) actively connected to this Beeper Desktop instance

Examples found in repository?
examples/fetch_accounts.rs (line 26)
5async fn main() -> Result<(), Box<dyn std::error::Error>> {
6    // Get authentication token from environment variable
7    let token = env::var("BEEPER_TOKEN")
8        .unwrap_or_else(|_| {
9            eprintln!("Error: BEEPER_TOKEN environment variable not set");
10            eprintln!("Usage: BEEPER_TOKEN=your_token cargo run --example fetch_accounts");
11            std::process::exit(1);
12        });
13
14    // Get API base URL from environment variable or use default
15    let base_url = env::var("BEEPER_API_URL")
16        .unwrap_or_else(|_| "http://localhost:23373".to_string());
17
18    println!("Connecting to Beeper Desktop API at: {}", base_url);
19    println!();
20
21    // Create a client with the provided token
22    let client = BeeperClient::new(&token, &base_url);
23
24    // Fetch all accounts
25    println!("๐Ÿ‘ค Fetching connected accounts...");
26    let accounts = client.get_accounts().await?;
27
28    println!("โœ… Successfully retrieved {} account(s):", accounts.len());
29    println!();
30
31    if accounts.is_empty() {
32        println!("No accounts connected.");
33    } else {
34        // Display accounts with formatting
35        for (index, account) in accounts.iter().enumerate() {
36            let account_id = &account.account_id;
37            let network = &account.network;
38            let user = &account.user;
39
40            // Build user identifier
41            let user_identifier = if let Some(full_name) = &user.full_name {
42                full_name.clone()
43            } else if let Some(username) = &user.username {
44                format!("@{}", username)
45            } else if let Some(phone) = &user.phone_number {
46                phone.clone()
47            } else {
48                user.id.clone()
49            };
50
51            println!("  {}. {} Account", index + 1, network);
52            println!("     โ””โ”€ User: {}", user_identifier);
53            println!("     โ””โ”€ Account ID: {}", account_id);
54            println!("     โ””โ”€ User ID: {}", user.id);
55
56            // Show additional user info if available
57            if let Some(username) = &user.username {
58                println!("     โ””โ”€ Username: @{}", username);
59            }
60            if let Some(phone) = &user.phone_number {
61                println!("     โ””โ”€ Phone: {}", phone);
62            }
63            if let Some(email) = &user.email {
64                println!("     โ””โ”€ Email: {}", email);
65            }
66            if let Some(cannot_message) = user.cannot_message {
67                if cannot_message {
68                    println!("     โ””โ”€ โš ๏ธ  Cannot initiate messages to this user");
69                }
70            }
71
72            println!();
73        }
74    }
75
76    println!("Account details (JSON):");
77    println!("{:#?}", accounts);
78
79    Ok(())
80}
Sourceยง

impl BeeperClient

Source

pub async fn search_messages( &self, query: &str, cursor: Option<&str>, direction: Option<&str>, ) -> Result<SearchMessagesOutput>

Searches messages across chats

Uses Beeperโ€™s message index for full-text search.

Examples found in repository?
examples/search.rs (line 54)
5async fn main() -> Result<(), Box<dyn std::error::Error>> {
6    // Get authentication token from environment variable
7    let token = env::var("BEEPER_TOKEN")
8        .unwrap_or_else(|_| {
9            eprintln!("Error: BEEPER_TOKEN environment variable not set");
10            eprintln!("Usage: BEEPER_TOKEN=your_token cargo run --example search");
11            std::process::exit(1);
12        });
13
14    // Get search query from command line arguments or use default
15    let search_query = env::args()
16        .nth(1)
17        .unwrap_or_else(|| "hello".to_string());
18
19    // Get API base URL from environment variable or use default
20    let base_url = env::var("BEEPER_API_URL")
21        .unwrap_or_else(|_| "http://localhost:23373".to_string());
22
23    println!("Connecting to Beeper Desktop API at: {}", base_url);
24    println!("Searching for: \"{}\"", search_query);
25    println!();
26
27    // Create a client with the provided token
28    let client = BeeperClient::new(&token, &base_url);
29
30    // Search for chats
31    println!("๐Ÿ” Searching chats...");
32    let chats_search = client.search_chats(&search_query, None, None).await?;
33    
34    println!("โœ… Found {} matching chat(s):", chats_search.items.len());
35    println!();
36
37    if chats_search.items.is_empty() {
38        println!("No chats found matching \"{}\"", search_query);
39    } else {
40        for (index, chat) in chats_search.items.iter().enumerate() {
41            println!("  {}. {} ({})", index + 1, chat.title, chat.chat_type);
42            println!("     โ””โ”€ Network: {}", chat.network);
43            println!("     โ””โ”€ Participants: {}", chat.participants.total);
44            println!("     โ””โ”€ Unread: {}", chat.unread_count);
45            if let Some(last_activity) = &chat.last_activity {
46                println!("     โ””โ”€ Last Activity: {}", last_activity);
47            }
48            println!();
49        }
50    }
51
52    // Search for messages
53    println!("๐Ÿ“จ Searching messages...");
54    let messages_search = client.search_messages(&search_query, None, None).await?;
55    
56    println!("โœ… Found {} matching message(s):", messages_search.items.len());
57    println!();
58
59    if messages_search.items.is_empty() {
60        println!("No messages found matching \"{}\"", search_query);
61    } else {
62        // Group messages by chat for better display
63        let mut chats_in_results = std::collections::HashMap::new();
64        
65        for message in &messages_search.items {
66            chats_in_results
67                .entry(message.chat_id.clone())
68                .or_insert_with(Vec::new)
69                .push(message);
70        }
71
72        for (chat_id, messages) in &chats_in_results {
73            // Get chat title from search results if available
74            let chat_title = if let Some(chat) = messages_search.chats.as_ref()
75                .and_then(|chats| chats.get(chat_id))
76            {
77                chat.title.clone()
78            } else {
79                chat_id.clone()
80            };
81
82            println!("  Chat: {}", chat_title);
83            println!("  โ””โ”€ {} message(s) found:", messages.len());
84
85            for (msg_index, message) in messages.iter().enumerate() {
86                let sender = message.sender_name.as_deref().unwrap_or("Unknown");
87                let text = message.text.as_deref().unwrap_or("[No text content]");
88                
89                // Truncate long messages
90                let display_text = if text.len() > 60 {
91                    format!("{}...", &text[..60])
92                } else {
93                    text.to_string()
94                };
95
96                println!("     {}. [{}] {}: {}", 
97                    msg_index + 1,
98                    message.timestamp,
99                    sender,
100                    display_text
101                );
102            }
103            println!();
104        }
105    }
106
107    // Show pagination info if available
108    if messages_search.has_more {
109        println!("โ„น๏ธ  More results available. Use pagination with:");
110        println!("    - oldestCursor: {:?}", messages_search.oldest_cursor);
111        println!("    - newestCursor: {:?}", messages_search.newest_cursor);
112    }
113
114    // Display search summary
115    println!("โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”");
116    println!("๐Ÿ“Š Search Summary for \"{}\":", search_query);
117    println!("  โ€ข Chats: {}", chats_search.items.len());
118    println!("  โ€ข Messages: {}", messages_search.items.len());
119    println!("  โ€ข Total Results: {}", chats_search.items.len() + messages_search.items.len());
120    println!("โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”");
121
122    Ok(())
123}
Source

pub async fn search_chats( &self, query: &str, cursor: Option<&str>, direction: Option<&str>, ) -> Result<SearchChatsOutput>

Searches chats by title, network, or participants

Uses Beeper Desktopโ€™s renderer algorithm.

Examples found in repository?
examples/search.rs (line 32)
5async fn main() -> Result<(), Box<dyn std::error::Error>> {
6    // Get authentication token from environment variable
7    let token = env::var("BEEPER_TOKEN")
8        .unwrap_or_else(|_| {
9            eprintln!("Error: BEEPER_TOKEN environment variable not set");
10            eprintln!("Usage: BEEPER_TOKEN=your_token cargo run --example search");
11            std::process::exit(1);
12        });
13
14    // Get search query from command line arguments or use default
15    let search_query = env::args()
16        .nth(1)
17        .unwrap_or_else(|| "hello".to_string());
18
19    // Get API base URL from environment variable or use default
20    let base_url = env::var("BEEPER_API_URL")
21        .unwrap_or_else(|_| "http://localhost:23373".to_string());
22
23    println!("Connecting to Beeper Desktop API at: {}", base_url);
24    println!("Searching for: \"{}\"", search_query);
25    println!();
26
27    // Create a client with the provided token
28    let client = BeeperClient::new(&token, &base_url);
29
30    // Search for chats
31    println!("๐Ÿ” Searching chats...");
32    let chats_search = client.search_chats(&search_query, None, None).await?;
33    
34    println!("โœ… Found {} matching chat(s):", chats_search.items.len());
35    println!();
36
37    if chats_search.items.is_empty() {
38        println!("No chats found matching \"{}\"", search_query);
39    } else {
40        for (index, chat) in chats_search.items.iter().enumerate() {
41            println!("  {}. {} ({})", index + 1, chat.title, chat.chat_type);
42            println!("     โ””โ”€ Network: {}", chat.network);
43            println!("     โ””โ”€ Participants: {}", chat.participants.total);
44            println!("     โ””โ”€ Unread: {}", chat.unread_count);
45            if let Some(last_activity) = &chat.last_activity {
46                println!("     โ””โ”€ Last Activity: {}", last_activity);
47            }
48            println!();
49        }
50    }
51
52    // Search for messages
53    println!("๐Ÿ“จ Searching messages...");
54    let messages_search = client.search_messages(&search_query, None, None).await?;
55    
56    println!("โœ… Found {} matching message(s):", messages_search.items.len());
57    println!();
58
59    if messages_search.items.is_empty() {
60        println!("No messages found matching \"{}\"", search_query);
61    } else {
62        // Group messages by chat for better display
63        let mut chats_in_results = std::collections::HashMap::new();
64        
65        for message in &messages_search.items {
66            chats_in_results
67                .entry(message.chat_id.clone())
68                .or_insert_with(Vec::new)
69                .push(message);
70        }
71
72        for (chat_id, messages) in &chats_in_results {
73            // Get chat title from search results if available
74            let chat_title = if let Some(chat) = messages_search.chats.as_ref()
75                .and_then(|chats| chats.get(chat_id))
76            {
77                chat.title.clone()
78            } else {
79                chat_id.clone()
80            };
81
82            println!("  Chat: {}", chat_title);
83            println!("  โ””โ”€ {} message(s) found:", messages.len());
84
85            for (msg_index, message) in messages.iter().enumerate() {
86                let sender = message.sender_name.as_deref().unwrap_or("Unknown");
87                let text = message.text.as_deref().unwrap_or("[No text content]");
88                
89                // Truncate long messages
90                let display_text = if text.len() > 60 {
91                    format!("{}...", &text[..60])
92                } else {
93                    text.to_string()
94                };
95
96                println!("     {}. [{}] {}: {}", 
97                    msg_index + 1,
98                    message.timestamp,
99                    sender,
100                    display_text
101                );
102            }
103            println!();
104        }
105    }
106
107    // Show pagination info if available
108    if messages_search.has_more {
109        println!("โ„น๏ธ  More results available. Use pagination with:");
110        println!("    - oldestCursor: {:?}", messages_search.oldest_cursor);
111        println!("    - newestCursor: {:?}", messages_search.newest_cursor);
112    }
113
114    // Display search summary
115    println!("โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”");
116    println!("๐Ÿ“Š Search Summary for \"{}\":", search_query);
117    println!("  โ€ข Chats: {}", chats_search.items.len());
118    println!("  โ€ข Messages: {}", messages_search.items.len());
119    println!("  โ€ข Total Results: {}", chats_search.items.len() + messages_search.items.len());
120    println!("โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”");
121
122    Ok(())
123}
Sourceยง

impl BeeperClient

Source

pub async fn focus_app( &self, input: Option<FocusAppInput>, ) -> Result<FocusAppOutput>

Focuses Beeper Desktop and optionally navigates to a specific location

Examples found in repository?
examples/focus_app.rs (line 60)
5async fn main() -> Result<(), Box<dyn std::error::Error>> {
6    // Get authentication token from environment variable
7    let token = env::var("BEEPER_TOKEN")
8        .unwrap_or_else(|_| {
9            eprintln!("Error: BEEPER_TOKEN environment variable not set");
10            eprintln!("Usage: BEEPER_TOKEN=your_token cargo run --example focus_app [chat_id] [message_id] [draft_text]");
11            std::process::exit(1);
12        });
13
14    // Get API base URL from environment variable or use default
15    let base_url = env::var("BEEPER_API_URL")
16        .unwrap_or_else(|_| "http://localhost:23373".to_string());
17
18    println!("Connecting to Beeper Desktop API at: {}", base_url);
19    println!();
20
21    // Create a client with the provided token
22    let client = BeeperClient::new(&token, &base_url);
23
24    // Get optional arguments
25    let args: Vec<String> = env::args().collect();
26    let chat_id = args.get(1).cloned();
27    let message_id = args.get(2).cloned();
28    let draft_text = args.get(3).cloned();
29
30    // Create focus input based on arguments
31    let focus_input = if chat_id.is_some() || message_id.is_some() || draft_text.is_some() {
32        Some(FocusAppInput {
33            chat_id: chat_id.clone(),
34            message_id: message_id.clone(),
35            draft: draft_text.clone(),
36        })
37    } else {
38        None
39    };
40
41    // Determine what we're doing
42    if let Some(ref input) = focus_input {
43        println!("๐Ÿ” Focusing Beeper with parameters:");
44        if let Some(ref cid) = input.chat_id {
45            println!("  Chat ID: {}", cid);
46        }
47        if let Some(ref mid) = input.message_id {
48            println!("  Message ID: {}", mid);
49        }
50        if let Some(ref draft) = input.draft {
51            println!("  Draft: {}", draft);
52        }
53        println!();
54    } else {
55        println!("๐ŸŽฏ Focusing Beeper Desktop (no parameters)");
56        println!();
57    }
58
59    // Focus the app
60    match client.focus_app(focus_input).await {
61        Ok(response) => {
62            if response.success {
63                println!("โœ… Successfully focused Beeper Desktop!");
64                println!();
65                if draft_text.is_some() {
66                    println!("๐Ÿ’ฌ Draft text has been pre-filled in the chat");
67                }
68                if chat_id.is_some() {
69                    println!("๐Ÿ“ Navigated to the specified chat");
70                }
71                if message_id.is_some() {
72                    println!("๐Ÿ’ญ Navigated to the specified message");
73                }
74            } else {
75                println!("โš ๏ธ  Focus operation completed but returned success: false");
76            }
77            println!();
78            println!("Response:");
79            println!("{:#?}", response);
80        }
81        Err(e) => {
82            eprintln!("Error: {}", e);
83            std::process::exit(1);
84        }
85    }
86
87    Ok(())
88}
Source

pub async fn download_asset(&self, url: &str) -> Result<DownloadAssetOutput>

Downloads an asset from a URL

Downloads a Matrix asset using its mxc:// or localmxc:// URL to the device running Beeper Desktop and returns the local file URL.

Sourceยง

impl BeeperClient

Source

pub fn new(token: impl Into<String>, base_url: impl Into<String>) -> Self

Creates a new Beeper API client

ยงArguments
  • token - Bearer token for authentication
  • base_url - Base URL of the Beeper Desktop API server
Examples found in repository?
examples/fetch_chats.rs (line 22)
5async fn main() -> Result<(), Box<dyn std::error::Error>> {
6    // Get authentication token from environment variable
7    let token = env::var("BEEPER_TOKEN")
8        .unwrap_or_else(|_| {
9            eprintln!("Error: BEEPER_TOKEN environment variable not set");
10            eprintln!("Usage: BEEPER_TOKEN=your_token cargo run --example fetch_chats");
11            std::process::exit(1);
12        });
13
14    // Get API base URL from environment variable or use default
15    let base_url = env::var("BEEPER_API_URL")
16        .unwrap_or_else(|_| "http://localhost:23373".to_string());
17
18    println!("Connecting to Beeper Desktop API at: {}", base_url);
19    println!();
20
21    // Create a client with the provided token
22    let client = BeeperClient::new(&token, &base_url);
23
24    // Fetch all chats
25    println!("๐Ÿ“‹ Fetching chats from Beeper...");
26    let chats_response = client.list_chats(None, None).await?;
27
28    // Extract chat names into a vector using the display_name method
29    let chat_names: Vec<String> = chats_response
30        .items
31        .iter()
32        .map(|chat| chat.display_name())
33        .collect();
34
35    // Display results
36    println!("โœ… Successfully retrieved {} chats:", chat_names.len());
37    println!();
38
39    if chat_names.is_empty() {
40        println!("No chats found.");
41    } else {
42        for (index, name) in chat_names.iter().enumerate() {
43            println!("  {}. {}", index + 1, name);
44        }
45    }
46
47    println!();
48    println!("Chat names as array:");
49    println!("{:#?}", chat_names);
50
51    Ok(())
52}
More examples
Hide additional examples
examples/send_message.rs (line 22)
5async fn main() -> Result<(), Box<dyn std::error::Error>> {
6    // Get authentication token from environment variable
7    let token = env::var("BEEPER_TOKEN")
8        .unwrap_or_else(|_| {
9            eprintln!("Error: BEEPER_TOKEN environment variable not set");
10            eprintln!("Usage: BEEPER_TOKEN=your_token cargo run --example send_message");
11            std::process::exit(1);
12        });
13
14    // Get API base URL from environment variable or use default
15    let base_url = env::var("BEEPER_API_URL")
16        .unwrap_or_else(|_| "http://localhost:23373".to_string());
17
18    println!("Connecting to Beeper Desktop API at: {}", base_url);
19    println!();
20
21    // Create a client with the provided token
22    let client = BeeperClient::new(&token, &base_url);
23
24    // Fetch all chats to find the first non-group chat
25    println!("๐Ÿ“‹ Fetching chats...");
26    let chats_response = client.list_chats(None, None).await?;
27
28    if chats_response.items.is_empty() {
29        println!("โŒ No chats found!");
30        return Ok(());
31    }
32
33    // Find the first single (non-group) chat
34    let single_chat = chats_response
35        .items
36        .iter()
37        .find(|chat| chat.chat_type == "single");
38
39    if let Some(chat) = single_chat {
40        let chat_id = &chat.id;
41        let chat_title = &chat.title;
42
43        println!("โœ… Found {} chats", chats_response.items.len());
44        println!();
45        println!("๐Ÿ’ฌ Sending message to first single chat: '{}'", chat_title);
46        println!("   Chat ID: {}", chat_id);
47        println!();
48
49        // Create the message input
50        let message_input = SendMessageInput {
51            text: "Hello".to_string(),
52            reply_to_id: None,
53        };
54
55        // Send the message
56        let response = client.send_message(chat_id, message_input).await?;
57
58        println!("โœ… Message sent successfully!");
59        println!();
60        println!("Message Details:");
61        println!("  Chat ID: {}", response.chat_id);
62        println!("  Pending Message ID: {}", response.pending_message_id);
63        println!();
64        println!("Full response (JSON):");
65        println!("{:#?}", response);
66    } else {
67        println!("โŒ No single (non-group) chats found!");
68        println!();
69        println!("Available chats:");
70        for (index, chat) in chats_response.items.iter().enumerate() {
71            println!("  {}. {} ({})", index + 1, chat.title, chat.chat_type);
72        }
73    }
74
75    Ok(())
76}
examples/fetch_accounts.rs (line 22)
5async fn main() -> Result<(), Box<dyn std::error::Error>> {
6    // Get authentication token from environment variable
7    let token = env::var("BEEPER_TOKEN")
8        .unwrap_or_else(|_| {
9            eprintln!("Error: BEEPER_TOKEN environment variable not set");
10            eprintln!("Usage: BEEPER_TOKEN=your_token cargo run --example fetch_accounts");
11            std::process::exit(1);
12        });
13
14    // Get API base URL from environment variable or use default
15    let base_url = env::var("BEEPER_API_URL")
16        .unwrap_or_else(|_| "http://localhost:23373".to_string());
17
18    println!("Connecting to Beeper Desktop API at: {}", base_url);
19    println!();
20
21    // Create a client with the provided token
22    let client = BeeperClient::new(&token, &base_url);
23
24    // Fetch all accounts
25    println!("๐Ÿ‘ค Fetching connected accounts...");
26    let accounts = client.get_accounts().await?;
27
28    println!("โœ… Successfully retrieved {} account(s):", accounts.len());
29    println!();
30
31    if accounts.is_empty() {
32        println!("No accounts connected.");
33    } else {
34        // Display accounts with formatting
35        for (index, account) in accounts.iter().enumerate() {
36            let account_id = &account.account_id;
37            let network = &account.network;
38            let user = &account.user;
39
40            // Build user identifier
41            let user_identifier = if let Some(full_name) = &user.full_name {
42                full_name.clone()
43            } else if let Some(username) = &user.username {
44                format!("@{}", username)
45            } else if let Some(phone) = &user.phone_number {
46                phone.clone()
47            } else {
48                user.id.clone()
49            };
50
51            println!("  {}. {} Account", index + 1, network);
52            println!("     โ””โ”€ User: {}", user_identifier);
53            println!("     โ””โ”€ Account ID: {}", account_id);
54            println!("     โ””โ”€ User ID: {}", user.id);
55
56            // Show additional user info if available
57            if let Some(username) = &user.username {
58                println!("     โ””โ”€ Username: @{}", username);
59            }
60            if let Some(phone) = &user.phone_number {
61                println!("     โ””โ”€ Phone: {}", phone);
62            }
63            if let Some(email) = &user.email {
64                println!("     โ””โ”€ Email: {}", email);
65            }
66            if let Some(cannot_message) = user.cannot_message {
67                if cannot_message {
68                    println!("     โ””โ”€ โš ๏ธ  Cannot initiate messages to this user");
69                }
70            }
71
72            println!();
73        }
74    }
75
76    println!("Account details (JSON):");
77    println!("{:#?}", accounts);
78
79    Ok(())
80}
examples/focus_app.rs (line 22)
5async fn main() -> Result<(), Box<dyn std::error::Error>> {
6    // Get authentication token from environment variable
7    let token = env::var("BEEPER_TOKEN")
8        .unwrap_or_else(|_| {
9            eprintln!("Error: BEEPER_TOKEN environment variable not set");
10            eprintln!("Usage: BEEPER_TOKEN=your_token cargo run --example focus_app [chat_id] [message_id] [draft_text]");
11            std::process::exit(1);
12        });
13
14    // Get API base URL from environment variable or use default
15    let base_url = env::var("BEEPER_API_URL")
16        .unwrap_or_else(|_| "http://localhost:23373".to_string());
17
18    println!("Connecting to Beeper Desktop API at: {}", base_url);
19    println!();
20
21    // Create a client with the provided token
22    let client = BeeperClient::new(&token, &base_url);
23
24    // Get optional arguments
25    let args: Vec<String> = env::args().collect();
26    let chat_id = args.get(1).cloned();
27    let message_id = args.get(2).cloned();
28    let draft_text = args.get(3).cloned();
29
30    // Create focus input based on arguments
31    let focus_input = if chat_id.is_some() || message_id.is_some() || draft_text.is_some() {
32        Some(FocusAppInput {
33            chat_id: chat_id.clone(),
34            message_id: message_id.clone(),
35            draft: draft_text.clone(),
36        })
37    } else {
38        None
39    };
40
41    // Determine what we're doing
42    if let Some(ref input) = focus_input {
43        println!("๐Ÿ” Focusing Beeper with parameters:");
44        if let Some(ref cid) = input.chat_id {
45            println!("  Chat ID: {}", cid);
46        }
47        if let Some(ref mid) = input.message_id {
48            println!("  Message ID: {}", mid);
49        }
50        if let Some(ref draft) = input.draft {
51            println!("  Draft: {}", draft);
52        }
53        println!();
54    } else {
55        println!("๐ŸŽฏ Focusing Beeper Desktop (no parameters)");
56        println!();
57    }
58
59    // Focus the app
60    match client.focus_app(focus_input).await {
61        Ok(response) => {
62            if response.success {
63                println!("โœ… Successfully focused Beeper Desktop!");
64                println!();
65                if draft_text.is_some() {
66                    println!("๐Ÿ’ฌ Draft text has been pre-filled in the chat");
67                }
68                if chat_id.is_some() {
69                    println!("๐Ÿ“ Navigated to the specified chat");
70                }
71                if message_id.is_some() {
72                    println!("๐Ÿ’ญ Navigated to the specified message");
73                }
74            } else {
75                println!("โš ๏ธ  Focus operation completed but returned success: false");
76            }
77            println!();
78            println!("Response:");
79            println!("{:#?}", response);
80        }
81        Err(e) => {
82            eprintln!("Error: {}", e);
83            std::process::exit(1);
84        }
85    }
86
87    Ok(())
88}
examples/fetch_messages.rs (line 22)
5async fn main() -> Result<(), Box<dyn std::error::Error>> {
6    // Get authentication token from environment variable
7    let token = env::var("BEEPER_TOKEN")
8        .unwrap_or_else(|_| {
9            eprintln!("Error: BEEPER_TOKEN environment variable not set");
10            eprintln!("Usage: BEEPER_TOKEN=your_token cargo run --example fetch_messages");
11            std::process::exit(1);
12        });
13
14    // Get API base URL from environment variable or use default
15    let base_url = env::var("BEEPER_API_URL")
16        .unwrap_or_else(|_| "http://localhost:23373".to_string());
17
18    println!("Connecting to Beeper Desktop API at: {}", base_url);
19    println!();
20
21    // Create a client with the provided token
22    let client = BeeperClient::new(&token, &base_url);
23
24    // Fetch all chats to find the first one
25    println!("๐Ÿ“‹ Fetching chats...");
26    let chats_response = client.list_chats(None, None).await?;
27
28    if chats_response.items.is_empty() {
29        println!("โŒ No chats found!");
30        return Ok(());
31    }
32
33    // Get the first chat
34    let first_chat = &chats_response.items[0];
35    let chat_id = &first_chat.id;
36    let chat_title = &first_chat.title;
37
38    println!("โœ… Found {} chats", chats_response.items.len());
39    println!();
40    println!("๐Ÿ“ฌ Fetching messages from first chat: '{}'", chat_title);
41    println!("   Chat ID: {}", chat_id);
42    println!();
43
44    // Fetch messages from the first chat
45    let messages_response = client.list_messages(chat_id, None, None).await?;
46
47    println!("โœ… Successfully retrieved {} messages:", messages_response.items.len());
48    println!();
49
50    if messages_response.items.is_empty() {
51        println!("No messages found in this chat.");
52    } else {
53        // Display messages with formatting
54        for (index, message) in messages_response.items.iter().enumerate() {
55            let sender = message.sender_name.as_deref().unwrap_or("Unknown");
56            let text = message.text.as_deref().unwrap_or("[No text content]");
57            let timestamp = &message.timestamp;
58
59            // Show attachments count if any
60            let attachment_info = if let Some(attachments) = &message.attachments {
61                format!(" [+{} attachment(s)]", attachments.len())
62            } else {
63                String::new()
64            };
65
66            // Show reactions count if any
67            let reaction_info = if let Some(reactions) = &message.reactions {
68                format!(" [+{} reaction(s)]", reactions.len())
69            } else {
70                String::new()
71            };
72
73            // Show reply indicator if replying to another message
74            let reply_info = if message.reply_to_id.is_some() {
75                " [โ†ฉ๏ธ Reply]".to_string()
76            } else {
77                String::new()
78            };
79
80            println!("  {}. [{}] {}: {}{}{}{}", 
81                index + 1, 
82                timestamp, 
83                sender, 
84                text,
85                attachment_info,
86                reaction_info,
87                reply_info
88            );
89        }
90    }
91
92    println!();
93    println!("Message details (JSON):");
94    println!("{:#?}", messages_response.items);
95
96    // Show pagination info if available
97    if messages_response.has_more {
98        println!();
99        println!("โ„น๏ธ  More messages available. Use pagination to fetch older/newer messages.");
100    }
101
102    Ok(())
103}
examples/search.rs (line 28)
5async fn main() -> Result<(), Box<dyn std::error::Error>> {
6    // Get authentication token from environment variable
7    let token = env::var("BEEPER_TOKEN")
8        .unwrap_or_else(|_| {
9            eprintln!("Error: BEEPER_TOKEN environment variable not set");
10            eprintln!("Usage: BEEPER_TOKEN=your_token cargo run --example search");
11            std::process::exit(1);
12        });
13
14    // Get search query from command line arguments or use default
15    let search_query = env::args()
16        .nth(1)
17        .unwrap_or_else(|| "hello".to_string());
18
19    // Get API base URL from environment variable or use default
20    let base_url = env::var("BEEPER_API_URL")
21        .unwrap_or_else(|_| "http://localhost:23373".to_string());
22
23    println!("Connecting to Beeper Desktop API at: {}", base_url);
24    println!("Searching for: \"{}\"", search_query);
25    println!();
26
27    // Create a client with the provided token
28    let client = BeeperClient::new(&token, &base_url);
29
30    // Search for chats
31    println!("๐Ÿ” Searching chats...");
32    let chats_search = client.search_chats(&search_query, None, None).await?;
33    
34    println!("โœ… Found {} matching chat(s):", chats_search.items.len());
35    println!();
36
37    if chats_search.items.is_empty() {
38        println!("No chats found matching \"{}\"", search_query);
39    } else {
40        for (index, chat) in chats_search.items.iter().enumerate() {
41            println!("  {}. {} ({})", index + 1, chat.title, chat.chat_type);
42            println!("     โ””โ”€ Network: {}", chat.network);
43            println!("     โ””โ”€ Participants: {}", chat.participants.total);
44            println!("     โ””โ”€ Unread: {}", chat.unread_count);
45            if let Some(last_activity) = &chat.last_activity {
46                println!("     โ””โ”€ Last Activity: {}", last_activity);
47            }
48            println!();
49        }
50    }
51
52    // Search for messages
53    println!("๐Ÿ“จ Searching messages...");
54    let messages_search = client.search_messages(&search_query, None, None).await?;
55    
56    println!("โœ… Found {} matching message(s):", messages_search.items.len());
57    println!();
58
59    if messages_search.items.is_empty() {
60        println!("No messages found matching \"{}\"", search_query);
61    } else {
62        // Group messages by chat for better display
63        let mut chats_in_results = std::collections::HashMap::new();
64        
65        for message in &messages_search.items {
66            chats_in_results
67                .entry(message.chat_id.clone())
68                .or_insert_with(Vec::new)
69                .push(message);
70        }
71
72        for (chat_id, messages) in &chats_in_results {
73            // Get chat title from search results if available
74            let chat_title = if let Some(chat) = messages_search.chats.as_ref()
75                .and_then(|chats| chats.get(chat_id))
76            {
77                chat.title.clone()
78            } else {
79                chat_id.clone()
80            };
81
82            println!("  Chat: {}", chat_title);
83            println!("  โ””โ”€ {} message(s) found:", messages.len());
84
85            for (msg_index, message) in messages.iter().enumerate() {
86                let sender = message.sender_name.as_deref().unwrap_or("Unknown");
87                let text = message.text.as_deref().unwrap_or("[No text content]");
88                
89                // Truncate long messages
90                let display_text = if text.len() > 60 {
91                    format!("{}...", &text[..60])
92                } else {
93                    text.to_string()
94                };
95
96                println!("     {}. [{}] {}: {}", 
97                    msg_index + 1,
98                    message.timestamp,
99                    sender,
100                    display_text
101                );
102            }
103            println!();
104        }
105    }
106
107    // Show pagination info if available
108    if messages_search.has_more {
109        println!("โ„น๏ธ  More results available. Use pagination with:");
110        println!("    - oldestCursor: {:?}", messages_search.oldest_cursor);
111        println!("    - newestCursor: {:?}", messages_search.newest_cursor);
112    }
113
114    // Display search summary
115    println!("โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”");
116    println!("๐Ÿ“Š Search Summary for \"{}\":", search_query);
117    println!("  โ€ข Chats: {}", chats_search.items.len());
118    println!("  โ€ข Messages: {}", messages_search.items.len());
119    println!("  โ€ข Total Results: {}", chats_search.items.len() + messages_search.items.len());
120    println!("โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”");
121
122    Ok(())
123}
Source

pub fn with_token(token: impl Into<String>) -> Self

Creates a new Beeper API client with default base URL

ยงArguments
  • token - Bearer token for authentication
Source

pub fn set_token(&mut self, token: impl Into<String>)

Updates the bearer token

Source

pub fn set_base_url(&mut self, base_url: impl Into<String>)

Updates the base URL

Source

pub fn base_url(&self) -> &str

Gets the current base URL

Trait Implementationsยง

Sourceยง

impl Clone for BeeperClient

Sourceยง

fn clone(&self) -> BeeperClient

Returns a duplicate of the value. Read more
1.0.0 ยท Sourceยง

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementationsยง

Blanket Implementationsยง

Sourceยง

impl<T> Any for T
where T: 'static + ?Sized,

Sourceยง

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Sourceยง

impl<T> Borrow<T> for T
where T: ?Sized,

Sourceยง

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Sourceยง

impl<T> BorrowMut<T> for T
where T: ?Sized,

Sourceยง

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Sourceยง

impl<T> CloneToUninit for T
where T: Clone,

Sourceยง

unsafe fn clone_to_uninit(&self, dest: *mut u8)

๐Ÿ”ฌThis is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Sourceยง

impl<T> From<T> for T

Sourceยง

fn from(t: T) -> T

Returns the argument unchanged.

Sourceยง

impl<T> Instrument for T

Sourceยง

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Sourceยง

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Sourceยง

impl<T, U> Into<U> for T
where U: From<T>,

Sourceยง

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Sourceยง

impl<T> PolicyExt for T
where T: ?Sized,

Sourceยง

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Sourceยง

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Sourceยง

impl<T> ToOwned for T
where T: Clone,

Sourceยง

type Owned = T

The resulting type after obtaining ownership.
Sourceยง

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Sourceยง

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Sourceยง

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Sourceยง

type Error = Infallible

The type returned in the event of a conversion error.
Sourceยง

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Sourceยง

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Sourceยง

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Sourceยง

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Sourceยง

impl<T> WithSubscriber for T

Sourceยง

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Sourceยง

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more