private async Task <Issue> GetCorrespondingIssueAsync(int workItemId) { var searchIssuesRequest = new SearchIssuesRequest(term: TextUtilities.GetFormattedWorkItemId(workItemId)) { Type = IssueTypeQualifier.Issue, In = new[] { IssueInQualifier.Body }, }; searchIssuesRequest.Repos.Add(owner: repoOwner, name: repo); SearchIssuesResult searchIssuesResult = await search.SearchIssues(searchIssuesRequest); int searchResultCount = searchIssuesResult.Items.Count; if (searchResultCount == 0) { throw new WorkItemIdentificationException(string.Format(Resources.NoIssueFoundInGitHubRepoWithWorkItemIdX, workItemId)); } if (searchResultCount > 1) { throw new WorkItemIdentificationException(string.Format(Resources.MultipleIssuesFoundInGitHubRepoWithWorkItemIdX, workItemId)); } return(searchIssuesResult.Items[0]); }
private static async Task <List <Issue> > FetchPullRequests(ISearchClient client, string searchTerm) { var pullRequests = new List <Issue>(); var request = new SearchIssuesRequest(searchTerm) { Page = 1 }; var result = await client.SearchIssues(request); pullRequests.AddRange(result.Items); var page = 2; while (pullRequests.Count < result.TotalCount) { request = new SearchIssuesRequest(searchTerm) { Page = page }; result = await client.SearchIssues(request); pullRequests.AddRange(result.Items); page++; } return(pullRequests); }
public IReadOnlyList <Issue> GetAllEffortRelatedIssues(string searchTerm, string involvedPerson) { var relevantIssuesRequest = new SearchIssuesRequest(searchTerm) { Involves = involvedPerson, Type = IssueTypeQualifier.Issue, In = new[] { IssueInQualifier.Comment }, }; SearchIssuesResult potentialEffortIssues = searchClient.SearchIssues(relevantIssuesRequest).GetAwaiter().GetResult(); return(potentialEffortIssues.Items); }
/// <summary> /// search issues /// http://developer.github.com/v3/search/#search-issues /// </summary> /// <param name="search"></param> /// <returns>List of issues</returns> public IObservable <SearchIssuesResult> SearchIssues(SearchIssuesRequest search) { Ensure.ArgumentNotNull(search, nameof(search)); return(_client.SearchIssues(search).ToObservable()); }