Skip to main content

zulip_api/message/
event_type.rs

1use serde::{Deserialize, Serialize};
2
3use crate::{impl_default, impl_display};
4
5/// A JSON-encoded array indicating which types of events you're interested
6/// in. Values that you might find useful include:
7///
8/// - **message** (messages)
9/// - **subscription** (changes in your subscriptions)
10/// - **realm_user** (changes to users in the organization and
11///   their properties, such as their name).
12///
13/// If you do not specify this parameter, you will receive all
14/// events, and have to filter out the events not relevant to
15/// your client in your client code. For most applications, one
16/// is only interested in messages, so one specifies:
17/// `"event_types": ["message"]`
18///
19/// Event types not supported by the server are ignored, in order to simplify
20/// the implementation of client apps that support multiple server versions.
21///
22/// For details see: <https://zulip.com/api/get-events#events-by-type>
23#[derive(Clone, Copy, Debug, Eq, PartialEq, Deserialize, Serialize)]
24#[serde(rename_all = "snake_case")]
25pub enum EventType {
26    AlertWords,
27    Attachment,
28    ChannelFolder,
29    CustomProfileFields,
30    DefaultStreamGroups,
31    DefaultStreams,
32    DeleteMessage,
33    Drafts,
34    HasZoomToken,
35    Heartbeat,
36    InvitesChanged,
37    Message,
38    MutedTopics,
39    MutedUsers,
40    NavigationView,
41    OnboardingSteps,
42    Presence,
43    PushDevice,
44    Reaction,
45    Realm,
46    RealmBot,
47    RealmDomains,
48    RealmEmoji,
49    RealmExport,
50    RealmExportConsent,
51    RealmFilters,
52    RealmLinkifiers,
53    RealmPlaygrounds,
54    RealmUser,
55    RealmUserSettingsDefaults,
56    Reminders,
57    Restart,
58    SavedSnippets,
59    ScheduledMessages,
60    Stream,
61    Submessage,
62    Subscription,
63    Typing,
64    TypingEditMessage,
65    UpdateDisplaySettings,
66    UpdateGlobalNotifications,
67    UpdateMessage,
68    UpdateMessageFlags,
69    UserGroup,
70    UserSettings,
71    UserStatus,
72    UserTopic,
73    WebReloadClient,
74}
75
76impl EventType {
77    /// Creates a new [EventType].
78    pub const fn new() -> Self {
79        Self::AlertWords
80    }
81}
82
83impl_default!(EventType);
84impl_display!(EventType);