2015-03-19 33 views
1

目前我對github api的調用返回了所有我的回購問題。Github api按照標籤使用octokit.net獲取問題

var repoIssueRequest = new RepositoryIssueRequest 
{ 
    State = itemState,// Is ItemState.Open or ItemState.Closed 
    Labels = new[] { label1, label2}// Trying to specify the labels I want to filter by, but there is no set, so this won't work 
}; 

var gitRepoIssues = (_gitHubclient.Issue.GetForRepository(string owner, string repo name, repoIssueRequest)).Result.ToList(); 

我不想只指定是否打開或關閉問題,但也要標籤。規範(View Here)指定標籤作爲參數之一,但在octokit.net我無法指定標籤列表,因爲它只有getter訪問器

RepositoryIssueRequest實現IssueRequest,並且IssueRequest包含public Collection Labels {get ; }

目前我在獲取所有問題後按標籤進行過濾,但如果返回幾百個問題然後過濾此問題集合,則必須返回所有數據的分配。我如何指定標籤,以便縮短回收問題所需的時間?

回答

3

我在Octokit.net倉庫中打開了一個問題,並得到了我的問題的答案。

var repoIssueRequest = new RepositoryIssueRequest 
{ 
    State = itemState,// Is ItemState.Open or ItemState.Closed 
    //Labels = new[] { label1, label2}// Don't specify label names here 
}; 

repoIssueRequest.Labels.Add("Label1");// Repeat for label 2 and so on or use .AddRange() 

var gitRepoIssues = (_gitHubclient.Issue.GetForRepository(string owner, string repo name, repoIssueRequest)).Result.ToList(); 

我要感謝Shift鍵,一個快速回應我的問題