Skip to content

Commit 1ee4bb6

Browse files
committed
api [nfc]: Put ChannelPropertyName right after ZulipStream
This helps make it easy to compare the class's fields to the enum's values and look for any discrepancies.
1 parent 2f0aac5 commit 1ee4bb6

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

lib/api/model/model.dart

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -363,32 +363,6 @@ class ZulipStream {
363363
Map<String, dynamic> toJson() => _$ZulipStreamToJson(this);
364364
}
365365

366-
/// Policy for which users can post to the stream.
367-
///
368-
/// For docs, search for "stream_post_policy"
369-
/// in <https://zulip.com/api/get-stream-by-id>
370-
@JsonEnum(valueField: 'apiValue')
371-
enum ChannelPostPolicy {
372-
any(apiValue: 1),
373-
administrators(apiValue: 2),
374-
fullMembers(apiValue: 3),
375-
moderators(apiValue: 4),
376-
unknown(apiValue: null);
377-
378-
const ChannelPostPolicy({
379-
required this.apiValue,
380-
});
381-
382-
final int? apiValue;
383-
384-
int? toJson() => apiValue;
385-
386-
static ChannelPostPolicy fromApiValue(int value) => _byApiValue[value]!;
387-
388-
static final _byApiValue = _$ChannelPostPolicyEnumMap
389-
.map((key, value) => MapEntry(value, key));
390-
}
391-
392366
/// The name of a property of [ZulipStream] that gets updated
393367
/// through [ChannelUpdateEvent.property].
394368
///
@@ -429,6 +403,32 @@ enum ChannelPropertyName {
429403
.map((key, value) => MapEntry(value, key));
430404
}
431405

406+
/// Policy for which users can post to the stream.
407+
///
408+
/// For docs, search for "stream_post_policy"
409+
/// in <https://zulip.com/api/get-stream-by-id>
410+
@JsonEnum(valueField: 'apiValue')
411+
enum ChannelPostPolicy {
412+
any(apiValue: 1),
413+
administrators(apiValue: 2),
414+
fullMembers(apiValue: 3),
415+
moderators(apiValue: 4),
416+
unknown(apiValue: null);
417+
418+
const ChannelPostPolicy({
419+
required this.apiValue,
420+
});
421+
422+
final int? apiValue;
423+
424+
int? toJson() => apiValue;
425+
426+
static ChannelPostPolicy fromApiValue(int value) => _byApiValue[value]!;
427+
428+
static final _byApiValue = _$ChannelPostPolicyEnumMap
429+
.map((key, value) => MapEntry(value, key));
430+
}
431+
432432
/// As in `subscriptions` in the initial snapshot.
433433
///
434434
/// For docs, search for "subscriptions:"

0 commit comments

Comments
 (0)