@@ -249,8 +249,8 @@ class ZulipStream {
249
249
final bool historyPublicToSubscribers;
250
250
final int ? messageRetentionDays;
251
251
252
- final int streamPostPolicy; // TODO enum
253
- // final bool isAnnouncementOnly; // deprecated; ignore
252
+ final StreamPostPolicy streamPostPolicy;
253
+ // final bool isAnnouncementOnly; // deprecated for `streamPostPolicy` ; ignore
254
254
255
255
final int ? canRemoveSubscribersGroupId; // TODO(server-6)
256
256
@@ -275,6 +275,27 @@ class ZulipStream {
275
275
Map <String , dynamic > toJson () => _$ZulipStreamToJson (this );
276
276
}
277
277
278
+ /// Policy for which users can post to the stream.
279
+ ///
280
+ /// For docs, search for "stream_post_policy"
281
+ /// in <https://zulip.com/api/get-stream-by-id>
282
+ @JsonEnum (valueField: 'apiValue' )
283
+ enum StreamPostPolicy {
284
+ any (apiValue: 1 ),
285
+ administrators (apiValue: 2 ),
286
+ fullMembers (apiValue: 3 ),
287
+ moderators (apiValue: 4 ),
288
+ unknown (apiValue: null );
289
+
290
+ const StreamPostPolicy ({
291
+ required this .apiValue,
292
+ });
293
+
294
+ final int ? apiValue;
295
+
296
+ int ? toJson () => apiValue;
297
+ }
298
+
278
299
/// As in `subscriptions` in the initial snapshot.
279
300
///
280
301
/// For docs, search for "subscriptions:"
@@ -299,8 +320,8 @@ class Subscription {
299
320
final int ? messageRetentionDays;
300
321
// final List<int> subscribers; // we register with includeSubscribers false
301
322
302
- final int streamPostPolicy; // TODO enum
303
- // final bool? isAnnouncementOnly; // deprecated; ignore
323
+ final StreamPostPolicy streamPostPolicy;
324
+ // final bool? isAnnouncementOnly; // deprecated for `streamPostPolicy` ; ignore
304
325
final String emailAddress;
305
326
306
327
final int ? canRemoveSubscribersGroupId; // TODO(server-6)
0 commit comments