zulip_api/message/include_subscribers.rs
1use serde::{Deserialize, Serialize};
2
3use crate::{impl_default, impl_display};
4
5/// Whether each returned channel object should include a `subscribers`
6/// field containing a list of the user IDs of its subscribers.
7///
8/// Client apps supporting organizations with many thousands of users
9/// should not pass `true`, because the full subscriber matrix may be
10/// several megabytes of data. The `partial` value, combined with the
11/// `subscriber_count` and fetching subscribers for individual channels as
12/// needed, is recommended to support client app features where channel
13/// subscriber data is useful.
14///
15/// If a client passes `partial` for this parameter, the server may,
16/// for some channels, return a subset of the channel's subscribers
17/// in the `partial_subscribers` field instead of the `subscribers` field,
18/// which always contains the complete set of subscribers.
19///
20/// The server guarantees that it will always return a `subscribers`
21/// field for channels with fewer than 250 total subscribers. When
22/// returning a `partial_subscribers` field, the server guarantees
23/// that all bot users and users active within the last 14 days will
24/// be included. For other cases, the server may use its discretion
25/// to determine which channels and users to include, balancing between
26/// payload size and usefulness of the data provided to the client.
27///
28/// Passing `true` in an [unauthenticated
29/// request](/help/public-access-option) is an error.
30///
31/// **Changes**: The `partial` value is new in Zulip 11.0 (feature level 412).
32///
33/// Before Zulip 6.0 (feature level 149), this parameter was silently
34/// ignored and processed as though it were `false` in unauthenticated
35/// requests.
36///
37/// New in Zulip 2.1.0.
38#[derive(Clone, Copy, Debug, Eq, PartialEq, Deserialize, Serialize)]
39#[serde(rename_all = "snake_case")]
40pub enum IncludeSubscribers {
41 False,
42 True,
43 Partial,
44}
45
46impl IncludeSubscribers {
47 /// Creates a new [IncludeSubscribers].
48 pub const fn new() -> Self {
49 Self::False
50 }
51}
52
53impl_default!(IncludeSubscribers);
54impl_display!(IncludeSubscribers);