-
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
Implement additional SearchIssuesRequest
options
#1228
Conversation
A few things off the top of my head:
Edit: |
SearchIssuesRequest
optionsSearchIssuesRequest
options
Thanks for the feedback 👍 Unless Im missing something, I dont see anything in the API docs about being able to "negate" any of the other filter types though... The only thing mentioned is labels (
With the way it's been implemented the label name doesn't really matter. I have a unit test that checks when 2 labels are specified in |
It works on (almost) anything
What I was trying to say was have a test that looks for a label that starts with a |
@M-Zuber be careful, the repository issue search on the website is likely to be a bit different to what's available through the API. Someone asked me a while ago about this and I'm pretty sure @ryangribble regarding your question about the properties, an alternative might be |
|
Update doc comments for all items Organise order of parameters inline with API docs for easier comparisons
…d work now) Fixup doc comments
…o replace IssueTypeQualifier.PR (which is now marked obsolete)
7dba4f0
to
4930a69
Compare
It could well be that the API accepts more options than the doco says, but for now Im thinking of just implementing what the doc says (where Although Im thinking perhaps for future proofing (If it does turn out that lots more fields can be negated or even the fact that it's likely in the future more fields would be able to be), I could perhaps move to having a new class to hold all the exclusions (and thus refer to them as normal names like new SearchIssuesRequest("fish")
{
Type = IssueTypeQualifier.PullRequest,
Is = IssueIsQualifier.Merged,
Exclusions = new SearchIssuesExclusions
{
Labels = new[] { "label1", "label2" },
Author = "M-Zuber" // Docs dont say this is supported but this is where more exclude fields could go if/when added
}
} Thoughts? Is collecting any exclusions under a sub class, preferable to ending up with multiple properties like |
That is pretty much what I was trying to say with this ⬇️, and your example implementation is nicer 😄
|
Sounds good to me, I just wanted to bring up such a possibility |
…d all fields that passed tests for properly working exclusions
OK so ive just pushed up a change that has moved the exclusions fields out into a subclass, as discussed above. So they are now accessed via eg // Search for PullRequests that dont have "skip-release-notes" label
var request = new SearchIssuesRequest();
request.Type = IssueTypeQualifier.PullRequest;
request.Repos.Add("octokit", "octokit.net");
request.Exclusions = new SearchIssuesRequestExclusions
{
Labels = new[] { "skip-release-notes" }
};
var pullRequests = await _gitHubClient.Search.SearchIssues(request); Regarding which fields are supported, I did some poking at the API and determined that it actually does support quite a few fields in "exclusion" syntax, in addition to the mentioned " So the following fields have been implemented in the Exceptions parameters:
The following fields were not implemented for exclusion for listed reasons:
Thoughts? |
I would say to yes implement (assuming support) as some users may find it easier conceptually to use
I vote for yes as I have done both in the past. One example that covers both is looking for something .Net Core related - but not in anything from Microsoft & Microsoft related repositories. |
Cool... i didnt actually even test/probe those options to see whether api accepts excluding them or not... i will look into it since those use cases do sound reasonable |
Hey @shiftkey just a reminder that I'm waiting on some input from your good self before I take any next steps 😀 I know you've been on the road etc, hoping that since you've assigned this to yourself it is somewhere on your list to get to 🔮 |
@ryangribble I haven't forgotten, just been digging myself out from under work since I got back to Oz last week and needed a bit of mundane work to take a break. I'll pick this up tomorrow. |
@ryangribble looking over the recent questions:
Works for me.
Yep, I like this too.
This is fine. We'll cross that bridge if we have to.
Happy to kick this can down the road until someone comes looking for it.
I guess if you wanted to offload more of the search work onto the API. But again, really edge case. 👢 this for now. |
@@ -126,4 +126,392 @@ public SearchClientTests() | |||
Assert.NotEmpty(closedIssues); | |||
Assert.NotEmpty(openedIssues); | |||
} | |||
|
|||
[Fact] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these should all be [IntegrationTest]
to ensure they only run when you have an integration test account setup.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice spot, thanks
Changes look good, integration tests are working fine on my end. I'm happy with the direction, happy to give it another look now that I finally got around to answering your questions... |
Thanks @shiftkey ill tidy up those few things raised and rebase etc There was also I guess 2 other things I just wanted a specific 👍 from you on:
and
|
👍 to |
{ | ||
var allRequest = new SearchIssuesRequest(); | ||
allRequest.Repos.Add("octokit", "octokit.net"); | ||
allRequest.Type = IssueTypeQualifier.PR; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💄 rename this to .PullRequest
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lol, nice pickup!
All feedback addressed, merged latest master and bashed Travis until it finally got a green run! |
@ryangribble +:100: nice work! |
Status
No
property andIssueNoMetadataQualifier
enumlabel
in the exclusion supportDetails
Fixes #1227
https://developer.github.com/v3/search/#search-issues
https://help.github.com/articles/searching-issues
Added new options to
SearchIssuesRequest
team
-label
no
is
querystate
andtype
cover most of theis
options, themerged
/unmerged
have no alternative)status
base
orhead
closed
date rangeTesting
Added unit tests for each parameter on this class to verify that when not set, the parameter is not in the query string, and when set the parameter is set as expected
Added some integration tests that excercise some of the new options
Discussion
I'd appreciate feedback on the implementation for "excluding" labels. In the API docs, this is done by using notation-label:labelname
as opposed tolabel:labelname
to include a label. At first I thought we could just implement this by having any label prepended with a hyphen be deemed to be an "exclusion" label, however it turns out that it's actually valid to have labels that start with a hyphen. So I implemented this as a separate list propertySearchIssuesRequest.NotLabels
It feels a bit ugly so if someone has a better way, let me knowUpdate: Now renamed toSearchIssuesRequest.ExcludeLabels
See #1228 (comment) for how the "exclusion" field implementation is shaping up...
Similarly, the "missing metadata" search option, ive called the class property
No
to match the query property in API docsno
, and gone withIssueNoMetadataQualifier
as the enum name. Open to better suggestions...