Skip to content

Commit 7d43a47

Browse files
chrisbobbegnprice
authored andcommitted
api: Add channelFolders to initial snapshot
1 parent 4c093de commit 7d43a47

File tree

5 files changed

+65
-0
lines changed

5 files changed

+65
-0
lines changed

lib/api/model/initial_snapshot.dart

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

5353
final List<Subscription> subscriptions;
5454

55+
final List<ChannelFolder>? channelFolders; // TODO(server-11)
56+
5557
final UnreadMessagesSnapshot unreadMsgs;
5658

5759
final List<ZulipStream> streams;
@@ -168,6 +170,7 @@ class InitialSnapshot {
168170
required this.recentPrivateConversations,
169171
required this.savedSnippets,
170172
required this.subscriptions,
173+
required this.channelFolders,
171174
required this.unreadMsgs,
172175
required this.streams,
173176
required this.userStatuses,

lib/api/model/initial_snapshot.g.dart

Lines changed: 4 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: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -839,6 +839,38 @@ class Subscription extends ZulipStream {
839839
Map<String, dynamic> toJson() => _$SubscriptionToJson(this);
840840
}
841841

842+
/// As in `channel_folders` in the initial snapshot.
843+
///
844+
/// For docs, search for "channel_folders:"
845+
/// in <https://zulip.com/api/register-queue>.
846+
@JsonSerializable(fieldRename: FieldRename.snake)
847+
class ChannelFolder {
848+
final int id;
849+
final String name;
850+
final int? order; // TODO(server-11); added in a later FL than the rest
851+
final int? dateCreated;
852+
final int? creatorId;
853+
final String description;
854+
final String renderedDescription;
855+
final bool isArchived;
856+
857+
ChannelFolder({
858+
required this.id,
859+
required this.name,
860+
required this.order,
861+
required this.dateCreated,
862+
required this.creatorId,
863+
required this.description,
864+
required this.renderedDescription,
865+
required this.isArchived,
866+
});
867+
868+
factory ChannelFolder.fromJson(Map<String, dynamic> json) =>
869+
_$ChannelFolderFromJson(json);
870+
871+
Map<String, dynamic> toJson() => _$ChannelFolderToJson(this);
872+
}
873+
842874
@JsonEnum(fieldRename: FieldRename.snake, valueField: "apiValue")
843875
enum UserTopicVisibilityPolicy {
844876
none(apiValue: 0),

lib/api/model/model.g.dart

Lines changed: 24 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
@@ -1276,6 +1276,7 @@ InitialSnapshot initialSnapshot({
12761276
List<RecentDmConversation>? recentPrivateConversations,
12771277
List<SavedSnippet>? savedSnippets,
12781278
List<Subscription>? subscriptions,
1279+
List<ChannelFolder>? channelFolders,
12791280
UnreadMessagesSnapshot? unreadMsgs,
12801281
List<ZulipStream>? streams,
12811282
Map<int, UserStatusChange>? userStatuses,
@@ -1332,6 +1333,7 @@ InitialSnapshot initialSnapshot({
13321333
recentPrivateConversations: recentPrivateConversations ?? [],
13331334
savedSnippets: savedSnippets ?? [],
13341335
subscriptions: subscriptions ?? [], // TODO add subscriptions to default
1336+
channelFolders: channelFolders ?? [],
13351337
unreadMsgs: unreadMsgs ?? _unreadMsgs(),
13361338
streams: streams ?? [], // TODO add streams to default
13371339
userStatuses: userStatuses ?? {},

0 commit comments

Comments
 (0)