-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SearchIssuesRequest with State = ItemState.All #1082
Comments
I added a working example of the search api in my sample: https://github.com/hahmed/Sprint/blob/master/Sprint/Controllers/HomeController.cs#L118 |
@hahmed can we capture this as a failing integration test in the repo? |
@shiftkey yep sure. So I just need to write a failing test for: For example the below would be a valid failing integration test?
|
@hahmed that seems good enough for me - and if you could mark the test as |
@shiftkey To do the above I removed "All" from the ItemState enum. And regarding the failing integration tests, by simply removing the query for ItemState.All . Also from the IssueClientTests.cs https://github.com/prayankmathur/octokit.net/blob/master/Octokit.Tests.Integration/Clients/IssuesClientTests.cs#L162 and the build succeeded. Does this do the needful ? |
@prayankmathur How then would someone search for all issues? |
@M-Zuber |
Sounds great. |
Have to be a bit careful here because Eg https://developer.github.com/v3/search/#search-issues So I dont think removing All from the enum is good. Perhaps a new enum is needed and those places where only open/closed state is allowed, are changed to the new enum? |
@ryangribble @M-Zuber @shiftkey |
@ryangribble Thank you for pointing that out. @prayankmathur My suggestion would be to
|
@M-Zuber |
Also, we should be marking things as |
I like where this is heading. If it were me, I'd probably introduce a new enum in the search API instead of sharing the This feels like we're going to need to introduce a breaking change here as part of the new enum. But that's fine. Just a heads up. |
@shiftkey |
So the opposite of what I suggested, which does make more sense as it is much less of a change :) |
Or alternatively on the line: https://github.com/octokit/octokit.net/blob/master/Octokit/Models/Request/SearchIssuesRequest.cs#L248 We can simply change the code from:
to
or something along those lines... just a far simpler change IMHO. Maybe add a link to the api/issue to explain if needs be. |
@hahmed that won't do much good because then we need to check if "All" state exists for that particular parameter or not and there are a lot of parameters. |
yeah, its preferable to not show an option (ie an |
@ryangribble State.All does exist... just implicitly e.g. The result above returns both open and closed issues. Hence my suggestion - remove the param from being added on the condition
If there are any other areas of the code where -EDIT- Unless passing in null refers to search both open and closed issues...? Then yeah - we should create a new enum as suggested. |
Could you please open a PR? If you are not sure how that works, may I suggest watching this video? (the whole series actually is quite nice) |
@M-Zuber |
Thanks for the PR! Ive just made a comment on the PR and basically said that after seeing the proposed changes, i've backflipped on what was said above! Please check #1140 for my comments and let's continue the discussion there 😀 |
https://github.com/octokit/octokit.net/blob/master/Octokit/Clients/SearchClient.cs#L52
Searching issues via the search api does not look like it is working when setting the state parameter to
ItemState.All
, this only seems to work forItemState.Open
orItemState.Closed
.e.g.
https://github.com/search?q=state%3Aall+repo%3Arails%2Frails&type=Issues
Does not yield any results. I have tried out the code below too:
However if I set the
State
to eitherItemState.Open
ItemState.Closed` it will work, or if I omit it, it will also work. I think when it is set to ItemState.All we need to not add it to the request parameter.The api seems to correlate to what I am saying to? https://help.github.com/articles/searching-issues/#search-based-on-whether-an-issue-or-pull-request-is-open
I hope that makes sense. Let me know if I need to explain further.
The text was updated successfully, but these errors were encountered: