Simplify creation of PagedIterables from requests

This commit is contained in:
Liam Newman
2019-10-06 18:45:22 -07:00
parent 29e147f992
commit f28edbcf8f
24 changed files with 334 additions and 636 deletions

View File

@@ -98,17 +98,11 @@ public class GHCommitComment extends GHObject implements Reactable {
@Preview @Deprecated
public PagedIterable<GHReaction> listReactions() {
return new PagedIterable<GHReaction>() {
public PagedIterator<GHReaction> _iterator(int pageSize) {
return new PagedIterator<GHReaction>(owner.root.retrieve().withPreview(SQUIRREL_GIRL).asIterator(getApiTail()+"/reactions", GHReaction[].class, pageSize)) {
@Override
protected void wrapUp(GHReaction[] page) {
for (GHReaction c : page)
c.wrap(owner.root);
}
};
}
};
return owner.root.retrieve().withPreview(SQUIRREL_GIRL)
.asPagedIterable(
getApiTail()+"/reactions",
GHReaction[].class,
item -> item.wrap(owner.root) );
}
/**