use of li.naska.bgg.resource.v3.model.Thing.Comment in project bgg-api by tnaskali.
the class ThingsService method getPagedComments.
public Mono<Page<Comment>> getPagedComments(Integer id, PagingParams pagingParams) {
PagingHelper helper = new PagingHelper(pagingParams.getSize(), pagingParams.getPage(), BGG_THING_COMMENTS_PAGE_SIZE);
BggThingsQueryParams firstPageQueryParams = new BggThingsQueryParams();
firstPageQueryParams.setId(id.toString());
firstPageQueryParams.setComments(1);
firstPageQueryParams.setPage(helper.getBggStartPage());
firstPageQueryParams.setPagesize(BGG_THING_COMMENTS_PAGE_SIZE);
return getThing(firstPageQueryParams).flatMap(thing -> helper.getBggPagesRange(thing.getNumcomments()).flatMapSequential(page -> {
BggThingsQueryParams queryParams = new BggThingsQueryParams();
queryParams.setId(id.toString());
queryParams.setComments(1);
queryParams.setPage(page);
queryParams.setPagesize(BGG_THING_COMMENTS_PAGE_SIZE);
return getThing(queryParams);
}).flatMapIterable(Thing::getComments).collect(Collectors.toList()).map(list -> helper.buildPage(list, thing.getNumcomments())));
}
use of li.naska.bgg.resource.v3.model.Thing.Comment in project bgg-api by tnaskali.
the class ThingsService method getPagedRatings.
public Mono<Page<Comment>> getPagedRatings(Integer id, PagingParams pagingParams) {
PagingHelper helper = new PagingHelper(pagingParams.getSize(), pagingParams.getPage(), BGG_THING_COMMENTS_PAGE_SIZE);
BggThingsQueryParams firstPageQueryParams = new BggThingsQueryParams();
firstPageQueryParams.setId(id.toString());
firstPageQueryParams.setRatingcomments(1);
firstPageQueryParams.setPage(helper.getBggStartPage());
firstPageQueryParams.setPagesize(BGG_THING_COMMENTS_PAGE_SIZE);
return getThing(firstPageQueryParams).flatMap(thing -> helper.getBggPagesRange(thing.getNumcomments()).flatMapSequential(page -> {
BggThingsQueryParams queryParams = new BggThingsQueryParams();
queryParams.setId(id.toString());
queryParams.setRatingcomments(1);
queryParams.setPage(page);
queryParams.setPagesize(BGG_THING_COMMENTS_PAGE_SIZE);
return getThing(queryParams);
}).flatMapIterable(Thing::getComments).collect(Collectors.toList()).map(list -> helper.buildPage(list, thing.getNumcomments())));
}
Aggregations