Skip to content

Commit 488de5f

Browse files
committed
api: Change Subscription to extend from ZulipStream
1 parent 191bbc0 commit 488de5f

File tree

2 files changed

+26
-49
lines changed

2 files changed

+26
-49
lines changed

lib/api/model/model.dart

Lines changed: 15 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -312,33 +312,9 @@ enum StreamPostPolicy{
312312
/// For docs, search for "subscriptions:"
313313
/// in <https://zulip.com/api/register-queue>.
314314
@JsonSerializable(fieldRename: FieldRename.snake)
315-
class Subscription {
316-
// First, fields that are about the stream and not the user's relation to it.
317-
// These are largely the same as in [ZulipStream].
318-
319-
final int streamId;
320-
final String name;
321-
final String description;
322-
final String renderedDescription;
323-
324-
final int dateCreated;
325-
final int? firstMessageId;
326-
final int? streamWeeklyTraffic;
327-
328-
final bool inviteOnly;
329-
final bool isWebPublic;
330-
final bool historyPublicToSubscribers;
331-
final int? messageRetentionDays;
315+
class Subscription extends ZulipStream {
332316
// final List<int> subscribers; // we register with includeSubscribers false
333317

334-
final StreamPostPolicy streamPostPolicy;
335-
// final bool? isAnnouncementOnly; // deprecated for `streamPostPolicy`; ignore
336-
337-
final int? canRemoveSubscribersGroupId; // TODO(server-6)
338-
339-
// Then, fields that are specific to the subscription,
340-
// i.e. the user's relationship to the stream.
341-
342318
final bool? desktopNotifications;
343319
final bool? emailNotifications;
344320
final bool? wildcardMentionsNotify;
@@ -353,32 +329,33 @@ class Subscription {
353329
final String color;
354330

355331
Subscription({
356-
required this.streamId,
357-
required this.name,
358-
required this.description,
359-
required this.renderedDescription,
360-
required this.dateCreated,
361-
required this.inviteOnly,
332+
required super.streamId,
333+
required super.name,
334+
required super.description,
335+
required super.renderedDescription,
336+
required super.dateCreated,
337+
required super.firstMessageId,
338+
required super.inviteOnly,
339+
required super.isWebPublic,
340+
required super.historyPublicToSubscribers,
341+
required super.messageRetentionDays,
342+
required super.streamPostPolicy,
343+
required super.canRemoveSubscribersGroup,
344+
required super.streamWeeklyTraffic,
362345
required this.desktopNotifications,
363346
required this.emailNotifications,
364347
required this.wildcardMentionsNotify,
365348
required this.pushNotifications,
366349
required this.audibleNotifications,
367350
required this.pinToTop,
368351
required this.isMuted,
369-
required this.isWebPublic,
370352
required this.color,
371-
required this.streamPostPolicy,
372-
required this.messageRetentionDays,
373-
required this.historyPublicToSubscribers,
374-
required this.firstMessageId,
375-
required this.streamWeeklyTraffic,
376-
required this.canRemoveSubscribersGroupId,
377353
});
378354

379355
factory Subscription.fromJson(Map<String, dynamic> json) =>
380356
_$SubscriptionFromJson(json);
381357

358+
@override
382359
Map<String, dynamic> toJson() => _$SubscriptionToJson(this);
383360
}
384361

lib/api/model/model.g.dart

Lines changed: 11 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)