Safe Haskell | None |
---|---|
Language | Haskell2010 |
http-client
-based client requests executor
- data ClientEnv = ClientEnv {}
- client :: HasClient ClientM api => Proxy api -> Client ClientM api
- newtype ClientM a = ClientM {
- runClientM' :: ReaderT ClientEnv (ExceptT ServantError IO) a
- runClientM :: ClientM a -> ClientEnv -> IO (Either ServantError a)
- performRequest :: Request -> ClientM Response
- clientResponseToReponse :: Response ByteString -> Response
- requestToClientRequest :: BaseUrl -> Request -> Request
- catchConnectionError :: IO a -> IO (Either ServantError a)
Documentation
The environment in which a request is run.
client :: HasClient ClientM api => Proxy api -> Client ClientM api Source #
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.
Monad ClientM Source # | |
Functor ClientM Source # | |
Applicative ClientM Source # | |
MonadIO ClientM Source # | |
MonadThrow ClientM Source # | |
MonadCatch ClientM Source # | |
Alt ClientM Source # | Try clients in order, last error is preserved. |
RunClient ClientM Source # | |
MonadBase IO ClientM Source # | |
MonadBaseControl IO ClientM Source # | |
MonadError ServantError ClientM Source # | |
MonadReader ClientEnv ClientM Source # | |
Generic (ClientM a) Source # | |
ClientLike (ClientM a) (ClientM a) Source # | |
type StM ClientM a Source # | |
type Rep (ClientM a) Source # | |
runClientM :: ClientM a -> ClientEnv -> IO (Either ServantError a) Source #
catchConnectionError :: IO a -> IO (Either ServantError a) Source #