getChapters method

Future<ChapterData> getChapters(
  1. String mangaId, {
  2. List<String>? ids,
  3. String? title,
  4. List<String>? groups,
  5. String? uploader,
  6. String? volume,
  7. String? chapter,
  8. List<LanguageCodes>? translatedLanguage,
  9. List<LanguageCodes>? originalLanguage,
  10. List<LanguageCodes>? excludedOriginalLanguage,
  11. List<ContentRating>? contentRating,
  12. String? createdAtSince,
  13. String? updatedAtSince,
  14. String? publishedAtSince,
  15. String? includes,
  16. Map<ChapterOrders, OrderDirections>? orders,
  17. int? limit,
  18. int? offset,
})
inherited

Endpoint used: GET /chapter

gets limit number of chapters and their data for the given mangaId or uuid, mangas can be filtered by their groups, uploader, volume, or chapter.

They can also be filtered by their translatedLanguage, originalLanguage, excludedOriginalLanguage, and even their contentRating or by date with createdAtSince, updatedAtSince, publishedAtSince parameters.

Returns the manga data in a ChapterData class instance.

Implementation

Future<ChapterData> getChapters(String mangaId,
    {List<String>? ids,
    String? title,
    List<String>? groups,
    String? uploader,
    String? volume,
    String? chapter,
    List<LanguageCodes>? translatedLanguage,
    List<LanguageCodes>? originalLanguage,
    List<LanguageCodes>? excludedOriginalLanguage,
    List<ContentRating>? contentRating,
    String? createdAtSince,
    String? updatedAtSince,
    String? publishedAtSince,
    String? includes,
    Map<ChapterOrders, OrderDirections>? orders,
    int? limit,
    int? offset}) async {
  var _chapterOffset = offset ?? 0;
  var _ChapterLimit = limit ?? 10;
  var response = await getChaptersResponse(
    mangaId,
    offset: _chapterOffset,
    limit: _ChapterLimit,
    ids: ids,
    title: title,
    groups: groups,
    uploader: uploader,
    volume: volume,
    chapter: chapter,
    translatedLanguage: translatedLanguage,
    originalLanguage: originalLanguage,
    excludedOriginalLanguage: excludedOriginalLanguage,
    contentRating: contentRating,
    createdAtSince: createdAtSince,
    updatedAtSince: updatedAtSince,
    publishedAtSince: publishedAtSince,
    orders: orders,
  );
  try {
    return ChapterData.fromJson(jsonDecode(response.body));
  } catch (e) {
    throw MangadexServerException(jsonDecode(response.body));
  }
}