@@ -22,7 +22,18 @@ class APIMagazineModeration {
2222 throw Exception ('List banned users not allowed on lemmy' );
2323
2424 case ServerSoftware .piefed:
25- throw UnimplementedError ();
25+ final path = '/community/moderate/bans' ;
26+
27+ final page_ = page ?? 1 ;
28+
29+ final query = {
30+ 'community_id' : magazineId.toString (),
31+ 'page' : page_.toString (),
32+ };
33+
34+ final response = await client.get (path, queryParams: query);
35+
36+ return MagazineBanListModel .fromPiefed (response.bodyJson);
2637 }
2738 }
2839
@@ -47,7 +58,17 @@ class APIMagazineModeration {
4758 throw Exception ('Ban update not implemented on Lemmy yet' );
4859
4960 case ServerSoftware .piefed:
50- throw UnimplementedError ();
61+ final path = '/community/moderate/ban' ;
62+ final body = {
63+ 'community_id' : magazineId,
64+ 'user_id' : userId,
65+ 'reason' : reason,
66+ 'expiredAt' : expiredAt? .toIso8601String (),
67+ };
68+
69+ final response = await client.post (path, body: body);
70+
71+ return MagazineBanModel .fromPiefed (response.bodyJson);
5172 }
5273 }
5374
@@ -64,7 +85,13 @@ class APIMagazineModeration {
6485 throw Exception ('Ban update not implemented on Lemmy yet' );
6586
6687 case ServerSoftware .piefed:
67- throw UnimplementedError ();
88+ final path = '/community/moderate/unban' ;
89+
90+ final body = {'community_id' : magazineId, 'user_id' : userId};
91+
92+ final response = await client.put (path, body: body);
93+
94+ return MagazineBanModel .fromPiefed (response.bodyJson);
6895 }
6996 }
7097
0 commit comments