-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/

-- | Automatic derivation of querying functions for servant
--   
--   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.20.3.0

module Servant.Client.Internal.HttpClient

-- | The environment in which a request is run. The baseUrl and
--   makeClientRequest function are used to create a
--   http-client request. Cookies are then added to that request
--   if a CookieJar is set on the environment. Finally the request
--   is executed with the manager. The makeClientRequest
--   function can be used to modify the request to execute and set values
--   which are not specified on a servant Request like
--   responseTimeout or redirectCount
data ClientEnv
ClientEnv :: Manager -> BaseUrl -> Maybe (TVar CookieJar) -> (BaseUrl -> Request -> IO Request) -> ClientMiddleware -> ClientEnv
[manager] :: ClientEnv -> Manager
[baseUrl] :: ClientEnv -> BaseUrl
[cookieJar] :: ClientEnv -> Maybe (TVar CookieJar)

-- | this function can be used to customize the creation of
--   http-client requests from servant requests. Default
--   value: defaultMakeClientRequest Note that: 1.
--   makeClientRequest exists to allow overriding operational
--   semantics e.g. responseTimeout per request, If you need
--   global modifications, you should use managerModifyRequest 2.
--   the cookieJar, if defined, is being applied after
--   makeClientRequest is called.
[makeClientRequest] :: ClientEnv -> BaseUrl -> Request -> IO Request
[middleware] :: ClientEnv -> ClientMiddleware
type ClientApplication = Request -> ClientM Response
type ClientMiddleware = ClientApplication -> ClientApplication

-- | ClientEnv smart constructor.
mkClientEnv :: Manager -> BaseUrl -> ClientEnv

-- | 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

-- | Change the monad the client functions live in, by supplying a
--   conversion function (a natural transformation to be precise).
--   
--   For example, assuming you have some manager ::
--   Manager and baseurl :: BaseUrl around:
--   
--   
--   type API = Get '[JSON] Int :<|> Capture "n" Int :> Post '[JSON] Int
--   api :: Proxy API
--   api = Proxy
--   getInt :: IO Int
--   postInt :: Int -> IO Int
--   getInt :<|> postInt = hoistClient api (flip runClientM cenv) (client api)
--     where cenv = mkClientEnv manager baseurl
--   
hoistClient :: HasClient ClientM api => Proxy api -> (forall a. () => m a -> n a) -> Client m api -> Client n 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 ClientError IO) a -> ClientM a
[unClientM] :: ClientM a -> ReaderT ClientEnv (ExceptT ClientError IO) a
runClientM :: ClientM a -> ClientEnv -> IO (Either ClientError a)
performRequest :: Maybe [Status] -> Request -> ClientM Response
mkFailureResponse :: BaseUrl -> Request -> ResponseF ByteString -> ClientError
clientResponseToResponse :: (a -> b) -> Response a -> ResponseF b

-- | Create a http-client Request from a servant
--   Request The host, path and port fields are
--   extracted from the BaseUrl otherwise the body, headers and
--   query string are derived from the servant Request
--   
--   Note that Applicative dependency is not really needed for
--   this function implementation. But in the past the return type was
--   wrapped into IO without a necessity breaking the API
--   backward-compatibility. In order to not break the API again it was
--   changed to Applicative so that you can just use something
--   like Data.Functor.Identity without a need to involve
--   IO but still keeping it compatible with the code written when
--   it was typed as IO.
defaultMakeClientRequest :: Applicative f => BaseUrl -> Request -> f Request
catchConnectionError :: IO a -> IO (Either ClientError a)
instance Data.Functor.Alt.Alt Servant.Client.Internal.HttpClient.ClientM
instance GHC.Internal.Base.Applicative Servant.Client.Internal.HttpClient.ClientM
instance GHC.Internal.Base.Functor Servant.Client.Internal.HttpClient.ClientM
instance GHC.Internal.Generics.Generic (Servant.Client.Internal.HttpClient.ClientM a)
instance Control.Monad.Trans.Control.MonadBaseControl GHC.Types.IO Servant.Client.Internal.HttpClient.ClientM
instance Control.Monad.Base.MonadBase GHC.Types.IO Servant.Client.Internal.HttpClient.ClientM
instance Control.Monad.Catch.MonadCatch Servant.Client.Internal.HttpClient.ClientM
instance GHC.Internal.Base.Monad Servant.Client.Internal.HttpClient.ClientM
instance Control.Monad.Error.Class.MonadError Servant.Client.Core.ClientError.ClientError Servant.Client.Internal.HttpClient.ClientM
instance Control.Monad.IO.Class.MonadIO Servant.Client.Internal.HttpClient.ClientM
instance Control.Monad.Catch.MonadMask Servant.Client.Internal.HttpClient.ClientM
instance Control.Monad.Reader.Class.MonadReader Servant.Client.Internal.HttpClient.ClientEnv Servant.Client.Internal.HttpClient.ClientM
instance Control.Monad.Catch.MonadThrow Servant.Client.Internal.HttpClient.ClientM
instance Servant.Client.Core.RunClient.RunClient Servant.Client.Internal.HttpClient.ClientM

