Safe Haskell | None |
---|---|
Language | Haskell2010 |
Servant.Client
Description
This module provides client
which can automatically generate
querying functions for each endpoint just from the type representing your
API.
Documentation
client :: HasClient ClientM api => Proxy api -> Client ClientM api #
Generates a set of client functions for an API.
Example:
type API = Capture "no" Int :> Get '[JSON] Int :<|> Get '[JSON] [Bool] api :: Proxy API api = Proxy getInt :: Int -> ClientM Int getBools :: ClientM [Bool] getInt :<|> getBools = client api
ClientM
is the monad in which client functions run. Contains the
Manager
and BaseUrl
used for requests in the reader environment.
Instances
Monad ClientM # | |
Functor ClientM # | |
Applicative ClientM # | |
MonadIO ClientM # | |
MonadThrow ClientM # | |
MonadCatch ClientM # | |
RunClient ClientM # | |
Alt ClientM # | Try clients in order, last error is preserved. |
MonadBase IO ClientM # | |
MonadBaseControl IO ClientM # | |
MonadError ServantError ClientM # | |
MonadReader ClientEnv ClientM # | |
Generic (ClientM a) # | |
ClientLike (ClientM a) (ClientM a) # | |
type StM ClientM a # | |
type Rep (ClientM a) # | |
runClientM :: ClientM a -> ClientEnv -> IO (Either ServantError a) #
The environment in which a request is run.
Instances
module Servant.Client.Core.Reexport