View a user's public bookmarks

This commit is contained in:
wgh19
2024-05-17 09:26:42 +08:00
parent dde518ab6b
commit 8ff269c8a8
2 changed files with 55 additions and 9 deletions

View File

@@ -233,6 +233,18 @@ class Network {
}
}
Future<Res<List<Illust>>> getUserBookmarks(String uid, [String? nextUrl]) async {
var res = await apiGet(nextUrl ??
"/v1/user/bookmarks/illust?user_id=$uid&restrict=public");
if (res.success) {
return Res(
(res.data["illusts"] as List).map((e) => Illust.fromJson(e)).toList(),
subData: res.data["next_url"]);
} else {
return Res.error(res.errorMessage);
}
}
Future<Res<bool>> addBookmark(String id, String method,
[String type = "public"]) async {
var res = method == "add"