-- | 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 ClientError a)

-- | The environment in which a request is run. The baseUrl and
--   makeClientRequest function are used to create a
--   http-client request. Cookies are then added to that request
--   if a CookieJar is set on the environment. Finally the request
--   is executed with the manager. The makeClientRequest
--   function can be used to modify the request to execute and set values
--   which are not specified on a servant Request like
--   responseTimeout or redirectCount
data ClientEnv
ClientEnv :: Manager -> BaseUrl -> Maybe (TVar CookieJar) -> (BaseUrl -> Request -> IO Request) -> ClientMiddleware -> ClientEnv
[manager] :: ClientEnv -> Manager
[baseUrl] :: ClientEnv -> BaseUrl
[cookieJar] :: ClientEnv -> Maybe (TVar CookieJar)

-- | this function can be used to customize the creation of
--   http-client requests from servant requests. Default
--   value: defaultMakeClientRequest Note that: 1.
--   makeClientRequest exists to allow overriding operational
--   semantics e.g. responseTimeout per request, If you need
--   global modifications, you should use managerModifyRequest 2.
--   the cookieJar, if defined, is being applied after
--   makeClientRequest is called.
[makeClientRequest] :: ClientEnv -> BaseUrl -> Request -> IO Request
[middleware] :: ClientEnv -> ClientMiddleware

-- | ClientEnv smart constructor.
mkClientEnv :: Manager -> BaseUrl -> ClientEnv

-- | Create a http-client Request from a servant
--   Request The host, path and port fields are
--   extracted from the BaseUrl otherwise the body, headers and
--   query string are derived from the servant Request
--   
--   Note that Applicative dependency is not really needed for
--   this function implementation. But in the past the return type was
--   wrapped into IO without a necessity breaking the API
--   backward-compatibility. In order to not break the API again it was
--   changed to Applicative so that you can just use something
--   like Data.Functor.Identity without a need to involve
--   IO but still keeping it compatible with the code written when
--   it was typed as IO.
defaultMakeClientRequest :: Applicative f => BaseUrl -> Request -> f Request

-- | Change the monad the client functions live in, by supplying a
--   conversion function (a natural transformation to be precise).
--   
--   For example, assuming you have some manager ::
--   Manager and baseurl :: BaseUrl around:
--   
--   
--   type API = Get '[JSON] Int :<|> Capture "n" Int :> Post '[JSON] Int
--   api :: Proxy API
--   api = Proxy
--   getInt :: IO Int
--   postInt :: Int -> IO Int
--   getInt :<|> postInt = hoistClient api (flip runClientM cenv) (client api)
--     where cenv = mkClientEnv manager baseurl
--   
hoistClient :: HasClient ClientM api => Proxy api -> (forall a. () => m a -> n a) -> Client m api -> Client n api

module Servant.Client.Internal.HttpClient.Streaming

-- | 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 ClientError (Codensity IO)) a -> ClientM a
[unClientM] :: ClientM a -> ReaderT ClientEnv (ExceptT ClientError (Codensity IO)) a

-- | A runClientM variant for streaming client.
--   
--   It allows using this module's ClientM in a direct style. The
--   NFData constraint however prevents using this function with
--   genuine streaming response types (SourceT, Conduit,
--   pipes Proxy or Machine). For those you have to use
--   withClientM.
--   
--   Note: we force the result, so the likelihood of
--   accidentally leaking a connection is smaller. Use with care.
runClientM :: NFData a => ClientM a -> ClientEnv -> IO (Either ClientError a)

