@@ -312,6 +312,14 @@ enum UserRole{
312
312
/// in <https://zulip.com/api/register-queue>.
313
313
@JsonSerializable (fieldRename: FieldRename .snake)
314
314
class ZulipStream {
315
+ // When adding a field to this class:
316
+ // * Add it to [ChannelPropertyName] too, or add a comment there explaining
317
+ // why there isn't a corresponding value in that enum.
318
+ // * If the field can never change for a given Zulip stream, mark it final.
319
+ // Otherwise, make sure it gets updated on [ChannelUpdateEvent].
320
+ // * (If it can change but [ChannelUpdateEvent] doesn't cover that,
321
+ // then that's a bug in the API; raise it in `#api design`.)
322
+
315
323
final int streamId;
316
324
String name;
317
325
String description;
@@ -369,22 +377,17 @@ class ZulipStream {
369
377
/// In Zulip event-handling code (for [ChannelUpdateEvent] ),
370
378
/// we switch exhaustively on a value of this type
371
379
/// to ensure that every property in [ZulipStream] responds to the event.
372
- ///
373
- /// Fields on [ZulipStream] not present here:
374
- /// streamId, dateCreated
375
- /// Each of those is immutable on any given channel, and there is no
376
- /// [ChannelUpdateEvent] that updates them.
377
- ///
378
- /// Other fields on [ZulipStream] not present here:
379
- /// renderedDescription, historyPublicToSubscribers, isWebPublic
380
- /// Each of those are updated through separate fields of [ChannelUpdateEvent]
381
- /// with the same names.
382
380
@JsonEnum (fieldRename: FieldRename .snake, alwaysCreate: true )
383
381
enum ChannelPropertyName {
382
+ // streamId is immutable
384
383
name,
385
384
description,
385
+ // renderedDescription is updated via its own [ChannelUpdateEvent] field
386
+ // dateCreated is immutable
386
387
firstMessageId,
387
388
inviteOnly,
389
+ // isWebPublic is updated via its own [ChannelUpdateEvent] field
390
+ // historyPublicToSubscribers is updated via its own [ChannelUpdateEvent] field
388
391
messageRetentionDays,
389
392
@JsonValue ('stream_post_policy' )
390
393
channelPostPolicy,
0 commit comments