1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
//! Change-log kinds and notification reasons.
//!
//! Stored as `smallint`; the numbers are frozen. New kinds are only ever appended.
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
coded_enum! {
/// What changed in a channel's change log (`channel_changes.kind`).
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, JsonSchema)]
pub enum ChannelChangeKind {
/// A message was posted.
MessageCreated = "message_created" => 1,
/// A message was edited.
MessageUpdated = "message_updated" => 2,
/// A message was deleted.
MessageDeleted = "message_deleted" => 3,
/// A reaction was added or removed.
ReactionChanged = "reaction_changed" => 4,
/// A message was pinned or unpinned.
PinChanged = "pin_changed" => 5,
/// A thread's summary changed.
ThreadUpdated = "thread_updated" => 6,
/// Channel settings changed.
ChannelUpdated = "channel_updated" => 7,
/// A member joined.
MemberJoined = "member_joined" => 8,
/// A member left.
MemberLeft = "member_left" => 9,
/// A message's attachments changed.
AttachmentChanged = "attachment_changed" => 10,
/// A poll changed.
PollUpdated = "poll_updated" => 11,
/// Voice state changed (registered; unused in v1).
VoiceStateChanged = "voice_state_changed" => 12,
/// A channel bookmark changed.
BookmarkChanged = "bookmark_changed" => 13,
/// A message's link previews changed.
PreviewChanged = "preview_changed" => 14,
/// A meeting row or its attendees changed (`entity_id` = the meeting id).
MeetingUpdated = "meeting_updated" => 15,
/// A meeting's link was made, rotated or revoked (`entity_id` = the link
/// row id). Hosts read the link with `GET /meetings/{id}/link`; the secret is never in
/// the log.
MeetingLinkChanged = "meeting_link_changed" => 16,
}
}
coded_enum! {
/// What changed in a member's own change log (`member_changes.kind`).
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, JsonSchema)]
pub enum MemberChangeKind {
/// The member joined a channel.
ChannelJoined = "channel_joined" => 1,
/// The member left a channel.
ChannelLeft = "channel_left" => 2,
/// The member joined a space.
SpaceJoined = "space_joined" => 3,
/// The member left a space.
SpaceLeft = "space_left" => 4,
/// A read cursor moved.
ReadStateMoved = "read_state_moved" => 5,
/// Preferences changed.
PrefsChanged = "prefs_changed" => 6,
/// Effective permissions changed.
PermsChanged = "perms_changed" => 7,
/// A notification was written; the entry carries a reason, not an entity.
Notification = "notification" => 8,
/// A draft changed.
DraftChanged = "draft_changed" => 9,
/// A saved item changed.
SavedChanged = "saved_changed" => 10,
/// A reminder fired.
ReminderFired = "reminder_fired" => 11,
/// The member's profile changed.
ProfileChanged = "profile_changed" => 12,
/// A thread was followed or unfollowed.
ThreadFollowChanged = "thread_follow_changed" => 13,
/// Voice mute/deafen flags changed.
VoiceFlagsChanged = "voice_flags_changed" => 14,
/// A reminder was created, edited or removed.
ReminderChanged = "reminder_changed" => 15,
/// A scheduled message changed.
ScheduledChanged = "scheduled_changed" => 16,
/// A thread read cursor moved.
ThreadReadMoved = "thread_read_moved" => 17,
/// A DM call rang the member loudly (`entity_id` = the call id, `ref_id` = the
/// call-record message). Read only by the mgmt person notification feed; the client
/// change feed never returns it.
CallRinging = "call_ringing" => 18,
/// A Space the member is in went private or public (`entity_id` = the Space);
/// the client reads the Space again.
SpaceUpdated = "space_updated" => 19,
/// A person acked a channel or DM (`entity_id` = the channel, `ref_id` = their read
/// position then). Coalesced; read only by the mgmt person notification feed (a `read`
/// item); the client change feed never returns it.
ReadMarker = "read_marker" => 20,
/// A person acked a thread (`entity_id` = the root, `ref_id` = their thread read
/// position then). Coalesced; read only by the mgmt person notification feed (a `read`
/// item with `thread_root_id`); the client change feed never returns it.
ThreadReadMarker = "thread_read_marker" => 21,
/// A loud DM ring of the member stopped without being missed: answered, declined or
/// the call cancelled (`entity_id` = the call id, `ref_id` = the call-record message).
/// Read only by the mgmt person notification feed (`call_ring_stopped`); the client
/// change feed never returns it.
CallRingStopped = "call_ring_stopped" => 22,
/// A voice room the member gets pushes for came alive (`entity_id` = the voice
/// channel, `ref_id` = the room session). Read only by the mgmt person notification
/// feed (`voice_started`); the client change feed never returns it.
VoiceStarted = "voice_started" => 23,
/// The `voice_started` push of a room no longer applies: the session ended, or the
/// member joined the room (`entity_id` = the voice channel, `ref_id` = the room
/// session). Read only by the mgmt person notification feed (`voice_ended`); the
/// client change feed never returns it.
VoiceEnded = "voice_ended" => 24,
/// A member in a voice room invited this member in, loudly (`entity_id` = the invite,
/// `ref_id` = the voice channel). Read only by the mgmt person notification feed
/// (`voice_invite`); the client change feed never returns it.
VoiceInvited = "voice_invited" => 25,
/// A loud voice invite of this member stopped: accepted, declined, cancelled, expired,
/// the inviter left, the room ended or the invite was revoked (`entity_id` = the
/// invite, `ref_id` = the voice channel). Read only by the mgmt person notification
/// feed (`voice_invite_stopped`); the client change feed never returns it.
VoiceInviteStopped = "voice_invite_stopped" => 26,
}
}
coded_enum! {
/// Why a member was notified; stored in `member_changes.entity_id` for kind `notification`.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize, JsonSchema)]
pub enum NotificationReason {
/// A direct `@member` mention.
Mention = "mention" => 1,
/// A role mention.
RoleMention = "role_mention" => 2,
/// A user-group mention.
GroupMention = "group_mention" => 3,
/// `@channel` (or an alias).
ChannelMention = "channel_mention" => 4,
/// `@here`.
HereMention = "here_mention" => 5,
/// A DM or group DM message.
Dm = "dm" => 6,
/// A reply in a followed thread.
ThreadReply = "thread_reply" => 7,
/// A keyword match.
Keyword = "keyword" => 8,
/// Notify-on-all-messages.
AllMessages = "all_messages" => 9,
/// A reminder came due.
Reminder = "reminder" => 10,
/// A missed DM call.
CallMissed = "call_missed" => 11,
/// A call transcript is ready.
TranscriptReady = "transcript_ready" => 12,
/// An inline reply (a `reply` reference, not a quote or a forward) to one of the
/// member's messages. People only.
InlineReply = "inline_reply" => 13,
}
}