Managed to write working code somehow... Just glued multiple pieces together. But any suggestions (especially naming ones) are really appreciated!).
Strictly speaking, dependency on aeson is not really necessary, and the API can return ByteString. But users of github-graphql will need to use aeson anyway, so I've decided to depend on it and provide several utilities (like the Data newtype).
I checked, that it works and calls the API (with the temporary version that returns ByteString):
λ: token = GitHubToken "1f777a210889b833815a0175c5c0d886839091f0"
λ: callGitHub token (repositoryToAst exampleQuery)
The status code was: Status {statusCode = 200, statusMessage = "OK"}
"{"data":{"repository":{"issues":{"nodes":[{"title":"Use 'git stash push' and handle optional argument to 'hit stash' to stash individual files","author":{"login":"chshersh"}},{"title":"Add --color-moved to hit diff","author":{"login":"vrom911"}},{"title":"[RFC] Warn about suspicious files","author":{"login":"vrom911"}}]},"pullRequests":{"nodes":[]}}}}"
But it also works now with Aeson types! Now users of github-graphql only need to write manual FromJSON instances for their types:
Resolves #13
Managed to write working code somehow... Just glued multiple pieces together. But any suggestions (especially naming ones) are really appreciated!).
Strictly speaking, dependency on
aeson
is not really necessary, and the API can returnByteString
. But users ofgithub-graphql
will need to useaeson
anyway, so I've decided to depend on it and provide several utilities (like theData
newtype).I checked, that it works and calls the API (with the temporary version that returns
ByteString
):But it also works now with Aeson types! Now users of
github-graphql
only need to write manualFromJSON
instances for their types: