Skip to content

Commit e5f703a

Browse files
PIG208gnprice
authored andcommitted
api: Add savedSnippets to initial snapshot
1 parent 15f3f59 commit e5f703a

File tree

5 files changed

+49
-0
lines changed

5 files changed

+49
-0
lines changed

lib/api/model/initial_snapshot.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,8 @@ class InitialSnapshot {
4848

4949
final List<RecentDmConversation> recentPrivateConversations;
5050

51+
final List<SavedSnippet>? savedSnippets; // TODO(server-10)
52+
5153
final List<Subscription> subscriptions;
5254

5355
final UnreadMessagesSnapshot unreadMsgs;
@@ -132,6 +134,7 @@ class InitialSnapshot {
132134
required this.serverTypingStartedWaitPeriodMilliseconds,
133135
required this.realmEmoji,
134136
required this.recentPrivateConversations,
137+
required this.savedSnippets,
135138
required this.subscriptions,
136139
required this.unreadMsgs,
137140
required this.streams,

lib/api/model/initial_snapshot.g.dart

Lines changed: 5 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/api/model/model.dart

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -311,6 +311,30 @@ enum UserRole{
311311
}
312312
}
313313

314+
/// An item in `saved_snippets` from the initial snapshot.
315+
///
316+
/// For docs, search for "saved_snippets:"
317+
/// in <https://zulip.com/api/register-queue>.
318+
@JsonSerializable(fieldRename: FieldRename.snake)
319+
class SavedSnippet {
320+
SavedSnippet({
321+
required this.id,
322+
required this.title,
323+
required this.content,
324+
required this.dateCreated,
325+
});
326+
327+
final int id;
328+
final String title;
329+
final String content;
330+
final int dateCreated;
331+
332+
factory SavedSnippet.fromJson(Map<String, Object?> json) =>
333+
_$SavedSnippetFromJson(json);
334+
335+
Map<String, dynamic> toJson() => _$SavedSnippetToJson(this);
336+
}
337+
314338
/// As in `streams` in the initial snapshot.
315339
///
316340
/// Not called `Stream` because dart:async uses that name.

lib/api/model/model.g.dart

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/example_data.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -959,6 +959,7 @@ InitialSnapshot initialSnapshot({
959959
int? serverTypingStartedWaitPeriodMilliseconds,
960960
Map<String, RealmEmojiItem>? realmEmoji,
961961
List<RecentDmConversation>? recentPrivateConversations,
962+
List<SavedSnippet>? savedSnippets,
962963
List<Subscription>? subscriptions,
963964
UnreadMessagesSnapshot? unreadMsgs,
964965
List<ZulipStream>? streams,
@@ -994,6 +995,7 @@ InitialSnapshot initialSnapshot({
994995
serverTypingStartedWaitPeriodMilliseconds ?? 10000,
995996
realmEmoji: realmEmoji ?? {},
996997
recentPrivateConversations: recentPrivateConversations ?? [],
998+
savedSnippets: savedSnippets ?? [],
997999
subscriptions: subscriptions ?? [], // TODO add subscriptions to default
9981000
unreadMsgs: unreadMsgs ?? _unreadMsgs(),
9991001
streams: streams ?? [], // TODO add streams to default

0 commit comments

Comments
 (0)