Search in sources :

Example 1 with SeriesCollectionDto

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;
}
Also used : ComicSeries(com.karumi.rosie.sample.comics.domain.model.ComicSeries) SeriesCollectionDto(com.karumi.marvelapiclient.model.SeriesCollectionDto) PaginatedCollection(com.karumi.rosie.repository.PaginatedCollection)

Aggregations

SeriesCollectionDto (com.karumi.marvelapiclient.model.SeriesCollectionDto)1 PaginatedCollection (com.karumi.rosie.repository.PaginatedCollection)1 ComicSeries (com.karumi.rosie.sample.comics.domain.model.ComicSeries)1