来自 egit 的函数 searchissue() 不会 return GitHub 存储库中的所有问题

Function searchissue() from egit don't return all issues in a GitHub repository

我试图从 GitHub 中的存储库中查找问题,但是当我使用 IssueService class 中的 searchissues() 函数时,只有 returns 10 个问题.我正在搜索的存储库已注册超过 40 个问题。

如何 return 在我的存储库中注册所有问题?

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);

}

应该与pagination in GitHub API有关。

查看测试 org.eclipse.egit.github.core.tests/src/org/eclipse/egit/github/core/tests/live/IssueTest.java #L138-L156:它展示了如何迭代 的结果,而不是直接返回结果(默认限制)

    IssueService service = new IssueService(client);
    Map<String, String> params = new HashMap<String, String>();
    params.put(IssueService.FILTER_STATE, IssueService.STATE_CLOSED);
    PageIterator<Issue> iterator = service.pageIssues("schacon", "showoff",
            params, 1);
    assertNotNull(iterator);
    assertTrue(iterator.hasNext());
    Collection<Issue> page = iterator.next();
    int pages = iterator.getLastPage();