use of com.karumi.marvelapiclient.model.SeriesCollectionDto in project Rosie by Karumi.
the class ComicSeriesApiDataSource method getPage.
@Override
public PaginatedCollection<ComicSeries> getPage(Page page) throws MarvelApiException {
int offset = page.getOffset();
int limit = page.getLimit();
MarvelResponse<SeriesCollectionDto> seriesApiResponse = seriesApiClient.getAll(offset, limit);
SeriesCollectionDto seriesCollectionDto = seriesApiResponse.getResponse();
Collection<ComicSeries> comicSeries = mapper.reverseMap(seriesCollectionDto.getSeries());
PaginatedCollection<ComicSeries> comicSeriesPage = new PaginatedCollection<>(comicSeries);
comicSeriesPage.setPage(page);
comicSeriesPage.setHasMore(seriesCollectionDto.getOffset() + seriesCollectionDto.getCount() < seriesCollectionDto.getTotal());
return comicSeriesPage;
}
Aggregations