import 'package:isekai_wiki/api/response/watch.dart'; import 'mw_api.dart'; class MWApiWatch { static Future>> watchPage( {List? titles, List? pageIds, bool unwatch = false}) async { Map query = {}; if (titles != null) { query["titles"] = titles.join("|"); } if (pageIds != null) { query["pageids"] = pageIds.join("|"); } if (unwatch) { query["unwatch"] = "1"; } var mwRes = await MWApi.post("watch", params: query, withToken: "watch", returnRoot: true); var data = WatchActionResponse.fromJson(mwRes.data); return mwRes.replaceData(data.watch); } static Future>> unwatchPage( {List? titles, List? pageIds, bool unwatch = false}) { return watchPage(titles: titles, pageIds: pageIds, unwatch: true); } }