Skip to main content

beeper_desktop_api/models/
user.rs

1//! User and account models
2
3use serde::{Deserialize, Serialize};
4
5/// A user in the Beeper system
6#[derive(Debug, Clone, Serialize, Deserialize)]
7pub struct User {
8    /// User ID
9    pub id: String,
10    /// Human-readable handle
11    #[serde(skip_serializing_if = "Option::is_none")]
12    pub username: Option<String>,
13    /// User's phone number in E.164 format
14    #[serde(skip_serializing_if = "Option::is_none")]
15    #[serde(rename = "phoneNumber")]
16    pub phone_number: Option<String>,
17    /// User's email address
18    #[serde(skip_serializing_if = "Option::is_none")]
19    pub email: Option<String>,
20    /// Display name
21    #[serde(skip_serializing_if = "Option::is_none")]
22    #[serde(rename = "fullName")]
23    pub full_name: Option<String>,
24    /// Avatar image URL
25    #[serde(skip_serializing_if = "Option::is_none")]
26    #[serde(rename = "imgURL")]
27    pub img_url: Option<String>,
28    /// True if Beeper cannot initiate messages to this user
29    #[serde(skip_serializing_if = "Option::is_none")]
30    #[serde(rename = "cannotMessage")]
31    pub cannot_message: Option<bool>,
32    /// True if this is the current user
33    #[serde(skip_serializing_if = "Option::is_none")]
34    #[serde(rename = "isSelf")]
35    pub is_self: Option<bool>,
36}
37
38/// A chat account connected to Beeper
39#[derive(Debug, Clone, Serialize, Deserialize)]
40pub struct Account {
41    /// Chat account ID
42    #[serde(rename = "accountID")]
43    pub account_id: String,
44    /// Network type
45    pub network: String,
46    /// User associated with this account
47    pub user: User,
48}
49
50/// Output for get_accounts
51pub type GetAccountsOutput = Vec<Account>;