-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | automatical derivation of querying functions for servant webservices -- -- This library lets you derive automatically Haskell functions that let -- you query each endpoint of a servant webservice. -- -- See the client section of the tutorial. -- -- CHANGELOG @package servant-client @version 0.12 -- | http-client-based client requests executor module Servant.Client.Internal.HttpClient -- | The environment in which a request is run. data ClientEnv ClientEnv :: Manager -> BaseUrl -> ClientEnv [manager] :: ClientEnv -> Manager [baseUrl] :: ClientEnv -> BaseUrl -- | 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 --client :: HasClient ClientM api => Proxy api -> Client ClientM api -- | ClientM is the monad in which client functions run. Contains -- the Manager and BaseUrl used for requests in the reader -- environment. newtype ClientM a ClientM :: ReaderT ClientEnv (ExceptT ServantError IO) a -> ClientM a [runClientM'] :: ClientM a -> ReaderT ClientEnv (ExceptT ServantError IO) a -- | Try clients in order, last error is preserved. 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) instance Control.Monad.Catch.MonadCatch Servant.Client.Internal.HttpClient.ClientM instance Control.Monad.Catch.MonadThrow Servant.Client.Internal.HttpClient.ClientM instance Control.Monad.Error.Class.MonadError Servant.Client.Core.Internal.Request.ServantError Servant.Client.Internal.HttpClient.ClientM instance Control.Monad.Reader.Class.MonadReader Servant.Client.Internal.HttpClient.ClientEnv Servant.Client.Internal.HttpClient.ClientM instance GHC.Generics.Generic (Servant.Client.Internal.HttpClient.ClientM a) instance Control.Monad.IO.Class.MonadIO Servant.Client.Internal.HttpClient.ClientM instance GHC.Base.Monad Servant.Client.Internal.HttpClient.ClientM instance GHC.Base.Applicative Servant.Client.Internal.HttpClient.ClientM instance GHC.Base.Functor Servant.Client.Internal.HttpClient.ClientM instance Control.Monad.Base.MonadBase GHC.Types.IO Servant.Client.Internal.HttpClient.ClientM instance Control.Monad.Trans.Control.MonadBaseControl GHC.Types.IO Servant.Client.Internal.HttpClient.ClientM instance Data.Functor.Alt.Alt Servant.Client.Internal.HttpClient.ClientM instance Servant.Client.Core.Internal.RunClient.RunClient Servant.Client.Internal.HttpClient.ClientM instance Servant.Client.Core.Internal.Generic.ClientLike (Servant.Client.Internal.HttpClient.ClientM a) (Servant.Client.Internal.HttpClient.ClientM a) -- | This module provides client which can automatically generate -- querying functions for each endpoint just from the type representing -- your API. module Servant.Client -- | 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 --client :: HasClient ClientM api => Proxy api -> Client ClientM api -- | ClientM is the monad in which client functions run. Contains -- the Manager and BaseUrl used for requests in the reader -- environment. data ClientM a runClientM :: ClientM a -> ClientEnv -> IO (Either ServantError a) -- | The environment in which a request is run. data ClientEnv ClientEnv :: Manager -> BaseUrl -> ClientEnv [manager] :: ClientEnv -> Manager [baseUrl] :: ClientEnv -> BaseUrl