mirror of
https://github.com/jlengrand/github-api.git
synced 2026-04-04 08:21:23 +00:00
Simplify creation of PagedIterables from requests
This commit is contained in:
@@ -150,16 +150,11 @@ public class GHContent {
|
||||
if (!isDirectory())
|
||||
throw new IllegalStateException(path+" is not a directory");
|
||||
|
||||
return new PagedIterable<GHContent>() {
|
||||
public PagedIterator<GHContent> _iterator(int pageSize) {
|
||||
return new PagedIterator<GHContent>(root.retrieve().asIterator(url, GHContent[].class, pageSize)) {
|
||||
@Override
|
||||
protected void wrapUp(GHContent[] page) {
|
||||
GHContent.wrap(page, repository);
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
return root.retrieve()
|
||||
.asPagedIterable(
|
||||
url,
|
||||
GHContent[].class,
|
||||
item -> item.wrap(repository) );
|
||||
}
|
||||
|
||||
@SuppressFBWarnings("DM_DEFAULT_ENCODING")
|
||||
|
||||
Reference in New Issue
Block a user