markChapterRead method

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

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

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

Implementation

@Deprecated('Use [markChapterReadOrUnread] instead')
Future<Result> markChapterRead(String sessionToken, String chapterId) async {
  var unencodedPath = '/chapter/$chapterId/read';
  final uri = 'https://$AUTHORITY$unencodedPath';
  var response = await http.post(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));
  }
}