Skip to content

Commit 63b5b83

Browse files
committed
initial_snapshot: Add channelFolders
1 parent 38a2c63 commit 63b5b83

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
@@ -56,6 +56,8 @@ class InitialSnapshot {
5656

5757
final UnreadMessagesSnapshot unreadMsgs;
5858

59+
final List<ChannelFolder>? channelFolders;
60+
5961
final List<ZulipStream> streams;
6062

6163
// In register-queue, the name of this field is the singular "user_status",
@@ -166,6 +168,7 @@ class InitialSnapshot {
166168
required this.recentPrivateConversations,
167169
required this.savedSnippets,
168170
required this.subscriptions,
171+
required this.channelFolders,
169172
required this.unreadMsgs,
170173
required this.streams,
171174
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
@@ -841,6 +841,38 @@ class Subscription extends ZulipStream {
841841
Map<String, dynamic> toJson() => _$SubscriptionToJson(this);
842842
}
843843

844+
/// As in `channel_folders` in the initial snapshot.
845+
///
846+
/// For docs, search for "channel_folders:"
847+
/// in <https://zulip.com/api/register-queue>.
848+
@JsonSerializable(fieldRename: FieldRename.snake)
849+
class ChannelFolder {
850+
final int id;
851+
final String name;
852+
final int? order; // TODO(server-11); added in a later FL than the rest
853+
final int? dateCreated;
854+
final int? creatorId;
855+
final String description;
856+
final String renderedDescription;
857+
final bool isArchived;
858+
859+
ChannelFolder({
860+
required this.id,
861+
required this.name,
862+
required this.order,
863+
required this.dateCreated,
864+
required this.creatorId,
865+
required this.description,
866+
required this.renderedDescription,
867+
required this.isArchived,
868+
});
869+
870+
factory ChannelFolder.fromJson(Map<String, dynamic> json) =>
871+
_$ChannelFolderFromJson(json);
872+
873+
Map<String, dynamic> toJson() => _$ChannelFolderToJson(this);
874+
}
875+
844876
@JsonEnum(fieldRename: FieldRename.snake, valueField: "apiValue")
845877
enum UserTopicVisibilityPolicy {
846878
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
@@ -1271,6 +1271,7 @@ InitialSnapshot initialSnapshot({
12711271
List<RecentDmConversation>? recentPrivateConversations,
12721272
List<SavedSnippet>? savedSnippets,
12731273
List<Subscription>? subscriptions,
1274+
List<ChannelFolder>? channelFolders,
12741275
UnreadMessagesSnapshot? unreadMsgs,
12751276
List<ZulipStream>? streams,
12761277
Map<int, UserStatusChange>? userStatuses,
@@ -1325,6 +1326,7 @@ InitialSnapshot initialSnapshot({
13251326
recentPrivateConversations: recentPrivateConversations ?? [],
13261327
savedSnippets: savedSnippets ?? [],
13271328
subscriptions: subscriptions ?? [], // TODO add subscriptions to default
1329+
channelFolders: channelFolders ?? [],
13281330
unreadMsgs: unreadMsgs ?? _unreadMsgs(),
13291331
streams: streams ?? [], // TODO add streams to default
13301332
userStatuses: userStatuses ?? {},

0 commit comments

Comments
 (0)