bc04d120ec
Rather than hard-coding the `RequestBodyLBS` constructor and be limited to lazy bytestrings, the new function `setReqBody` just takes any value of type `RequestBody`. The old function `setRQBody` has been renamed to `setReqBodyLBS`. The old name is still available, but deprecated. The change has the advantage the we can define new servant API combinators that use streaming request bodies such as for example constructed by the `streamFile` function in http-client. The behaviour for the existing `ReqBody` API combinator is unaffected by this change. |
||
---|---|---|
.. | ||
include | ||
src/Servant | ||
test | ||
CHANGELOG.md | ||
docs.sh | ||
LICENSE | ||
README.md | ||
servant-client.cabal | ||
Setup.hs | ||
tinc.yaml |
servant-client
This library lets you automatically derive Haskell functions that let you query each endpoint of a servant webservice.
Example
type MyApi = "books" :> Get '[JSON] [Book] -- GET /books
:<|> "books" :> ReqBody Book :> Post '[JSON] Book -- POST /books
myApi :: Proxy MyApi
myApi = Proxy
getAllBooks :: Manager -> BaseUrl -> ExceptT String IO [Book]
postNewBook :: Book -> Manager -> BaseUrl -> ExceptT String IO Book
-- 'client' allows you to produce operations to query an API from a client.
(getAllBooks :<|> postNewBook) = client myApi