Skip to content

Commit c055372

Browse files
committed
api: Add realmDefaultExtrenalAccounts
1 parent 760aa9e commit c055372

File tree

3 files changed

+53
-0
lines changed

3 files changed

+53
-0
lines changed

lib/api/model/initial_snapshot.dart

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ class InitialSnapshot {
3939
// TODO(server-5) remove pre-5.0 comment
4040
final UserSettings? userSettings; // TODO(server-5)
4141

42+
final Map<String, RealmDefaultExternalAccount> realmDefaultExternalAccounts;
43+
4244
final int maxFileUploadSizeMib;
4345

4446
@JsonKey(readValue: _readUsersIsActiveFallbackTrue)
@@ -76,6 +78,7 @@ class InitialSnapshot {
7678
required this.zulipVersion,
7779
this.zulipMergeBase,
7880
required this.alertWords,
81+
required this.realmDefaultExternalAccounts,
7982
required this.customProfileFields,
8083
required this.recentPrivateConversations,
8184
required this.subscriptions,
@@ -94,6 +97,30 @@ class InitialSnapshot {
9497
Map<String, dynamic> toJson() => _$InitialSnapshotToJson(this);
9598
}
9699

100+
/// An item in `realm_default_external_accounts`.
101+
///
102+
/// For docs, search for "realm_default_external_accounts:"
103+
/// in <https://zulip.com/api/register-queue>.
104+
@JsonSerializable(fieldRename: FieldRename.snake)
105+
class RealmDefaultExternalAccount {
106+
final String name;
107+
final String text;
108+
final String hint;
109+
final String urlPattern;
110+
111+
RealmDefaultExternalAccount({
112+
required this.name,
113+
required this.text,
114+
required this.hint,
115+
required this.urlPattern,
116+
});
117+
118+
factory RealmDefaultExternalAccount.fromJson(Map<String, dynamic> json) =>
119+
_$RealmDefaultExternalAccountFromJson(json);
120+
121+
Map<String, dynamic> toJson() => _$RealmDefaultExternalAccountToJson(this);
122+
}
123+
97124
/// An item in `recent_private_conversations`.
98125
///
99126
/// For docs, search for "recent_private_conversations:"

lib/api/model/initial_snapshot.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.

lib/model/store.dart

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ class PerAccountStore extends ChangeNotifier {
151151
required InitialSnapshot initialSnapshot,
152152
}) : zulipVersion = initialSnapshot.zulipVersion,
153153
maxFileUploadSizeMib = initialSnapshot.maxFileUploadSizeMib,
154+
realmDefaultExternalAccounts = initialSnapshot.realmDefaultExternalAccounts,
154155
userSettings = initialSnapshot.userSettings,
155156
users = Map.fromEntries(
156157
initialSnapshot.realmUsers
@@ -172,6 +173,7 @@ class PerAccountStore extends ChangeNotifier {
172173
// Data attached to the realm or the server.
173174
final String zulipVersion; // TODO get from account; update there on initial snapshot
174175
final int maxFileUploadSizeMib; // No event for this.
176+
final Map<String, RealmDefaultExternalAccount> realmDefaultExternalAccounts;
175177

176178
// Data attached to the self-account on the realm.
177179
final UserSettings? userSettings; // TODO(server-5)

0 commit comments

Comments
 (0)