getChaptersResponse method
Future<Response>
getChaptersResponse(
- 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
Returns the http response of a list of chapters for mangaId
Implementation
Future<http.Response> getChaptersResponse(
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 unencodedPath = '/chapter';
var _mangaId = mangaId;
var _limit = limit != null ? '&limit=$limit' : '&limit=10';
var _offset = offset != null ? '&offset=$offset' : '&offset=0';
var _ids = '';
if (ids != null) {
ids.forEach((element) {
_ids = _ids + '&ids[]=$element';
});
}
var _title = title != null ? '&title=$title' : '';
var _groups = '';
if (groups != null) {
groups.forEach((element) {
_groups = _groups + '&groups[]=$element';
});
}
var _uploader = uploader != null ? '&uploader=$uploader' : '';
var _volume = volume != null ? '&volume=$volume' : '';
var _chapter = chapter != null ? '&chapter=$chapter' : '';
var _translatedLanguage = '';
if (translatedLanguage != null) {
translatedLanguage.forEach((element) {
_translatedLanguage = _translatedLanguage +
'&translatedLanguage[]=${EnumUtils.parseLanguageCodeFromEnum(element)}';
});
}
var _originalLanguage = '';
if (originalLanguage != null) {
originalLanguage.forEach((element) {
_originalLanguage = _originalLanguage +
'&originalLanguage[]=${EnumUtils.parseLanguageCodeFromEnum(element)}';
});
}
var _excludedOriginalLanguage = '';
if (excludedOriginalLanguage != null) {
excludedOriginalLanguage.forEach((element) {
_excludedOriginalLanguage = _excludedOriginalLanguage +
'&excludedOriginalLanguage[]=${EnumUtils.parseLanguageCodeFromEnum(element)}';
});
}
var _contentrating = '';
if (contentRating != null) {
contentRating.forEach((element) {
_contentrating = _contentrating +
'&contentRating[]=${EnumUtils.parseContentRatingFromEnum(element)}';
});
}
var _createdAtSince =
createdAtSince != null ? '&createdAtSince=$createdAtSince' : '';
var _updatedAtSince =
updatedAtSince != null ? '&updatedAtSince=$updatedAtSince' : '';
var _publishedAtSince =
publishedAtSince != null ? '&publishedAtSince=$publishedAtSince' : '';
var _includes = includes != null ? '&includes[]=$includes' : '';
var _order = '';
if (orders != null) {
orders.entries.forEach((element) {
_order = _order +
'&order[${EnumUtils.parseChapterOrdersFromEnum(element.key)}]=${EnumUtils.parseOrderDirectionFromEnum(element.value)}';
});
}
final url =
'https://$AUTHORITY$unencodedPath?&manga=$_mangaId$_limit$_offset$_ids$_title$_groups$_uploader$_volume$_chapter$_translatedLanguage$_createdAtSince$_updatedAtSince$_publishedAtSince$_includes';
var response = await http.get(Uri.parse(url),
headers: {HttpHeaders.contentTypeHeader: 'application/json'});
return response;
}