@@ -28,6 +28,8 @@ class InitialSnapshot {
28
28
29
29
final List <Subscription > subscriptions;
30
30
31
+ final UnreadMessagesSnapshot unreadMsgs;
32
+
31
33
final List <ZulipStream > streams;
32
34
33
35
final int maxFileUploadSizeMib;
@@ -70,6 +72,7 @@ class InitialSnapshot {
70
72
required this .customProfileFields,
71
73
required this .recentPrivateConversations,
72
74
required this .subscriptions,
75
+ required this .unreadMsgs,
73
76
required this .streams,
74
77
required this .maxFileUploadSizeMib,
75
78
required this .realmUsers,
@@ -102,3 +105,98 @@ class RecentDmConversation {
102
105
103
106
Map <String , dynamic > toJson () => _$RecentDmConversationToJson (this );
104
107
}
108
+
109
+ /// The `unread_msgs` snapshot.
110
+ ///
111
+ /// For docs, search for "unread_msgs:"
112
+ /// in <https://zulip.com/api/register-queue>.
113
+ @JsonSerializable (fieldRename: FieldRename .snake)
114
+ class UnreadMessagesSnapshot {
115
+ final int count;
116
+
117
+ @JsonKey (name: 'pms' )
118
+ final List <UnreadDmSnapshot > dms;
119
+
120
+ final List <UnreadStreamSnapshot > streams;
121
+ final List <UnreadHuddleSnapshot > huddles;
122
+ final List <int > mentions;
123
+ final bool oldUnreadsMissing;
124
+
125
+ UnreadMessagesSnapshot ({
126
+ required this .count,
127
+ required this .dms,
128
+ required this .streams,
129
+ required this .huddles,
130
+ required this .mentions,
131
+ required this .oldUnreadsMissing,
132
+ });
133
+
134
+ factory UnreadMessagesSnapshot .fromJson (Map <String , dynamic > json) =>
135
+ _$UnreadMessagesSnapshotFromJson (json);
136
+
137
+ Map <String , dynamic > toJson () => _$UnreadMessagesSnapshotToJson (this );
138
+ }
139
+
140
+ /// An item in `unread_msgs.pms` .
141
+ ///
142
+ /// For docs, search for "unread_msgs:" and see "pms:"
143
+ /// in <https://zulip.com/api/register-queue>.
144
+ @JsonSerializable (fieldRename: FieldRename .snake)
145
+ class UnreadDmSnapshot {
146
+ final int otherUserId;
147
+ // final int senderId; // deprecated; ignore
148
+ final List <int > unreadMessageIds;
149
+
150
+ UnreadDmSnapshot ({
151
+ required this .otherUserId,
152
+ required this .unreadMessageIds,
153
+ });
154
+
155
+ factory UnreadDmSnapshot .fromJson (Map <String , dynamic > json) =>
156
+ _$UnreadDmSnapshotFromJson (json);
157
+
158
+ Map <String , dynamic > toJson () => _$UnreadDmSnapshotToJson (this );
159
+ }
160
+
161
+ /// An item in `unread_msgs.streams` .
162
+ ///
163
+ /// For docs, search for "unread_msgs:" and see "streams:"
164
+ /// in <https://zulip.com/api/register-queue>.
165
+ @JsonSerializable (fieldRename: FieldRename .snake)
166
+ class UnreadStreamSnapshot {
167
+ final String topic;
168
+ final int streamId;
169
+ final List <int > unreadMessageIds;
170
+ // final List<int> senderIds; // deprecated; ignore
171
+
172
+ UnreadStreamSnapshot ({
173
+ required this .topic,
174
+ required this .streamId,
175
+ required this .unreadMessageIds,
176
+ });
177
+
178
+ factory UnreadStreamSnapshot .fromJson (Map <String , dynamic > json) =>
179
+ _$UnreadStreamSnapshotFromJson (json);
180
+
181
+ Map <String , dynamic > toJson () => _$UnreadStreamSnapshotToJson (this );
182
+ }
183
+
184
+ /// An item in `unread_msgs.huddles` .
185
+ ///
186
+ /// For docs, search for "unread_msgs:" and see "huddles:"
187
+ /// in <https://zulip.com/api/register-queue>.
188
+ @JsonSerializable (fieldRename: FieldRename .snake)
189
+ class UnreadHuddleSnapshot {
190
+ final String userIdsString;
191
+ final List <int > unreadMessageIds;
192
+
193
+ UnreadHuddleSnapshot ({
194
+ required this .userIdsString,
195
+ required this .unreadMessageIds,
196
+ });
197
+
198
+ factory UnreadHuddleSnapshot .fromJson (Map <String , dynamic > json) =>
199
+ _$UnreadHuddleSnapshotFromJson (json);
200
+
201
+ Map <String , dynamic > toJson () => _$UnreadHuddleSnapshotToJson (this );
202
+ }
0 commit comments