Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit c87d178

Browse filesBrowse files
committed
added a method that matches the convention elsewhere.
1 parent 6fc872b commit c87d178
Copy full SHA for c87d178

File tree

Expand file treeCollapse file tree

1 file changed

+22
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+22
-0
lines changed

‎src/main/java/org/kohsuke/github/GHPerson.java

Copy file name to clipboardExpand all lines: src/main/java/org/kohsuke/github/GHPerson.java
+22Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,25 @@ public synchronized Map<String,GHRepository> getRepositories() throws IOExceptio
5454
return Collections.unmodifiableMap(repositories);
5555
}
5656

57+
/**
58+
* Lists up all the repositories.
59+
*
60+
* Unlike {@link #getRepositories()}, this does not wait until all the repositories are returned.
61+
*/
62+
public PagedIterable<GHRepository> listRepositories() {
63+
return new PagedIterable<GHRepository>() {
64+
public PagedIterator<GHRepository> iterator() {
65+
return new PagedIterator<GHRepository>(root.retrieve().asIterator("/users/" + login + "/repos", GHRepository[].class)) {
66+
@Override
67+
protected void wrapUp(GHRepository[] page) {
68+
for (GHRepository c : page)
69+
c.wrap(root);
70+
}
71+
};
72+
}
73+
};
74+
}
75+
5776
/**
5877
* Loads repository list in a pagenated fashion.
5978
*
@@ -63,6 +82,9 @@ public synchronized Map<String,GHRepository> getRepositories() throws IOExceptio
6382
*
6483
* Every {@link Iterator#next()} call results in I/O. Exceptions that occur during the processing is wrapped
6584
* into {@link Error}.
85+
*
86+
* @deprecated
87+
* Use {@link #listRepositories()}
6688
*/
6789
public synchronized Iterable<List<GHRepository>> iterateRepositories(final int pageSize) {
6890
return new Iterable<List<GHRepository>>() {

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.