Skip to content

Commit 8e82e9e

Browse files
committed
channel_list: Setup unsubscribeFromChannels api binding
1 parent 14af294 commit 8e82e9e

File tree

2 files changed

+37
-0
lines changed

2 files changed

+37
-0
lines changed

lib/api/route/channel.dart

+20
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,23 @@ class SubscribeToChannelsResult {
2929
Map<String, dynamic> toJson() => _$SubscribeToChannelsResultToJson(this);
3030
}
3131

32+
Future<UnsubscribeFromChannelsResult> unsubscribeFromChannels(ApiConnection connection, List<ZulipStream> streams) {
33+
return connection.delete('unsubscribe', UnsubscribeFromChannelsResult.fromJson,
34+
'users/me/subscriptions', {'subscriptions': streams.map((e) => e.name).toList()});
35+
}
36+
37+
@JsonSerializable(fieldRename: FieldRename.snake)
38+
class UnsubscribeFromChannelsResult {
39+
final List<String>? removed;
40+
final List<String>? notRemoved;
41+
42+
UnsubscribeFromChannelsResult({
43+
required this.removed,
44+
required this.notRemoved,
45+
});
46+
47+
factory UnsubscribeFromChannelsResult.fromJson(Map<String, dynamic> json) =>
48+
_$UnsubscribeFromChannelsResultFromJson(json);
49+
50+
Map<String, dynamic> toJson() => _$UnsubscribeFromChannelsResultToJson(this);
51+
}

lib/api/route/channel.g.dart

+17
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)