Skip to content
This repository was archived by the owner on Jul 31, 2025. It is now read-only.

Commit 5a70835

Browse files
committed
Merge pull request hub4j#136 from rtyley/page-team-repositories
Add paging support for Team's Repositories
2 parents e15f7a5 + e7262b8 commit 5a70835

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

src/main/java/org/kohsuke/github/GHTeam.java

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,27 @@ public boolean hasMember(GHUser user) {
6868
}
6969

7070
public Map<String,GHRepository> getRepositories() throws IOException {
71-
GHRepository[] repos = org.root.retrieve().to(api("/repos"), GHRepository[].class);
7271
Map<String,GHRepository> m = new TreeMap<String, GHRepository>();
73-
for (GHRepository r : repos) {
74-
m.put(r.getName(),r.wrap(org.root));
72+
for (GHRepository r : listRepositories()) {
73+
m.put(r.getName(), r);
7574
}
7675
return m;
7776
}
7877

78+
public PagedIterable<GHRepository> listRepositories() {
79+
return new PagedIterable<GHRepository>() {
80+
public PagedIterator<GHRepository> iterator() {
81+
return new PagedIterator<GHRepository>(org.root.retrieve().asIterator(api("/repos"), GHRepository[].class)) {
82+
@Override
83+
protected void wrapUp(GHRepository[] page) {
84+
for (GHRepository r : page)
85+
r.wrap(org.root);
86+
}
87+
};
88+
}
89+
};
90+
}
91+
7992
/**
8093
* Adds a member to the team.
8194
*

0 commit comments

Comments
 (0)