intolerable / api-builder Goto Github PK
View Code? Open in Web Editor NEWlibrary for building JSON API wrappers in haskell
License: BSD 3-Clause "New" or "Revised" License
library for building JSON API wrappers in haskell
License: BSD 3-Clause "New" or "Revised" License
Good day @intolerable, I've been using your reddit
package (which depends on this package) and really want to get it from Stackage, do you have any plan adding these packages to Stackage?
Another problem is that these packages don't compile with GHC 8.4.3 (The only required fix is to add Semigroup instances before Monoid instances), do you have any plan upgrading them?
I can help with everything if you're happy with it.
I'd be interested in a release with 4b0a433
I had a whole bunch of code for managing API connections that I've almost completely replaced with this library. This is great work.
But I have an issue with the instance instance Sendable ()
. Because I can't override an instance in Haskell I've basically had to to re-implement a lot of Network.API.Builder.API
.
The issue is that it converts all query string parameters into body arguments for a POST request:
"POST" -> do
req <- parseUrl $ Text.unpack $ routeURL (_baseURL builder) (_customizeRoute builder r)
return $ _customizeRequest builder $
req { requestHeaders = ("Content-Type", "application/x-www-form-urlencoded") : requestHeaders req
, requestBody = RequestBodyBS (dropQuestion $ queryString req)
, queryString = ""
, method = httpMethod r }
Unfortunately one of the APIs I'm working with expects the arguments as a query string. If I need to add body arguments I can always modify the request with _customizeRequest
. I've simply re-implemented send like so:
send' :: MonadThrow m => Builder -> Route -> m Request
send' builder r = do
req <- parseUrl $ unpack $ routeURL (_baseURL builder) (_customizeRoute builder r)
return $ _customizeRequest builder $ req { method = httpMethod r }
Not really sure if this is an issue you want to fix. This library really simplified some things for me so I figured I'd let you know.
It would be nice if one could convert something like
http://api.stackexchange.com/2.2/questions?order=asc&min=1413849600&sort=creation&tagged=frp&site=stackoverflow&filter=*1FDl3RYdSl
into a Route
without having to manually parse the URL elements into something like:
questionsRoute = Route { urlPieces = [ "2.2", "questions" ]
, urlParams = [ "order" =. ("desc" :: Text)
, "sort" =. ("creation" :: Text)
, "site" =. ("stackoverflow" :: Text)
, ... ]
, httpMethod = "GET" }
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.