markChapterUnread method

  1. @Deprecated('Use [markChapterReadOrUnread] instead')
Future<Result> markChapterUnread(
  1. String sessionToken,
  2. String chapterId
)
inherited

Mark a chapter identified by it's chapterId or uuid as UNREAD

DEPRECATION WARNING: The end point DELETE /chapter/{id}/read is deprecated as is to be removed by 2-10-2022
Which makes this function deprecated and on schedule to be removed as well.

Implementation

@Deprecated('Use [markChapterReadOrUnread] instead')
Future<Result> markChapterUnread(
    String sessionToken, String chapterId) async {
  var unencodedPath = '/chapter/$chapterId/read';
  final uri = 'https://$AUTHORITY$unencodedPath';
  var response = await http.delete(Uri.parse(uri),
      headers: {
        HttpHeaders.contentTypeHeader: 'application/json',
        HttpHeaders.authorizationHeader: 'Bearer $sessionToken'
      },
      body: jsonEncode({'id': '$chapterId'}));
  try {
    return Result.fromJson(jsonDecode(response.body));
  } on Exception {
    throw MangadexServerException(jsonDecode(response.body));
  }
}