Skip to content

Commit 8d3df22

Browse files
committed
api: Add InitialSnapshot.realmTopicsPolicy
1 parent ed95f61 commit 8d3df22

File tree

3 files changed

+33
-0
lines changed

3 files changed

+33
-0
lines changed

lib/api/model/initial_snapshot.dart

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@ class InitialSnapshot {
9090
/// Search for "realm_wildcard_mention_policy" in https://zulip.com/api/register-queue.
9191
final RealmWildcardMentionPolicy realmWildcardMentionPolicy;
9292

93+
final RealmTopicsPolicy? realmTopicsPolicy; // TODO(server-11)
94+
9395
final bool realmMandatoryTopics;
9496

9597
final String realmName;
@@ -183,6 +185,7 @@ class InitialSnapshot {
183185
required this.realmCanDeleteOwnMessageGroup,
184186
required this.realmDeleteOwnMessagePolicy,
185187
required this.realmWildcardMentionPolicy,
188+
required this.realmTopicsPolicy,
186189
required this.realmMandatoryTopics,
187190
required this.realmName,
188191
required this.realmWaitingPeriodThreshold,
@@ -238,6 +241,23 @@ enum RealmDeleteOwnMessagePolicy {
238241
int toJson() => apiValue;
239242
}
240243

244+
/// A value of [InitialSnapshot.realmTopicsPolicy].
245+
///
246+
/// For docs, search for "realm_topics_policy"
247+
/// in <https://zulip.com/api/register-queue#response>.
248+
@JsonEnum(fieldRename: FieldRename.snake, valueField: 'apiValue')
249+
enum RealmTopicsPolicy {
250+
allowEmptyTopic(apiValue: 'allow_empty_topic'),
251+
disableEmptyTopic(apiValue: 'disable_empty_topic'),
252+
unknown(apiValue: null);
253+
254+
const RealmTopicsPolicy({required this.apiValue});
255+
256+
final String? apiValue;
257+
258+
String? toJson() => apiValue;
259+
}
260+
241261
/// An item in `realm_default_external_accounts`.
242262
///
243263
/// For docs, search for "realm_default_external_accounts:"

lib/api/model/initial_snapshot.g.dart

Lines changed: 11 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
@@ -1335,6 +1335,7 @@ InitialSnapshot initialSnapshot({
13351335
GroupSettingValue? realmCanDeleteOwnMessageGroup,
13361336
RealmDeleteOwnMessagePolicy? realmDeleteOwnMessagePolicy,
13371337
RealmWildcardMentionPolicy? realmWildcardMentionPolicy,
1338+
RealmTopicsPolicy? realmTopicsPolicy,
13381339
bool? realmMandatoryTopics,
13391340
String? realmName,
13401341
int? realmWaitingPeriodThreshold,
@@ -1399,6 +1400,7 @@ InitialSnapshot initialSnapshot({
13991400
realmCanDeleteOwnMessageGroup: realmCanDeleteOwnMessageGroup,
14001401
realmDeleteOwnMessagePolicy: realmDeleteOwnMessagePolicy,
14011402
realmWildcardMentionPolicy: realmWildcardMentionPolicy ?? RealmWildcardMentionPolicy.everyone,
1403+
realmTopicsPolicy: realmTopicsPolicy ?? RealmTopicsPolicy.allowEmptyTopic,
14021404
realmMandatoryTopics: realmMandatoryTopics ?? true,
14031405
realmName: realmName ?? 'Example Zulip organization',
14041406
realmWaitingPeriodThreshold: realmWaitingPeriodThreshold ?? 0,

0 commit comments

Comments
 (0)