getMangaAggregateResponse method

Future<Response> getMangaAggregateResponse(
  1. String mangaId, {
  2. List<String>? groupIds,
  3. List<LanguageCodes>? translatedLanguages,
})
inherited

Endpoint used: GET /manga/{id}/aggregate

Gets response of manga chapter and volume info of a manga identified by it's mangaId, which can be filtered by groupIds and translatedLanguages

Implementation

Future<http.Response> getMangaAggregateResponse(String mangaId,
    {List<String>? groupIds,
    List<LanguageCodes>? translatedLanguages}) async {
  var _groupIds = '';
  var _translatedLanguages = '';
  if (groupIds != null) {
    groupIds.forEach((element) {
      _groupIds = _groupIds + '&groups[]=$element';
    });
  }
  if (translatedLanguages != null) {
    translatedLanguages.forEach((element) {
      _translatedLanguages = _translatedLanguages +
          '&translatedLanguage[]=${EnumUtils.parseLanguageCodeFromEnum(element)}';
    });
  }
  var unencodedPath =
      '/manga/$mangaId/aggregate?$_groupIds$_translatedLanguages';
  var uri = 'https://$AUTHORITY$unencodedPath';
  var response = await http.get(Uri.parse(uri), headers: {
    HttpHeaders.contentTypeHeader: 'application/json',
  });
  return response;
}