2016-12-10 20 views
1

我想列出所有組織下所有存儲庫中的所有問題。 我試過這段代碼:列出存儲庫中的所有問題

GitHubClient client = new GitHubClient(host); 
     client.setCredentials(user_name, password); 

     RepositoryService repository = new RepositoryService(client); 
     IssueService issues = new IssueService(client); 

     OrganizationService organization = new OrganizationService(client); 

     List<Repository> orgRepositories = repository.getOrgRepositories("eMerchantPay"); 

     for (int i = 0; i < orgRepositories.size(); i++) { 
      Repository get = orgRepositories.get(i); 
      String name = get.getName(); 
      System.out.println("Repository name " + name); 

      Map<String, String> map = new HashMap<>(); 
      List<Issue> issues1 = issues.getIssues(user_name, name, map); 

      for (int x = 0; x < issues1.size(); x++) { 
       Issue get1 = issues1.get(x); 
       String title = get1.getTitle(); 
       System.out.println("Issue name " + title); 
      } 

     } 

如何我可以org.eclipse.egit.github.core庫做到這一點?

回答

2

您可以使用org.eclipse.egit.github.core.service.IssueService獲取給定回購的所有問題。

看到example in this question,在那裏你會得到的問題的網頁:

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