getChapters method
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,
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));
}
}