getAllReadChapters method

Future<ReadChapters> getAllReadChapters(
  1. String sessionToken,
  2. String mangaId
)
inherited

Returns a ReadChapters class instance containing details of all read chapters of a manga

Implementation

Future<ReadChapters> getAllReadChapters(
    String sessionToken, String mangaId) async {
  var unencodedPath = '/manga/$mangaId/read';
  final uri = 'https://$AUTHORITY$unencodedPath?';

  var response = await http.get(Uri.parse(uri), headers: {
    HttpHeaders.contentTypeHeader: 'application/json',
    HttpHeaders.authorizationHeader: 'Bearer $sessionToken'
  });
  try {
    return ReadChapters.fromJson(jsonDecode(response.body));
  } on Exception {
    throw MangadexServerException(jsonDecode(response.body));
  }
}