-- | Change the monad the client functions live in, by supplying a
--   conversion function (a natural transformation to be precise).
--   
--   For example, assuming you have some manager ::
--   Manager and baseurl :: BaseUrl around:
--   
--   
--   type API = Get '[JSON] Int :<|> Capture "n" Int :> Post '[JSON] Int
--   api :: Proxy API
--   api = Proxy
--   getInt :: IO Int
--   postInt :: Int -> IO Int
--   getInt :<|> postInt = hoistClient api (flip runClientM cenv) (client api)
--     where cenv = mkClientEnv manager baseurl
--   
hoistClient :: HasClient ClientM api => Proxy api -> (forall a. () => m a -> n a) -> Client m api -> Client n api
withClientM :: ClientM a -> ClientEnv -> (Either ClientError a -> IO b) -> IO b
performRequest :: Maybe [Status] -> Request -> ClientM Response

-- | TODO: support UVerb (acceptStatus argument, like in
--   performRequest above).
performWithStreamingRequest :: Request -> (StreamingResponse -> IO a) -> ClientM a

-- | The environment in which a request is run. The baseUrl and
--   makeClientRequest function are used to create a
--   http-client request. Cookies are then added to that request
--   if a CookieJar is set on the environment. Finally the request
--   is executed with the manager. The makeClientRequest
--   function can be used to modify the request to execute and set values
--   which are not specified on a servant Request like
--   responseTimeout or redirectCount
data ClientEnv
ClientEnv :: Manager -> BaseUrl -> Maybe (TVar CookieJar) -> (BaseUrl -> Request -> IO Request) -> ClientMiddleware -> ClientEnv
[manager] :: ClientEnv -> Manager
[baseUrl] :: ClientEnv -> BaseUrl
[cookieJar] :: ClientEnv -> Maybe (TVar CookieJar)

-- | this function can be used to customize the creation of
--   http-client requests from servant requests. Default
--   value: defaultMakeClientRequest Note that: 1.
--   makeClientRequest exists to allow overriding operational
--   semantics e.g. responseTimeout per request, If you need
--   global modifications, you should use managerModifyRequest 2.
--   the cookieJar, if defined, is being applied after
--   makeClientRequest is called.
[makeClientRequest] :: ClientEnv -> BaseUrl -> Request -> IO Request
[middleware] :: ClientEnv -> ClientMiddleware

-- | ClientEnv smart constructor.
mkClientEnv :: Manager -> BaseUrl -> ClientEnv
clientResponseToResponse :: (a -> b) -> Response a -> ResponseF b

-- | Create a http-client Request from a servant
--   Request The host, path and port fields are
--   extracted from the BaseUrl otherwise the body, headers and
--   query string are derived from the servant Request
--   
--   Note that Applicative dependency is not really needed for
--   this function implementation. But in the past the return type was
--   wrapped into IO without a necessity breaking the API
--   backward-compatibility. In order to not break the API again it was
--   changed to Applicative so that you can just use something
--   like Data.Functor.Identity without a need to involve
--   IO but still keeping it compatible with the code written when
--   it was typed as IO.
defaultMakeClientRequest :: Applicative f => BaseUrl -> Request -> f Request
catchConnectionError :: IO a -> IO (Either ClientError a)
instance Data.Functor.Alt.Alt Servant.Client.Internal.HttpClient.Streaming.ClientM
instance GHC.Internal.Base.Applicative Servant.Client.Internal.HttpClient.Streaming.ClientM
instance GHC.Internal.Base.Functor Servant.Client.Internal.HttpClient.Streaming.ClientM
instance GHC.Internal.Generics.Generic (Servant.Client.Internal.HttpClient.Streaming.ClientM a)
instance Control.Monad.Base.MonadBase GHC.Types.IO Servant.Client.Internal.HttpClient.Streaming.ClientM
instance GHC.Internal.Base.Monad Servant.Client.Internal.HttpClient.Streaming.ClientM
instance Control.Monad.Error.Class.MonadError Servant.Client.Core.ClientError.ClientError Servant.Client.Internal.HttpClient.Streaming.ClientM
instance Control.Monad.IO.Class.MonadIO Servant.Client.Internal.HttpClient.Streaming.ClientM
instance Control.Monad.Reader.Class.MonadReader Servant.Client.Internal.HttpClient.ClientEnv Servant.Client.Internal.HttpClient.Streaming.ClientM
instance Servant.Client.Core.RunClient.RunClient Servant.Client.Internal.HttpClient.Streaming.ClientM
instance Servant.Client.Core.RunClient.RunStreamingClient Servant.Client.Internal.HttpClient.Streaming.ClientM

