-
Notifications
You must be signed in to change notification settings - Fork 45
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
RESTClient not accepting query string #20
Comments
You can add query parameters to the The argument to |
Thank you for your quick reply. However, when you say:
would this mean that at the end of the day one must pass a whole string of the form
to |
When you do
that's equivalent to
with the added bonus that you don't have to worry about encoding all the special characters in the query string properly, since that's handled by Similarly, you could do: client.Get("path?q1=foo&q2=bar") and that will work, but I wouldn't recommend it because, again, you'd have to worry about properly encoding query values. Instead, you should do: searchTerm := "<name>"
repoLanguage := "go"
myQuery := url.Values{}
myQuery.Add("q", fmt.Sprintf("%s in:name language:%s", searchTerm, repoLanguage))
myQuery.Add("per_page", "30")
client.Get("path?"+myQuery.Encode()) |
Thank you very much for your exhaustive reply, it works fine! |
I have a use case where I need to search for repositories containing certain query criteria (say name or language): essentially reproducing the standard repository search. Using the
gh
CLI this can be achieved via:I am trying to reproduce the above with the RESTClient call, passing the query search somehow as header string; however, according to the docs this grammar is not accepted (namely there is no way to pass a query string to the RESTClient object). Practically speaking I am looking to do something along the lines of
Question
What is the correct way to achieve the above?
The text was updated successfully, but these errors were encountered: