use chrono::{DateTime, Utc}; #[derive(Debug, Clone, PartialEq, Default)] pub struct MemberRecord { pub user_id: Option, pub display_name: String, } #[derive(Debug, Clone, PartialEq, Default)] pub struct ChatRecord { pub id: String, pub kind: String, pub title: String, pub member_summary: String, pub last_message_at: Option>, pub last_read_at: Option>, pub unread: bool, pub muted: bool, pub members: Vec, pub last_message_preview: Option, pub last_message_sender_id: Option, pub last_message_sender_name: Option, pub last_message_deleted: bool, pub last_event_system: bool, } #[derive(Debug, Clone, PartialEq)] pub struct AvatarRecord { pub user_id: String, pub bytes: Option>, pub content_type: String, pub fetched_at: DateTime, } #[derive(Debug, Clone, PartialEq)] pub struct FolderRecord { pub id: String, pub name: String, pub kind: String, pub conversation_ids: Vec, } #[derive(Debug, Clone, PartialEq)] pub struct TeamRecord { pub id: String, pub name: String, } #[derive(Debug, Clone, PartialEq)] pub struct ChannelRecord { pub id: String, pub team_id: String, pub name: String, pub membership_type: Option, pub last_message_at: Option>, pub unread: bool, } #[derive(Debug, Clone, PartialEq, Default)] pub struct MessageRecord { pub conversation_id: String, pub message_id: String, pub reply_to_id: Option, pub sender_id: Option, pub sender_name: Option, pub created_at: DateTime, pub edited_at: Option>, pub deleted: bool, pub body_html: String, pub attachments_json: String, pub reactions_json: String, pub mentions_json: String, pub sender_application_id: Option, } #[derive(Debug, Clone, PartialEq)] pub struct SyncState { pub newest_seen: Option>, pub oldest_loaded: Option>, pub has_more: bool, pub older_cursor: Option, pub delta_link: Option, } impl Default for SyncState { fn default() -> Self { SyncState { newest_seen: None, oldest_loaded: None, has_more: true, older_cursor: None, delta_link: None, } } } #[derive(Debug, Clone, PartialEq)] pub struct SidebarTeam { pub team: TeamRecord, pub channels: Vec, pub hidden: bool, pub hidden_channel_ids: Vec, } #[derive(Debug, Clone, PartialEq, Eq)] pub struct ChannelLayoutRecord { pub channel_id: String, pub general: bool, pub hidden: bool, } #[derive(Debug, Clone, PartialEq, Eq)] pub struct TeamLayoutRecord { pub team_id: String, pub hidden: bool, pub channels: Vec, } /// Everything the sidebar renders: chats by last message (newest first), teams in the user's Teams order (alphabetical without one), General first, then channels by name. #[derive(Debug, Clone, PartialEq, Default)] pub struct Sidebar { pub chats: Vec, pub teams: Vec, } #[derive(Debug, Clone, Copy, PartialEq)] pub struct ChatPreview<'a> { pub text: Option<&'a str>, pub sender_id: Option<&'a str>, pub sender_name: Option<&'a str>, pub deleted: bool, } #[derive(Debug, Clone, PartialEq)] pub struct ImageRecord { pub key: String, pub bytes: Vec, pub content_type: String, pub fetched_at: DateTime, } #[derive(Debug, Clone, PartialEq)] pub struct SearchHit { pub conversation_id: String, pub message_id: String, pub sender_name: Option, pub created_at: DateTime, pub snippet: String, } #[derive(Debug, Clone, PartialEq, Eq)] pub struct ConversationHit { pub conversation_id: String, pub title: String, } #[derive(Debug, Clone, PartialEq)] pub struct ActivityRecord { pub id: i64, pub conversation_id: String, pub kind: String, pub message_id: String, pub actors_json: String, pub preview: String, pub glyphs: String, pub count: u32, pub updated_at: DateTime, pub read: bool, }