-
Notifications
You must be signed in to change notification settings - Fork 192
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
Partial escape in query string to make search work again #321
base: master
Are you sure you want to change the base?
Conversation
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.
Looks great, but there are some nitpicks inline.
Orphan instance is a blocker.
@@ -39,6 +39,7 @@ module GitHub.Endpoints.Organizations.Teams ( | |||
import GitHub.Data | |||
import GitHub.Internal.Prelude | |||
import GitHub.Request | |||
import qualified Network.HTTP.Types as W |
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.
We use stylish-haskell
, to make import pretty put qualified
imports into own section:
import Github.Request
import Prelude ()
import qualified Network.HTTP.Types as W
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.
ok
@@ -56,4 +57,5 @@ nestedTree = nestedTree' Nothing | |||
-- See <https://developer.github.com/v3/git/trees/#get-a-tree-recursively> | |||
nestedTreeR :: Name Owner -> Name Repo -> Name Tree -> Request k Tree | |||
nestedTreeR user repo sha = | |||
query ["repos", toPathPart user, toPathPart repo, "git", "trees", toPathPart sha] [("recursive", Just "1")] | |||
query ["repos", toPathPart user, toPathPart repo, "git", "trees", toPathPart sha] | |||
[("recursive", [W.QE "1"])] |
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.
4 space indentation (tabular formatting doesn't apply here).
src/GitHub/Data/Request.hs
Outdated
@@ -241,6 +242,14 @@ instance Hashable (SimpleRequest k a) where | |||
`hashWithSalt` ps | |||
`hashWithSalt` body | |||
|
|||
instance Hashable W.EscapeItem where |
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.
orphan instance :/.
Could you make a PR to http-types
so the instance is there. Alternatively inline code where instance is needed?
I won't accept PR with orphan instance.
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 should have done this. But now it have wrapped the type in a newtype, because I don't want to go through the whole process of having the right http-types version in stackage.
src/GitHub/Endpoints/Search.hs
Outdated
-- "q=a+repo:phadej/github&per_page=100" | ||
-- has to be written as | ||
-- > searchIssues [("q", [QE "a", QN "+", QE "repo", QN ":", QE "phadej", QN "/", QE "github"]), | ||
-- ("per_page", [QE "100"])] |
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'm quite sure this looks ugly when rendered. >
have to prefix all code lines.
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.
In the next version haddock is tested
@tkvogt : Thanks for this 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.
Please:
- fix conflicts
- make sure
AllHaskellRepos
runs
This is so long ago. I just remeber that it worked and was good enough for me. It turned into some kind of beauty contest, which I had no time for. |
I understand. Sorry for that. My priorities are rather:
I didn't look closely at 1., but I noticed that 2. is satisfied ( |
If you use stack, you can reference this pull request and try it like
In my memory it worked. |
Got enough on my plate. I suppose this has to wait for someone with a genuine interest in this functionality to pick it up... |
fixes #262
http-types and http-client had to be extended for partial escape. These versions are now in stackage quite a while. I built the structure that I assumed you had in mind (SearchRepoMod), but it is very tedious and in my opinion not worth the trouble. So I used two styles in GitHub.Endpoints.Search