首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Github使用octokit.net通过标签过滤问题

Github使用octokit.net通过标签过滤问题
EN

Stack Overflow用户
提问于 2015-03-19 10:11:05
回答 1查看 925关注 0票数 1

目前,我对GitHub API的调用返回了回购的所有问题。

代码语言:javascript
复制
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();

我不想仅仅指定是公开还是封闭的问题,而是通过标签。规范(此处查看)将标签指定为参数之一,但在octokit.net中,我不能指定标签列表,因为它只有getter访问器。

RepositoryIssueRequest实现IssueRequestIssueRequest包含public Collection<string> Labels { get; }

目前,在获取所有问题之后,我通过标签进行筛选,但是如果返回了几百个问题,那么必须返回大量的数据,然后过滤这些问题的集合。如何指定标签,以减少返回问题集合所需的时间?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-03-19 12:16:42

我打开了一个Octokit.net回购的问题,并得到了我的问题的答案。

代码语言:javascript
复制
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();

我感谢shiftkey对我的问题的快速反应。

票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/29141747

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档