getMangaFeedResponse method
Future<Response>
getMangaFeedResponse(
- String mangaId, {
- int? limit,
- int? offset,
- List<
LanguageCodes> ? translatedLanguage, - List<
LanguageCodes> ? originalLanguage, - List<
LanguageCodes> ? excludedOriginalLanguage, - List<
ContentRating> ? contentRating, - List<
String> ? excludedGroups, - List<
String> ? excludedUploaders, - bool? includeFutureUpdates,
- String? createdAtSince,
- String? updatedAtSince,
- String? publishAtSince,
- Map<
ChapterOrders, OrderDirections> ? order, - List<
String> ? includes, - bool? includeEmptyPages,
- bool? includeFuturePublishAt,
- bool? includeExternalUrl,
inherited
Endpoint used: GET /manga/{id}/feed
Gets the feed of a give mangaId
and returns the
response body of the data received.
Implementation
Future<http.Response> getMangaFeedResponse(
String mangaId, {
int? limit,
int? offset,
List<LanguageCodes>? translatedLanguage,
List<LanguageCodes>? originalLanguage,
List<LanguageCodes>? excludedOriginalLanguage,
List<ContentRating>? contentRating,
List<String>? excludedGroups,
List<String>? excludedUploaders,
bool? includeFutureUpdates,
String? createdAtSince,
String? updatedAtSince,
String? publishAtSince,
Map<ChapterOrders, OrderDirections>? order,
List<String>? includes,
bool? includeEmptyPages,
bool? includeFuturePublishAt,
bool? includeExternalUrl,
}) async {
var _limit =
((limit ?? 100) <= 100) ? '?limit=${limit ?? 100}' : '?limit=100';
var _offset = ((offset == null) ? '' : '&offset=$offset');
var _translatedLanguage = '';
for (final lang in translatedLanguage ?? []) {
_translatedLanguage +=
'&translatedLanguage[]=${EnumUtils.parseLanguageCodeFromEnum(lang)}';
}
var _originalLanguage = '';
for (final lang in originalLanguage ?? []) {
_originalLanguage +=
'&originalLanguage[]=${EnumUtils.parseLanguageCodeFromEnum(lang)}';
}
var _excludedOriginalLanguage = '';
for (final lang in excludedOriginalLanguage ?? []) {
_excludedOriginalLanguage +=
'&excludedOriginalLanguage[]=${EnumUtils.parseLanguageCodeFromEnum(lang)}';
}
var _contentRating = '';
for (final rating in contentRating ??
[
ContentRating.safe,
ContentRating.suggestive,
ContentRating.erotica,
]) {
_contentRating +=
'&contentRating[]=${EnumUtils.parseContentRatingFromEnum(rating)}';
}
var _excludedGroups = '';
for (final group in excludedGroups ?? []) {
'&excludedGroups[]=$group';
}
var _excludedUploaders = '';
for (final group in excludedUploaders ?? []) {
'&excludedUploaders[]=$group';
}
var _createdAtSince =
createdAtSince == null ? '' : '&createdAtSince=$createdAtSince';
var _updatedAtSince =
updatedAtSince == null ? '' : '&updatedAtSince=$updatedAtSince';
var _publishAtSince =
publishAtSince == null ? '' : '&publishAtSince=$publishAtSince';
var _order = '';
(order ??
{
ChapterOrders.createdAt: OrderDirections.ascending,
ChapterOrders.updatedAt: OrderDirections.ascending,
ChapterOrders.publishAt: OrderDirections.ascending,
ChapterOrders.readableAt: OrderDirections.ascending,
ChapterOrders.volume: OrderDirections.ascending,
ChapterOrders.chapter: OrderDirections.ascending
})
.entries
.forEach((element) {
_order = _order +
'&order[${EnumUtils.parseChapterOrdersFromEnum(element.key)}]=${EnumUtils.parseOrderDirectionFromEnum(element.value)}';
});
var _includeFutureUpdates = includeFutureUpdates == null
? ''
: includeFutureUpdates
? '&includeFutureUpdates=1'
: '&includeFutureUpdates=0';
var _includeEmptyPages = includeEmptyPages == null
? ''
: includeEmptyPages
? '&includeEmptyPages=1'
: '&includeEmptyPages=0';
var _includeFuturePublishAt = includeFuturePublishAt == null
? ''
: includeFuturePublishAt
? '&includeFuturePublishAt=1'
: '&includeFuturePublishAt=0';
var _includeExternalUrl = includeExternalUrl == null
? ''
: includeExternalUrl
? '&includeExternalUrl=1'
: '&includeExternalUrl=0';
var unencodedpath = '/manga/$mangaId/feed';
var uri =
'https://$AUTHORITY$unencodedpath$_limit$_offset$_translatedLanguage$_originalLanguage$_excludedOriginalLanguage$_contentRating$_excludedGroups$_excludedUploaders$_includeFutureUpdates$_order$_createdAtSince$_updatedAtSince$_publishAtSince$_includeEmptyPages$_includeFuturePublishAt$_includeExternalUrl';
return await http.get(Uri.parse(uri));
}