Skip to main content

zulip_api/message/unread_msgs/
huddle.rs

1use serde::{Deserialize, Serialize};
2
3use crate::{field_access, impl_default, impl_display};
4
5/// Represents details of unread group direct messages with a specific group of users.
6#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
7pub struct UnreadMsgsHuddle {
8    #[serde(skip_serializing_if = "Option::is_none")]
9    user_ids_string: Option<String>,
10    #[serde(skip_serializing_if = "Option::is_none")]
11    unread_message_ids: Option<Vec<u64>>,
12}
13
14impl UnreadMsgsHuddle {
15    /// Creates a new [Self].
16    pub const fn new() -> Self {
17        Self {
18            user_ids_string: None,
19            unread_message_ids: None,
20        }
21    }
22}
23
24field_access! {
25    UnreadMsgsHuddle {
26        /// A string containing the IDs of all users in the group direct message conversation, including the current user, separated by commas and sorted numerically; for example: `\"1,2,3\"`.
27        user_ids_string: option_cow_deref { str, String },
28        /// The message IDs of the recent unread messages which have been sent in this group direct message conversation, sorted in ascending order.
29        unread_message_ids: option_cow_deref { [u64], Vec<u64> },
30    }
31}
32
33impl_default!(UnreadMsgsHuddle);
34impl_display!(UnreadMsgsHuddle);