-- 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.5 module Servant.Common.BaseUrl -- | Simple data type to represent the target of HTTP requests for -- servant's automatically-generated clients. data BaseUrl BaseUrl :: Scheme -> String -> Int -> String -> BaseUrl -- | URI scheme to use [baseUrlScheme] :: BaseUrl -> Scheme -- | host (eg "haskell.org") [baseUrlHost] :: BaseUrl -> String -- | port (eg 80) [baseUrlPort] :: BaseUrl -> Int -- | path (eg "ab/c") [baseUrlPath] :: BaseUrl -> String data InvalidBaseUrlException -- | URI scheme to use data Scheme -- | http:// Http :: Scheme -- | https:// Https :: Scheme parseBaseUrl :: MonadThrow m => String -> m BaseUrl showBaseUrl :: BaseUrl -> String instance GHC.Generics.Selector Servant.Common.BaseUrl.S1_0_3BaseUrl instance GHC.Generics.Selector Servant.Common.BaseUrl.S1_0_2BaseUrl instance GHC.Generics.Selector Servant.Common.BaseUrl.S1_0_1BaseUrl instance GHC.Generics.Selector Servant.Common.BaseUrl.S1_0_0BaseUrl instance GHC.Generics.Constructor Servant.Common.BaseUrl.C1_0BaseUrl instance GHC.Generics.Datatype Servant.Common.BaseUrl.D1BaseUrl instance GHC.Generics.Constructor Servant.Common.BaseUrl.C1_1Scheme instance GHC.Generics.Constructor Servant.Common.BaseUrl.C1_0Scheme instance GHC.Generics.Datatype Servant.Common.BaseUrl.D1Scheme instance GHC.Show.Show Servant.Common.BaseUrl.InvalidBaseUrlException instance GHC.Generics.Generic Servant.Common.BaseUrl.BaseUrl instance GHC.Classes.Ord Servant.Common.BaseUrl.BaseUrl instance GHC.Show.Show Servant.Common.BaseUrl.BaseUrl instance GHC.Generics.Generic Servant.Common.BaseUrl.Scheme instance GHC.Classes.Ord Servant.Common.BaseUrl.Scheme instance GHC.Classes.Eq Servant.Common.BaseUrl.Scheme instance GHC.Show.Show Servant.Common.BaseUrl.Scheme instance GHC.Classes.Eq Servant.Common.BaseUrl.BaseUrl instance GHC.Exception.Exception Servant.Common.BaseUrl.InvalidBaseUrlException module Servant.Common.Req data ServantError FailureResponse :: Status -> MediaType -> ByteString -> ServantError [responseStatus] :: ServantError -> Status [responseContentType] :: ServantError -> MediaType [responseBody] :: ServantError -> ByteString DecodeFailure :: String -> MediaType -> ByteString -> ServantError [decodeError] :: ServantError -> String [responseContentType] :: ServantError -> MediaType [responseBody] :: ServantError -> ByteString UnsupportedContentType :: MediaType -> ByteString -> ServantError [responseContentType] :: ServantError -> MediaType [responseBody] :: ServantError -> ByteString InvalidContentTypeHeader :: ByteString -> ByteString -> ServantError [responseContentTypeHeader] :: ServantError -> ByteString [responseBody] :: ServantError -> ByteString ConnectionError :: SomeException -> ServantError [connectionError] :: ServantError -> SomeException data Req Req :: String -> QueryText -> Maybe (ByteString, MediaType) -> [MediaType] -> [(String, Text)] -> Req [reqPath] :: Req -> String [qs] :: Req -> QueryText [reqBody] :: Req -> Maybe (ByteString, MediaType) [reqAccept] :: Req -> [MediaType] [headers] :: Req -> [(String, Text)] defReq :: Req appendToPath :: String -> Req -> Req appendToQueryString :: Text -> Maybe Text -> Req -> Req addHeader :: ToHttpApiData a => String -> a -> Req -> Req setRQBody :: ByteString -> MediaType -> Req -> Req reqToRequest :: (Functor m, MonadThrow m) => Req -> BaseUrl -> m Request displayHttpRequest :: Method -> String performRequest :: Method -> Req -> BaseUrl -> Manager -> ExceptT ServantError IO (Int, ByteString, MediaType, [Header], Response ByteString) performRequestCT :: MimeUnrender ct result => Proxy ct -> Method -> Req -> BaseUrl -> Manager -> ExceptT ServantError IO ([Header], result) performRequestNoBody :: Method -> Req -> BaseUrl -> Manager -> ExceptT ServantError IO [Header] catchConnectionError :: IO a -> IO (Either ServantError a) instance GHC.Show.Show Servant.Common.Req.ServantError instance GHC.Exception.Exception Servant.Common.Req.ServantError -- | Authentication for clients module Servant.Client.Experimental.Auth -- | For better type inference and to avoid usage of a data family, we -- newtype wrap the combination of some AuthClientData and a -- function to add authentication data to a request -- -- NOTE: THIS API IS EXPERIMENTAL AND SUBJECT TO CHANGE newtype AuthenticateReq a AuthenticateReq :: (AuthClientData a, AuthClientData a -> Req -> Req) -> AuthenticateReq a [unAuthReq] :: AuthenticateReq a -> (AuthClientData a, AuthClientData a -> Req -> Req) -- | For a resource protected by authentication (e.g. AuthProtect), we need -- to provide the client with some data used to add authentication data -- to a request -- -- NOTE: THIS API IS EXPERIMENTAL AND SUBJECT TO CHANGE -- | Handy helper to avoid wrapping datatypes in tuples everywhere. -- -- NOTE: THIS API IS EXPERIMENTAL AND SUBJECT TO CHANGE mkAuthenticateReq :: AuthClientData a -> (AuthClientData a -> Req -> Req) -> AuthenticateReq a -- | Basic Authentication for clients module Servant.Common.BasicAuth -- | Authenticate a request using Basic Authentication basicAuthReq :: BasicAuthData -> Req -> Req -- | This module provides client which can automatically generate -- querying functions for each endpoint just from the type representing -- your API. module Servant.Client -- | For a resource protected by authentication (e.g. AuthProtect), we need -- to provide the client with some data used to add authentication data -- to a request -- -- NOTE: THIS API IS EXPERIMENTAL AND SUBJECT TO CHANGE -- | For better type inference and to avoid usage of a data family, we -- newtype wrap the combination of some AuthClientData and a -- function to add authentication data to a request -- -- NOTE: THIS API IS EXPERIMENTAL AND SUBJECT TO CHANGE newtype AuthenticateReq a AuthenticateReq :: (AuthClientData a, AuthClientData a -> Req -> Req) -> AuthenticateReq a [unAuthReq] :: AuthenticateReq a -> (AuthClientData a, AuthClientData a -> Req -> Req) -- | client allows you to produce operations to query an API from a -- client. -- --
-- type MyApi = "books" :> Get '[JSON] [Book] -- GET /books -- :<|> "books" :> ReqBody '[JSON] Book :> Post '[JSON] Book -- POST /books -- -- myApi :: Proxy MyApi -- myApi = Proxy -- -- getAllBooks :: ExceptT String IO [Book] -- postNewBook :: Book -> ExceptT String IO Book -- (getAllBooks :<|> postNewBook) = client myApi host manager -- where host = BaseUrl Http "localhost" 8080 --client :: HasClient layout => Proxy layout -> BaseUrl -> Manager -> Client layout -- | This class lets us define how each API combinator influences the -- creation of an HTTP request. It's mostly an internal class, you can -- just use client. class HasClient layout where type family Client layout :: * clientWithRoute :: HasClient layout => Proxy layout -> Req -> BaseUrl -> Manager -> Client layout -- | Handy helper to avoid wrapping datatypes in tuples everywhere. -- -- NOTE: THIS API IS EXPERIMENTAL AND SUBJECT TO CHANGE mkAuthenticateReq :: AuthClientData a -> (AuthClientData a -> Req -> Req) -> AuthenticateReq a data ServantError FailureResponse :: Status -> MediaType -> ByteString -> ServantError [responseStatus] :: ServantError -> Status [responseContentType] :: ServantError -> MediaType [responseBody] :: ServantError -> ByteString DecodeFailure :: String -> MediaType -> ByteString -> ServantError [decodeError] :: ServantError -> String [responseContentType] :: ServantError -> MediaType [responseBody] :: ServantError -> ByteString UnsupportedContentType :: MediaType -> ByteString -> ServantError [responseContentType] :: ServantError -> MediaType [responseBody] :: ServantError -> ByteString InvalidContentTypeHeader :: ByteString -> ByteString -> ServantError [responseContentTypeHeader] :: ServantError -> ByteString [responseBody] :: ServantError -> ByteString ConnectionError :: SomeException -> ServantError [connectionError] :: ServantError -> SomeException instance (Servant.Client.HasClient a, Servant.Client.HasClient b) => Servant.Client.HasClient (a Servant.API.Alternative.:<|> b) instance forall (k :: BOX) (capture :: GHC.TypeLits.Symbol) a (sublayout :: k). (GHC.TypeLits.KnownSymbol capture, Web.HttpApiData.Internal.ToHttpApiData a, Servant.Client.HasClient sublayout) => Servant.Client.HasClient (Servant.API.Capture.Capture capture a Servant.API.Sub.:> sublayout) instance forall (k :: BOX) (method :: k) (status :: GHC.TypeLits.Nat) (cts' :: [*]) a ct (cts :: [*]). (Servant.API.ContentTypes.MimeUnrender ct a, Servant.API.Verbs.ReflectMethod method, cts' ~ (ct : cts)) => Servant.Client.HasClient (Servant.API.Verbs.Verb method status cts' a) instance forall (k :: BOX) (method :: k) (status :: GHC.TypeLits.Nat) (cts :: [*]). Servant.API.Verbs.ReflectMethod method => Servant.Client.HasClient (Servant.API.Verbs.Verb method status cts Servant.API.ContentTypes.NoContent) instance forall (k :: BOX) (method :: k) (status :: GHC.TypeLits.Nat) (cts' :: [*]) (ls :: [*]) a ct (cts :: [*]). (Servant.API.ContentTypes.MimeUnrender ct a, Servant.API.ResponseHeaders.BuildHeadersTo ls, Servant.API.Verbs.ReflectMethod method, cts' ~ (ct : cts)) => Servant.Client.HasClient (Servant.API.Verbs.Verb method status cts' (Servant.API.ResponseHeaders.Headers ls a)) instance forall (k :: BOX) (method :: k) (status :: GHC.TypeLits.Nat) (cts :: [*]) (ls :: [*]). (Servant.API.ResponseHeaders.BuildHeadersTo ls, Servant.API.Verbs.ReflectMethod method) => Servant.Client.HasClient (Servant.API.Verbs.Verb method status cts (Servant.API.ResponseHeaders.Headers ls Servant.API.ContentTypes.NoContent)) instance forall (k :: BOX) (sym :: GHC.TypeLits.Symbol) a (sublayout :: k). (GHC.TypeLits.KnownSymbol sym, Web.HttpApiData.Internal.ToHttpApiData a, Servant.Client.HasClient sublayout) => Servant.Client.HasClient (Servant.API.Header.Header sym a Servant.API.Sub.:> sublayout) instance forall (k :: BOX) (sublayout :: k). Servant.Client.HasClient sublayout => Servant.Client.HasClient (Network.HTTP.Types.Version.HttpVersion Servant.API.Sub.:> sublayout) instance forall (k :: BOX) (sym :: GHC.TypeLits.Symbol) a (sublayout :: k). (GHC.TypeLits.KnownSymbol sym, Web.HttpApiData.Internal.ToHttpApiData a, Servant.Client.HasClient sublayout) => Servant.Client.HasClient (Servant.API.QueryParam.QueryParam sym a Servant.API.Sub.:> sublayout) instance forall (k :: BOX) (sym :: GHC.TypeLits.Symbol) a (sublayout :: k). (GHC.TypeLits.KnownSymbol sym, Web.HttpApiData.Internal.ToHttpApiData a, Servant.Client.HasClient sublayout) => Servant.Client.HasClient (Servant.API.QueryParam.QueryParams sym a Servant.API.Sub.:> sublayout) instance forall (k :: BOX) (sym :: GHC.TypeLits.Symbol) (sublayout :: k). (GHC.TypeLits.KnownSymbol sym, Servant.Client.HasClient sublayout) => Servant.Client.HasClient (Servant.API.QueryParam.QueryFlag sym Servant.API.Sub.:> sublayout) instance Servant.Client.HasClient Servant.API.Raw.Raw instance forall (k :: BOX) ct (cts :: [*]) a (sublayout :: k). (Servant.API.ContentTypes.MimeRender ct a, Servant.Client.HasClient sublayout) => Servant.Client.HasClient (Servant.API.ReqBody.ReqBody (ct : cts) a Servant.API.Sub.:> sublayout) instance forall (k :: BOX) (path :: GHC.TypeLits.Symbol) (sublayout :: k). (GHC.TypeLits.KnownSymbol path, Servant.Client.HasClient sublayout) => Servant.Client.HasClient (path Servant.API.Sub.:> sublayout) instance forall (k :: BOX) (api :: k). Servant.Client.HasClient api => Servant.Client.HasClient (Data.Vault.Lazy.Vault Servant.API.Sub.:> api) instance forall (k :: BOX) (api :: k). Servant.Client.HasClient api => Servant.Client.HasClient (Servant.API.RemoteHost.RemoteHost Servant.API.Sub.:> api) instance forall (k :: BOX) (api :: k). Servant.Client.HasClient api => Servant.Client.HasClient (Servant.API.IsSecure.IsSecure Servant.API.Sub.:> api) instance Servant.Client.HasClient subapi => Servant.Client.HasClient (Servant.API.WithNamedContext.WithNamedContext name context subapi) instance forall (k :: BOX) (k1 :: BOX) (tag :: k1) (api :: k). Servant.Client.HasClient api => Servant.Client.HasClient (Servant.API.Experimental.Auth.AuthProtect tag Servant.API.Sub.:> api) instance forall (k :: BOX) (realm :: GHC.TypeLits.Symbol) usr (api :: k). Servant.Client.HasClient api => Servant.Client.HasClient (Servant.API.BasicAuth.BasicAuth realm usr Servant.API.Sub.:> api)