servant-client

automatical derivation of querying functions for servant webservices http://haskell-servant.github.io/

Version on this page:[email protected]:2
LTS Haskell 15.14:0.16.0.1
Stackage Nightly 2020-06-01:0.16.0.1
Latest on Hackage:0.17

See all snapshots servant-client appears in

BSD-3-Clause licensed by Alp Mestanogullari, Sönke Hahn, Julian K. Arni
Maintained by [email protected]

Module documentation for 0.2.2

This version can be pinned in stack with:[email protected]:cdfdfa765886f1402ae1baec26abccb2c11347bb6fe424768b7edeb359035c0f,2298

This library lets you derive automatically Haskell functions that let you query each endpoint of a servant webservice.

Example below.

type MyApi = "books" :> Get [Book] -- GET /books
        :<|> "books" :> ReqBody Book :> Post Book -- POST /books

myApi :: Proxy MyApi
myApi = Proxy

getAllBooks :: BaseUrl -> EitherT String IO [Book]
postNewBook :: Book -> BaseUrl -> EitherT String IO Book
(getAllBooks :<|> postNewBook) = client myApi