diff --git a/Octokit.Tests.Integration/Clients/IssuesClientTests.cs b/Octokit.Tests.Integration/Clients/IssuesClientTests.cs index 73284093a5..a75bdcf84f 100644 --- a/Octokit.Tests.Integration/Clients/IssuesClientTests.cs +++ b/Octokit.Tests.Integration/Clients/IssuesClientTests.cs @@ -122,7 +122,7 @@ await _issuesClient.Update(_context.RepositoryOwner, _context.RepositoryName, cl new IssueUpdate { State = ItemState.Closed }); var issues = await _issuesClient.GetAllForRepository(_context.RepositoryOwner, _context.RepositoryName, - new RepositoryIssueRequest { State = ItemState.Closed }); + new RepositoryIssueRequest { State = ItemStateFilter.Closed }); Assert.Equal(1, issues.Count); Assert.Equal("A closed issue", issues[0].Title); @@ -159,7 +159,7 @@ await _issuesClient.Update(_context.RepositoryOwner, _context.RepositoryName, is new IssueUpdate { State = ItemState.Closed }); var retrieved = await _issuesClient.GetAllForRepository(_context.RepositoryOwner, _context.RepositoryName, - new RepositoryIssueRequest { State = ItemState.All }); + new RepositoryIssueRequest { }); Assert.True(retrieved.Count >= 4); Assert.True(retrieved.Any(i => i.Number == issue1.Number)); diff --git a/Octokit.Tests.Integration/Clients/MilestonesClientTests.cs b/Octokit.Tests.Integration/Clients/MilestonesClientTests.cs index f5a58f4a32..d332502517 100644 --- a/Octokit.Tests.Integration/Clients/MilestonesClientTests.cs +++ b/Octokit.Tests.Integration/Clients/MilestonesClientTests.cs @@ -85,7 +85,7 @@ public async Task CanListClosedMilestones() await _milestonesClient.Create(_context.RepositoryOwner, _context.RepositoryName, milestone3); var milestones = await _milestonesClient.GetAllForRepository(_context.RepositoryOwner, _context.RepositoryName, - new MilestoneRequest { State = ItemState.Closed }); + new MilestoneRequest { State = ItemStateFilter.Closed }); Assert.Equal(1, milestones.Count); Assert.Equal("milestone 3", milestones[0].Title); @@ -103,7 +103,7 @@ await _github.Issue.Update(_context.RepositoryOwner, _context.RepositoryName, is new IssueUpdate { State = ItemState.Closed }); var retrieved = await _github.Issue.GetAllForRepository(_context.RepositoryOwner, _context.RepositoryName, - new RepositoryIssueRequest { State = ItemState.Closed }); + new RepositoryIssueRequest { State = ItemStateFilter.Closed }); Assert.True(retrieved.Count >= 2); Assert.True(retrieved.Any(i => i.Number == issue1.Number)); diff --git a/Octokit.Tests.Integration/Clients/PullRequestsClientTests.cs b/Octokit.Tests.Integration/Clients/PullRequestsClientTests.cs index 63af12a59a..c9e0a2ebea 100644 --- a/Octokit.Tests.Integration/Clients/PullRequestsClientTests.cs +++ b/Octokit.Tests.Integration/Clients/PullRequestsClientTests.cs @@ -60,7 +60,7 @@ public async Task CanGetOpenPullRequest() var newPullRequest = new NewPullRequest("a pull request", branchName, "master"); var result = await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest); - var openPullRequests = new PullRequestRequest { State = ItemState.Open }; + var openPullRequests = new PullRequestRequest { State = ItemStateFilter.Open }; var pullRequests = await _fixture.GetAllForRepository(Helper.UserName, _context.RepositoryName, openPullRequests); Assert.Equal(1, pullRequests.Count); @@ -75,7 +75,7 @@ public async Task IgnoresOpenPullRequest() var newPullRequest = new NewPullRequest("a pull request", branchName, "master"); await _fixture.Create(Helper.UserName, _context.RepositoryName, newPullRequest); - var openPullRequests = new PullRequestRequest { State = ItemState.Closed }; + var openPullRequests = new PullRequestRequest { State = ItemStateFilter.Closed }; var pullRequests = await _fixture.GetAllForRepository(Helper.UserName, _context.RepositoryName, openPullRequests); Assert.Empty(pullRequests); @@ -123,7 +123,7 @@ public async Task CanFindClosedPullRequest() var updatePullRequest = new PullRequestUpdate { State = ItemState.Closed }; await _fixture.Update(Helper.UserName, _context.RepositoryName, pullRequest.Number, updatePullRequest); - var closedPullRequests = new PullRequestRequest { State = ItemState.Closed }; + var closedPullRequests = new PullRequestRequest { State = ItemStateFilter.Closed }; var pullRequests = await _fixture.GetAllForRepository(Helper.UserName, _context.RepositoryName, closedPullRequests); Assert.Equal(1, pullRequests.Count); diff --git a/Octokit.Tests.Integration/Clients/SearchClientTests.cs b/Octokit.Tests.Integration/Clients/SearchClientTests.cs index 78da876950..3292c39090 100644 --- a/Octokit.Tests.Integration/Clients/SearchClientTests.cs +++ b/Octokit.Tests.Integration/Clients/SearchClientTests.cs @@ -91,7 +91,6 @@ public async Task SearchForAllIssues() { var request = new SearchIssuesRequest("phone"); request.Repos.Add("caliburn-micro", "caliburn.micro"); - request.State = ItemState.All; var issues = await _gitHubClient.Search.SearchIssues(request); diff --git a/Octokit.Tests.Integration/Reactive/ObservableMilestonesClientTests.cs b/Octokit.Tests.Integration/Reactive/ObservableMilestonesClientTests.cs index 91e9acc93f..e15602113e 100644 --- a/Octokit.Tests.Integration/Reactive/ObservableMilestonesClientTests.cs +++ b/Octokit.Tests.Integration/Reactive/ObservableMilestonesClientTests.cs @@ -31,7 +31,7 @@ public async Task ReturnsAllMilestones() var github = Helper.GetAuthenticatedClient(); var client = new ObservableMilestonesClient(github); - var milestones = await client.GetAllForRepository("libgit2", "libgit2sharp", new MilestoneRequest { State = ItemState.Closed }).ToList(); + var milestones = await client.GetAllForRepository("libgit2", "libgit2sharp", new MilestoneRequest { State = ItemStateFilter.Closed }).ToList(); Assert.NotEmpty(milestones); Assert.True(milestones.All(m => m.State == ItemState.Closed)); diff --git a/Octokit.Tests/Models/IssueRequestTests.cs b/Octokit.Tests/Models/IssueRequestTests.cs index 46b4035752..cafee4c7f6 100644 --- a/Octokit.Tests/Models/IssueRequestTests.cs +++ b/Octokit.Tests/Models/IssueRequestTests.cs @@ -13,7 +13,7 @@ public void ContainsSetValues() var request = new IssueRequest { Filter = IssueFilter.All, - State = ItemState.Closed, + State = ItemStateFilter.Closed, SortProperty = IssueSort.Comments, SortDirection = SortDirection.Ascending, Since = DateTimeOffset.ParseExact("Wed 23 Jan 2013 8:30 AM -08:00", diff --git a/Octokit.Tests/Models/MilestoneRequestTests.cs b/Octokit.Tests/Models/MilestoneRequestTests.cs index d489d6c91b..6964e761ca 100644 --- a/Octokit.Tests/Models/MilestoneRequestTests.cs +++ b/Octokit.Tests/Models/MilestoneRequestTests.cs @@ -10,7 +10,7 @@ public void ContainsSetValues() { var request = new MilestoneRequest { - State = ItemState.Closed, + State = ItemStateFilter.Closed, SortProperty = MilestoneSort.Completeness, SortDirection = SortDirection.Descending, }; diff --git a/Octokit.Tests/Models/PullRequestRequestTests.cs b/Octokit.Tests/Models/PullRequestRequestTests.cs index 51fb77146f..1c1810e67a 100644 --- a/Octokit.Tests/Models/PullRequestRequestTests.cs +++ b/Octokit.Tests/Models/PullRequestRequestTests.cs @@ -10,7 +10,7 @@ public void ContainsSetValues() { var request = new PullRequestRequest { - State = ItemState.Closed, + State = ItemStateFilter.Closed, Head = "user:ref-name", Base = "fake_base_branch" }; diff --git a/Octokit/Models/Request/IssueRequest.cs b/Octokit/Models/Request/IssueRequest.cs index 3d9d4d99b5..32d5ea68bc 100644 --- a/Octokit/Models/Request/IssueRequest.cs +++ b/Octokit/Models/Request/IssueRequest.cs @@ -18,7 +18,7 @@ public class IssueRequest : RequestParameters public IssueRequest() { Filter = IssueFilter.Assigned; - State = ItemState.Open; + State = ItemStateFilter.Open; Labels = new Collection(); SortProperty = IssueSort.Created; SortDirection = SortDirection.Descending; @@ -33,12 +33,12 @@ public IssueRequest() public IssueFilter Filter { get; set; } /// - /// Gets or sets the for the issues to return. + /// Gets or sets the for the issues to return. /// /// /// The state. /// - public ItemState State { get; set; } + public ItemStateFilter State { get; set; } /// /// Gets the labels to filter by. Add labels to the collection to only request issues with those labels. @@ -121,26 +121,42 @@ public enum IssueFilter } /// - /// The range of states that an issue can be in. + /// Range of states for Issues, Milestones and PullRequest API. /// - public enum ItemState + public enum ItemStateFilter { /// - /// Isuses that are open (default). + /// Items that are open. /// Open, /// - /// Isuses that are closed. + /// Items that are closed. /// Closed, /// - /// All the issues. + /// All the items. /// All } + /// + /// Items that are open OR closed + /// + public enum ItemState + { + /// + /// Items that are open + /// + Open, + + /// + /// Items that are closed + /// + Closed + } + /// /// The available properties to sort issues by. /// diff --git a/Octokit/Models/Request/IssueUpdate.cs b/Octokit/Models/Request/IssueUpdate.cs index fd25f98586..8d6b44bc06 100644 --- a/Octokit/Models/Request/IssueUpdate.cs +++ b/Octokit/Models/Request/IssueUpdate.cs @@ -93,4 +93,4 @@ public void ClearLabels() } } } -} +} \ No newline at end of file diff --git a/Octokit/Models/Request/MilestoneRequest.cs b/Octokit/Models/Request/MilestoneRequest.cs index c39a014acc..2dcdf7acf1 100644 --- a/Octokit/Models/Request/MilestoneRequest.cs +++ b/Octokit/Models/Request/MilestoneRequest.cs @@ -13,12 +13,15 @@ public class MilestoneRequest : RequestParameters { public MilestoneRequest() { - State = ItemState.Open; + State = ItemStateFilter.Open; SortProperty = MilestoneSort.DueDate; SortDirection = SortDirection.Ascending; } - public ItemState State { get; set; } + /// + /// Which Milestones to get. The default is . + /// + public ItemStateFilter State { get; set; } [Parameter(Key = "sort")] public MilestoneSort SortProperty { get; set; } diff --git a/Octokit/Models/Request/PullRequestRequest.cs b/Octokit/Models/Request/PullRequestRequest.cs index b5a2825094..ee4ede637e 100644 --- a/Octokit/Models/Request/PullRequestRequest.cs +++ b/Octokit/Models/Request/PullRequestRequest.cs @@ -13,15 +13,15 @@ public class PullRequestRequest : RequestParameters { public PullRequestRequest() { - State = ItemState.Open; + State = ItemStateFilter.Open; SortProperty = PullRequestSort.Created; SortDirection = SortDirection.Descending; } /// - /// "open" or "closed" to filter by state. Default is "open". + /// Which PullRequests to get. The default is /// - public ItemState State { get; set; } + public ItemStateFilter State { get; set; } /// /// Filter pulls by head user and branch name in the format of "user:ref-name". diff --git a/Octokit/Models/Response/Issue.cs b/Octokit/Models/Response/Issue.cs index e961fe7c32..8b49b2df44 100644 --- a/Octokit/Models/Response/Issue.cs +++ b/Octokit/Models/Response/Issue.cs @@ -155,4 +155,4 @@ public IssueUpdate ToUpdate() return issueUpdate; } } -} +} \ No newline at end of file