Skip to content
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

Document search string format #262

Open
nmattia opened this issue Jan 15, 2017 · 3 comments · Fixed by snoyberg/http-client#321 · May be fixed by #321
Open

Document search string format #262

nmattia opened this issue Jan 15, 2017 · 3 comments · Fixed by snoyberg/http-client#321 · May be fixed by #321
Assignees

Comments

@nmattia
Copy link

nmattia commented Jan 15, 2017

I'm having troubles performing a request with this simple example from the github doc:

https://api.github.com/search/repositories?q=tetris+language:assembly&sort=stars&order=desc

More precisely, I cannot figure out how to format the search query. The examples in the source show two different ways:

--- With prepended @q=@
searchRepos "q=a in%3Aname language%3Ahaskell created%3A>2013-10-01&per_page=100"

-- Without prepended @q=@
searchRepos' (Just $ BasicAuth "github-username" "github-password') "a in%3Aname language%3Ahaskell created%3A>2013-10-01&per_page=100"

I do not understand why there are spaces and %3A chars. Moreover running the first query doesn't return any results on my machine (though no exception either), while the second one doesn't seem to be valid haskell.

I was able to build a simple query like the following:

λ: GitHub.searchRepos "language:haskell" >>= \(Right res) -> return (V.map GitHub.repoStargazersCount (GitHub.searchResultResults res))
[7830,7656,5637,3552 ...]

However I am unable to add more parameters. By skimming over the code, it looks like q= might be prepended on the requests. How are the other URL parameters like sort=.. supposed to be handled?

Thanks in advance

@phadej phadej self-assigned this Jan 25, 2017
@phadej
Copy link
Contributor

phadej commented Jan 25, 2017

I have structurised query sting generation for issues and pullrequests: http://hackage.haskell.org/package/github-0.15.0/docs/GitHub-Data-Options.html#t:IssueRepoMod but forgot search totally.

And seems IssueRepoMod doesn't have documentation either. Will refactor and add docs.

From the source, yes the 'Text' is a search string, i.e. the value of q query param. Adding sort etc. have to go lower level, i.e. unwrap Request and add them there manually

@phadej
Copy link
Contributor

phadej commented Jun 3, 2017

Checked the source. Adding handling of sort seems not worth the trouble atm. If someone wants to implement, it ask me for the details.

@tkvogt
Copy link

tkvogt commented Jan 28, 2018

I would like to fix this, see issue http-types. The PR is nearly ready. Just http-types has to be fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants