diff options
author | Kevin Sawicki | 2012-12-09 22:59:26 +0000 |
---|---|---|
committer | Kevin Sawicki | 2012-12-09 22:59:26 +0000 |
commit | eeadbeb7b82ac37f3231eff79c3ffdcb827592b6 (patch) | |
tree | 94f31ba0d99d05bfb342830458510339b1c99d63 /org.eclipse.egit.github.core | |
parent | 06b147e0e29b39fe0b827c5c7615c795461c7f88 (diff) | |
download | egit-github-eeadbeb7b82ac37f3231eff79c3ffdcb827592b6.tar.gz egit-github-eeadbeb7b82ac37f3231eff79c3ffdcb827592b6.tar.xz egit-github-eeadbeb7b82ac37f3231eff79c3ffdcb827592b6.zip |
Add service support for getting all repositories
Change-Id: Ifda3068d4dba3b24e4c53cf53afba5a5329a90d1
Diffstat (limited to 'org.eclipse.egit.github.core')
-rw-r--r-- | org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/RepositoryService.java | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/RepositoryService.java b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/RepositoryService.java index 8d2a2cae..7fc2746d 100644 --- a/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/RepositoryService.java +++ b/org.eclipse.egit.github.core/src/org/eclipse/egit/github/core/service/RepositoryService.java @@ -21,6 +21,7 @@ import static org.eclipse.egit.github.core.client.IGitHubConstants.SEGMENT_LANGU import static org.eclipse.egit.github.core.client.IGitHubConstants.SEGMENT_LEGACY; import static org.eclipse.egit.github.core.client.IGitHubConstants.SEGMENT_ORGS; import static org.eclipse.egit.github.core.client.IGitHubConstants.SEGMENT_REPOS; +import static org.eclipse.egit.github.core.client.IGitHubConstants.SEGMENT_REPOSITORIES; import static org.eclipse.egit.github.core.client.IGitHubConstants.SEGMENT_SEARCH; import static org.eclipse.egit.github.core.client.IGitHubConstants.SEGMENT_TAGS; import static org.eclipse.egit.github.core.client.IGitHubConstants.SEGMENT_TEST; @@ -232,6 +233,32 @@ public class RepositoryService extends GitHubService { } /** + * Page all repositories + * + * @return iterator over pages of repositories + */ + public PageIterator<Repository> pageAllRepositories() { + return pageAllRepositories(-1); + } + + /** + * Page all repositories + * + * @param since + * @return iterator over pages of repositories + */ + public PageIterator<Repository> pageAllRepositories(final long since) { + PagedRequest<Repository> request = createPagedRequest(); + request.setUri(SEGMENT_REPOSITORIES); + if (since > 0) + request.setParams(Collections.singletonMap("since", + Long.toString(since))); + request.setType(new TypeToken<List<Repository>>() { + }.getType()); + return createPageIterator(request); + } + + /** * Get repositories for the given user * * @param user |