-- | This module provides client which can automatically generate
--   querying functions for each endpoint just from the type representing
--   your API.
--   
--   This client supports streaming operations.
module Servant.Client.Streaming

-- | 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
withClientM :: ClientM a -> ClientEnv -> (Either ClientError a -> IO b) -> IO b

-- | A runClientM variant for streaming client.
--   
--   It allows using this module's ClientM in a direct style. The
--   NFData constraint however prevents using this function with
--   genuine streaming response types (SourceT, Conduit,
--   pipes Proxy or Machine). For those you have to use
--   withClientM.
--   
--   Note: we force the result, so the likelihood of
--   accidentally leaking a connection is smaller. Use with care.
runClientM :: NFData a => ClientM a -> ClientEnv -> IO (Either ClientError a)

-- | The environment in which a request is run. The baseUrl and
--   makeClientRequest function are used to create a
--   http-client request. Cookies are then added to that request
--   if a CookieJar is set on the environment. Finally the request
--   is executed with the manager. The makeClientRequest
--   function can be used to modify the request to execute and set values
--   which are not specified on a servant Request like
--   responseTimeout or redirectCount
data ClientEnv
ClientEnv :: Manager -> BaseUrl -> Maybe (TVar CookieJar) -> (BaseUrl -> Request -> IO Request) -> ClientMiddleware -> ClientEnv
[manager] :: ClientEnv -> Manager
[baseUrl] :: ClientEnv -> BaseUrl
[cookieJar] :: ClientEnv -> Maybe (TVar CookieJar)

-- | this function can be used to customize the creation of
--   http-client requests from servant requests. Default
--   value: defaultMakeClientRequest Note that: 1.
--   makeClientRequest exists to allow overriding operational
--   semantics e.g. responseTimeout per request, If you need
--   global modifications, you should use managerModifyRequest 2.
--   the cookieJar, if defined, is being applied after
--   makeClientRequest is called.
[makeClientRequest] :: ClientEnv -> BaseUrl -> Request -> IO Request
[middleware] :: ClientEnv -> ClientMiddleware

-- | ClientEnv smart constructor.
mkClientEnv :: Manager -> BaseUrl -> ClientEnv

-- | Create a http-client Request from a servant
--   Request The host, path and port fields are
--   extracted from the BaseUrl otherwise the body, headers and
--   query string are derived from the servant Request
--   
--   Note that Applicative dependency is not really needed for
--   this function implementation. But in the past the return type was
--   wrapped into IO without a necessity breaking the API
--   backward-compatibility. In order to not break the API again it was
--   changed to Applicative so that you can just use something
--   like Data.Functor.Identity without a need to involve
--   IO but still keeping it compatible with the code written when
--   it was typed as IO.
defaultMakeClientRequest :: Applicative f => BaseUrl -> Request -> f Request

-- | Change the monad the client functions live in, by supplying a
--   conversion function (a natural transformation to be precise).
--   
--   For example, assuming you have some manager ::
--   Manager and baseurl :: BaseUrl around:
--   
--   
--   type API = Get '[JSON] Int :<|> Capture "n" Int :> Post '[JSON] Int
--   api :: Proxy API
--   api = Proxy
--   getInt :: IO Int
--   postInt :: Int -> IO Int
--   getInt :<|> postInt = hoistClient api (flip runClientM cenv) (client api)
--     where cenv = mkClientEnv manager baseurl
--   
hoistClient :: HasClient ClientM api => Proxy api -> (forall a. () => m a -> n a) -> Client m api -> Client n api
