public async Task <ImmutableList <PullRequest> > GetPullRequests(PullRequestState?state = PullRequestState.Open, string targetBranch = null, string sourceBranch = null, bool includeReviews = false, PullRequestAuthorMode authorMode = PullRequestAuthorMode.All) { return((from pr in (await pullRequests.Value).Values where pr.State == (state ?? pr.State) where pr.TargetBranch == (targetBranch ?? pr.TargetBranch) where pr.SourceBranch == (sourceBranch ?? pr.SourceBranch) where (authorMode == PullRequestAuthorMode.SystemOnly && pr.Author == username) || (authorMode == PullRequestAuthorMode.NonSystemOnly && pr.Author != username) || authorMode == PullRequestAuthorMode.All orderby pr.Created descending select pr).ToImmutableList()); }
public Task <ImmutableList <PullRequest> > GetPullRequests(PullRequestState?state = PullRequestState.Open, string targetBranch = null, string sourceBranch = null, bool includeReviews = false, PullRequestAuthorMode authorMode = PullRequestAuthorMode.All) { return(Task.FromResult( pullRequests.Values .Where(ex => (state == null || ex.State == state) && (targetBranch == null || ex.TargetBranch == targetBranch) && (sourceBranch == null || ex.SourceBranch == sourceBranch)) .Where(ex => authorMode != PullRequestAuthorMode.NonSystemOnly) .ToImmutableList() )); }
internal Task <ImmutableList <PullRequest> > LoadPullRequests(string source, string target, bool includeReviews, PullRequestAuthorMode authorMode) { // TODO - better loaders return(gitService.GetPullRequests(state: null, targetBranch: target, sourceBranch: source, includeReviews: includeReviews, authorMode: authorMode)); }