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

@@ -73,18 +73,12 @@ public class GHProjectColumn extends GHObject {
public PagedIterable<GHProjectCard> listCards() throws IOException {
final GHProjectColumn column = this;
return new PagedIterable<GHProjectCard>() {
public PagedIterator<GHProjectCard> _iterator(int pageSize) {
return new PagedIterator<GHProjectCard>(root.retrieve().withPreview(INERTIA)
.asIterator(String.format("/projects/columns/%d/cards", id), GHProjectCard[].class, pageSize)) {
@Override
protected void wrapUp(GHProjectCard[] page) {
for (GHProjectCard c : page)
c.wrap(column);
}
};
}
};
return root.retrieve()
.withPreview(INERTIA)
.asPagedIterable(
String.format("/projects/columns/%d/cards", id),
GHProjectCard[].class,
item -> item.wrap(column) );
}
public GHProjectCard createCard(String note) throws IOException {