1

At the moment my call to the GitHub API returns all issues for my repo.

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

I want to not just specify whether to get open or closed issues, but by labels too. The spec (View Here) specifies labels as one of the parameters, but in octokit.net I can't specify a list of labels, as it only has the getter accessor.

RepositoryIssueRequest implements IssueRequest, and the IssueRequest contains public Collection<string> Labels { get; }.

At the moment I filter by labels after getting all the issues, but a lot of data must be getting returned if a couple hundred issues are being returned and then filtering this collection of issues. How can I specify the labels, so that the time it takes to return the collection of issues is reduced?

Eilon
  • 25,582
  • 3
  • 84
  • 102
Alan Ball
  • 593
  • 8
  • 17

1 Answers1

3

I opened an issue on the Octokit.net repo, and got an answer to my problem.

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

My thanks to shiftkey for a quick response to my issue

Alan Ball
  • 593
  • 8
  • 17