From 33c39545997454d83942abe3182ca3f91b7699e1 Mon Sep 17 00:00:00 2001 From: Brendan Forster Date: Sat, 8 Mar 2014 11:58:19 +1100 Subject: [PATCH] added support for filtering by creator --- .../Clients/IssuesClientTests.cs | 27 +++++++++++++++++++ .../Models/Request/RepositoryIssueRequest.cs | 8 ++++++ 2 files changed, 35 insertions(+) diff --git a/Octokit.Tests.Integration/Clients/IssuesClientTests.cs b/Octokit.Tests.Integration/Clients/IssuesClientTests.cs index e24ea89a..8e2bf9c4 100644 --- a/Octokit.Tests.Integration/Clients/IssuesClientTests.cs +++ b/Octokit.Tests.Integration/Clients/IssuesClientTests.cs @@ -186,6 +186,33 @@ public class IssuesClientTests : IDisposable Assert.Equal("An unassigned issue", unassignedIssues[0].Title); } + [IntegrationTest] + public async Task CanFilterByCreator() + { + var owner = _repository.Owner.Login; + var newIssue1 = new NewIssue("An issue") { Body = "words words words" }; + var newIssue2 = new NewIssue("Another issue") { Body = "some other words" }; + await _issuesClient.Create(owner, _repository.Name, newIssue1); + await _issuesClient.Create(owner, _repository.Name, newIssue2); + + var allIssues = await _issuesClient.GetForRepository(owner, _repository.Name, + new RepositoryIssueRequest()); + + Assert.Equal(2, allIssues.Count); + + var assignedIssues = await _issuesClient.GetForRepository(owner, _repository.Name, + new RepositoryIssueRequest { Creator = owner }); + + Assert.Equal(2, assignedIssues.Count); + + var unassignedIssues = await _issuesClient.GetForRepository(owner, _repository.Name, + new RepositoryIssueRequest { Creator = "shiftkey" }); + + Assert.Equal(0, unassignedIssues.Count); + } + + + public void Dispose() { Helper.DeleteRepo(_repository); diff --git a/Octokit/Models/Request/RepositoryIssueRequest.cs b/Octokit/Models/Request/RepositoryIssueRequest.cs index e6a50cfd..e1008e02 100644 --- a/Octokit/Models/Request/RepositoryIssueRequest.cs +++ b/Octokit/Models/Request/RepositoryIssueRequest.cs @@ -18,5 +18,13 @@ namespace Octokit /// Specify "none" for issues with no assigned user /// public string Assignee { get; set; } + + /// + /// The user that created the issue + /// + /// + /// Specify "none" for issues with no assigned user + /// + public string Creator { get; set; } } }