I am trying to find issues from a repository in the GitHub, but when I use the searchissues() function from the IssueService class, that only returns 10 issues. The repository that i am search has more then 40 issues registred.
How can i return all de issues registred in my repository?
public static void main(String[] args) throws IOException {
GitHubClient client = new GitHubClient();
client.setCredentials("xxxxxx", "xxxxx");
int openIssue = 0;
int closedIssue = 0;
RepositoryService repositoryService = new RepositoryService(client);
IRepositoryIdProvider repoId = new repositoryId("purifycss","purifycss");
IssueService issueService = new IssueService(client);
for(SearchIssue search : issueService.searchIssues(repoId, "all", " ")){
System.out.println(search.getTitle() + " " + search.getState() + " " + search.getNumber());
if(search.getState().equalsIgnoreCase("open"))
openIssue++;
if(search.getState().equalsIgnoreCase("closed"))
closedIssue++;
}
System.out.println(openIssue + " " + closedIssue);
}
That should be related to pagination in GitHub API.
Check out the test
org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/live/IssueTest.java
#L138-L156: it shows how to iterate over pages of results, instead of the results directly (limited by default)