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

-- | Core functionality and class for client function generation for servant APIs
--   
--   This library provides backend-agnostic generation of client functions.
--   For more information, see the README.
@package servant-client-core
@version 0.20.3.0

module Servant.Client.Core.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

-- | URI scheme to use
data Scheme

-- | http://
Http :: Scheme

-- | https://
Https :: Scheme

-- | 
--   >>> showBaseUrl <$> parseBaseUrl "api.example.com"
--   "http://api.example.com"
--   
showBaseUrl :: BaseUrl -> String

-- | 
--   >>> parseBaseUrl "api.example.com"
--   BaseUrl {baseUrlScheme = Http, baseUrlHost = "api.example.com", baseUrlPort = 80, baseUrlPath = ""}
--   
--   
--   Note: trailing slash is removed
--   
--   
--   >>> parseBaseUrl "api.example.com/"
--   BaseUrl {baseUrlScheme = Http, baseUrlHost = "api.example.com", baseUrlPort = 80, baseUrlPath = ""}
--   
--   
--   
--   >>> parseBaseUrl "api.example.com/dir/"
--   BaseUrl {baseUrlScheme = Http, baseUrlHost = "api.example.com", baseUrlPort = 80, baseUrlPath = "/dir"}
--   
parseBaseUrl :: MonadThrow m => String -> m BaseUrl
newtype InvalidBaseUrlException
InvalidBaseUrlException :: String -> InvalidBaseUrlException
instance GHC.Internal.Data.Data.Data Servant.Client.Core.BaseUrl.BaseUrl
instance GHC.Internal.Data.Data.Data Servant.Client.Core.BaseUrl.Scheme
instance GHC.Classes.Eq Servant.Client.Core.BaseUrl.BaseUrl
instance GHC.Classes.Eq Servant.Client.Core.BaseUrl.Scheme
instance GHC.Internal.Exception.Type.Exception Servant.Client.Core.BaseUrl.InvalidBaseUrlException
instance Data.Aeson.Types.FromJSON.FromJSON Servant.Client.Core.BaseUrl.BaseUrl
instance Data.Aeson.Types.FromJSON.FromJSONKey Servant.Client.Core.BaseUrl.BaseUrl
instance GHC.Internal.Generics.Generic Servant.Client.Core.BaseUrl.BaseUrl
instance GHC.Internal.Generics.Generic Servant.Client.Core.BaseUrl.Scheme
instance Language.Haskell.TH.Syntax.Lift Servant.Client.Core.BaseUrl.BaseUrl
instance Language.Haskell.TH.Syntax.Lift Servant.Client.Core.BaseUrl.Scheme
instance Control.DeepSeq.NFData Servant.Client.Core.BaseUrl.BaseUrl
instance GHC.Classes.Ord Servant.Client.Core.BaseUrl.BaseUrl
instance GHC.Classes.Ord Servant.Client.Core.BaseUrl.Scheme
instance GHC.Internal.Show.Show Servant.Client.Core.BaseUrl.BaseUrl
instance GHC.Internal.Show.Show Servant.Client.Core.BaseUrl.InvalidBaseUrlException
instance GHC.Internal.Show.Show Servant.Client.Core.BaseUrl.Scheme
instance Data.Aeson.Types.ToJSON.ToJSON Servant.Client.Core.BaseUrl.BaseUrl
instance Data.Aeson.Types.ToJSON.ToJSONKey Servant.Client.Core.BaseUrl.BaseUrl

module Servant.Client.Core.Request
type Request = RequestF RequestBody Builder
data RequestF body path
Request :: path -> Seq QueryItem -> Maybe (body, MediaType) -> Seq MediaType -> Seq Header -> HttpVersion -> Method -> RequestF body path
[requestPath] :: RequestF body path -> path
[requestQueryString] :: RequestF body path -> Seq QueryItem
[requestBody] :: RequestF body path -> Maybe (body, MediaType)
[requestAccept] :: RequestF body path -> Seq MediaType
[requestHeaders] :: RequestF body path -> Seq Header
[requestHttpVersion] :: RequestF body path -> HttpVersion
[requestMethod] :: RequestF body path -> Method

-- | The request body. R replica of the http-client
--   RequestBody.
data RequestBody
RequestBodyLBS :: ByteString -> RequestBody
RequestBodyBS :: ByteString -> RequestBody
RequestBodySource :: SourceIO ByteString -> RequestBody
defaultRequest :: Request

-- | Add header to the request being constructed.
addHeader :: ToHttpApiData a => HeaderName -> a -> Request -> Request

-- | Append extra path to the request being constructed.
--   
--   Warning: This function assumes that the path fragment is already
--   URL-encoded.
appendToPath :: Builder -> Request -> Request

-- | Append a query parameter to the request being constructed.
appendToQueryString :: Text -> Maybe ByteString -> Request -> Request

-- | Encode a query parameter value.
encodeQueryParamValue :: ToHttpApiData a => a -> ByteString
setQueryString :: Query -> Request -> Request

-- | Set body and media type of the request being constructed.
setRequestBody :: RequestBody -> MediaType -> Request -> Request

-- | Set body and media type of the request being constructed.
--   
--   The body is set to the given bytestring using the
--   RequestBodyLBS constructor.
setRequestBodyLBS :: ByteString -> MediaType -> Request -> Request
instance Data.Bifoldable.Bifoldable Servant.Client.Core.Request.RequestF
instance Data.Bifunctor.Bifunctor Servant.Client.Core.Request.RequestF
instance Data.Bitraversable.Bitraversable Servant.Client.Core.Request.RequestF
instance (GHC.Classes.Eq path, GHC.Classes.Eq body) => GHC.Classes.Eq (Servant.Client.Core.Request.RequestF body path)
instance GHC.Internal.Data.Foldable.Foldable (Servant.Client.Core.Request.RequestF body)
instance GHC.Internal.Base.Functor (Servant.Client.Core.Request.RequestF body)
instance GHC.Internal.Generics.Generic Servant.Client.Core.Request.RequestBody
instance GHC.Internal.Generics.Generic (Servant.Client.Core.Request.RequestF body path)
instance (Control.DeepSeq.NFData path, Control.DeepSeq.NFData body) => Control.DeepSeq.NFData (Servant.Client.Core.Request.RequestF body path)
instance GHC.Internal.Show.Show Servant.Client.Core.Request.RequestBody
instance (GHC.Internal.Show.Show a, GHC.Internal.Show.Show b) => GHC.Internal.Show.Show (Servant.Client.Core.Request.RequestF a b)
instance GHC.Internal.Data.Traversable.Traversable (Servant.Client.Core.Request.RequestF body)

-- | Basic Authentication for clients
module Servant.Client.Core.BasicAuth

-- | Authenticate a request using Basic Authentication
basicAuthReq :: BasicAuthData -> Request -> Request

-- | Authentication for clients
module Servant.Client.Core.Auth

-- | 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
type family AuthClientData a

-- | 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 AuthenticatedRequest a
AuthenticatedRequest :: (AuthClientData a, AuthClientData a -> Request -> Request) -> AuthenticatedRequest a
[unAuthReq] :: AuthenticatedRequest a -> (AuthClientData a, AuthClientData a -> Request -> Request)

-- | Handy helper to avoid wrapping datatypes in tuples everywhere.
--   
--   NOTE: THIS API IS EXPERIMENTAL AND SUBJECT TO CHANGE
mkAuthenticatedRequest :: AuthClientData a -> (AuthClientData a -> Request -> Request) -> AuthenticatedRequest a

module Servant.Client.Core.Response
type Response = ResponseF ByteString
type StreamingResponse = ResponseF SourceIO ByteString
data ResponseF a
Response :: Status -> Seq Header -> HttpVersion -> a -> ResponseF a
[responseStatusCode] :: ResponseF a -> Status
[responseHeaders] :: ResponseF a -> Seq Header
[responseHttpVersion] :: ResponseF a -> HttpVersion
[responseBody] :: ResponseF a -> a
responseToInternalResponse :: ResponseF a -> InternalResponse a
instance GHC.Classes.Eq a => GHC.Classes.Eq (Servant.Client.Core.Response.ResponseF a)
instance GHC.Internal.Data.Foldable.Foldable Servant.Client.Core.Response.ResponseF
instance GHC.Internal.Base.Functor Servant.Client.Core.Response.ResponseF
instance GHC.Internal.Generics.Generic (Servant.Client.Core.Response.ResponseF a)
instance Control.DeepSeq.NFData a => Control.DeepSeq.NFData (Servant.Client.Core.Response.ResponseF a)
instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Servant.Client.Core.Response.ResponseF a)
instance GHC.Internal.Data.Traversable.Traversable Servant.Client.Core.Response.ResponseF

module Servant.Client.Core.MultiVerb.ResponseUnrender
data SomeClientResponse
SomeClientResponse :: ResponseF a -> SomeClientResponse
fromSomeClientResponse :: forall a m. (Alternative m, Typeable a) => SomeClientResponse -> m (ResponseF a)
class ResponseUnrender (cs :: k) a where {
    type ResponseBody a;
    type ResponseStatus a :: Nat;
}
responseUnrender :: ResponseUnrender cs a => MediaType -> ResponseF (ResponseBody a) -> UnrenderResult (ResponseType a)
class Typeable as => ResponseListUnrender (cs :: k) (as :: [Type])
responseListUnrender :: ResponseListUnrender cs as => MediaType -> SomeClientResponse -> UnrenderResult (Union (ResponseTypes as))
responseListStatuses :: ResponseListUnrender cs as => [Status]
instance forall k a (cs :: k) (as :: [GHC.Types.Type]). (GHC.Internal.Data.Typeable.Internal.Typeable a, GHC.Internal.Data.Typeable.Internal.Typeable (Servant.Client.Core.MultiVerb.ResponseUnrender.ResponseBody a), Servant.Client.Core.MultiVerb.ResponseUnrender.ResponseUnrender cs a, Servant.Client.Core.MultiVerb.ResponseUnrender.ResponseListUnrender cs as, Servant.API.Status.KnownStatus (Servant.Client.Core.MultiVerb.ResponseUnrender.ResponseStatus a)) => Servant.Client.Core.MultiVerb.ResponseUnrender.ResponseListUnrender cs (a : as)
instance forall k (cs :: k). Servant.Client.Core.MultiVerb.ResponseUnrender.ResponseListUnrender cs '[]
instance (Servant.API.ContentTypes.AllMimeUnrender cs a, Servant.API.Status.KnownStatus s) => Servant.Client.Core.MultiVerb.ResponseUnrender.ResponseUnrender cs (Servant.API.MultiVerb.Respond s desc a)
instance forall k (s :: GHC.Internal.TypeNats.Nat) ct a (cs :: k) (desc :: GHC.Types.Symbol). (Servant.API.Status.KnownStatus s, Servant.API.ContentTypes.MimeUnrender ct a) => Servant.Client.Core.MultiVerb.ResponseUnrender.ResponseUnrender cs (Servant.API.MultiVerb.RespondAs ct s desc a)
instance forall k (s :: GHC.Internal.TypeNats.Nat) (cs :: k) (desc :: GHC.Types.Symbol). Servant.API.Status.KnownStatus s => Servant.Client.Core.MultiVerb.ResponseUnrender.ResponseUnrender cs (Servant.API.MultiVerb.RespondAs '() s desc ())
instance forall k (s :: GHC.Internal.TypeNats.Nat) (cs :: k) (desc :: GHC.Types.Symbol) framing ct. Servant.API.Status.KnownStatus s => Servant.Client.Core.MultiVerb.ResponseUnrender.ResponseUnrender cs (Servant.API.MultiVerb.RespondStreaming s desc framing ct)
instance forall k (xs :: [GHC.Types.Type]) r a (hs :: [GHC.Types.Type]) (cs :: k). (Servant.API.MultiVerb.AsHeaders xs (Servant.API.MultiVerb.ResponseType r) a, Servant.API.MultiVerb.ServantHeaders hs xs, Servant.Client.Core.MultiVerb.ResponseUnrender.ResponseUnrender cs r) => Servant.Client.Core.MultiVerb.ResponseUnrender.ResponseUnrender cs (Servant.API.MultiVerb.WithHeaders hs a r)

module Servant.Client.Core.ClientError

-- | A type representing possible errors in a request
--   
--   Note that this type substantially changed in 0.12.
data ClientError

-- | The server returned an error response including the failing request.
--   requestPath includes the BaseUrl and the path of the
--   request.
FailureResponse :: RequestF () (BaseUrl, ByteString) -> Response -> ClientError

-- | The body could not be decoded at the expected type
DecodeFailure :: Text -> Response -> ClientError

-- | The content-type of the response is not supported
UnsupportedContentType :: MediaType -> Response -> ClientError

-- | The content-type header is invalid
InvalidContentTypeHeader :: Response -> ClientError

-- | There was a connection error, and no response was received
ConnectionError :: SomeException -> ClientError
instance GHC.Classes.Eq Servant.Client.Core.ClientError.ClientError
instance GHC.Internal.Exception.Type.Exception Servant.Client.Core.ClientError.ClientError
instance GHC.Internal.Generics.Generic Servant.Client.Core.ClientError.ClientError
instance Control.DeepSeq.NFData Servant.Client.Core.ClientError.ClientError
instance GHC.Internal.Show.Show Servant.Client.Core.ClientError.ClientError

-- | Types for possible backends to run client-side Request queries
module Servant.Client.Core.RunClient
class Monad m => RunClient (m :: Type -> Type)

-- | How to make a request, with an optional list of status codes to not
--   throw exceptions for (default: [200..299]).
runRequestAcceptStatus :: RunClient m => Maybe [Status] -> Request -> m Response
throwClientError :: RunClient m => ClientError -> m a

-- | How to make a request.
runRequest :: RunClient m => Request -> m Response
class RunClient m => RunStreamingClient (m :: Type -> Type)
withStreamingRequest :: RunStreamingClient m => Request -> (StreamingResponse -> IO a) -> m a

-- | ClientF cannot stream.
--   
--   Compare to RunClient.
data ClientF a
RunRequest :: Request -> (Response -> a) -> ClientF a
Throw :: ClientError -> ClientF a
instance GHC.Internal.Base.Functor Servant.Client.Core.RunClient.ClientF
instance (Servant.Client.Core.RunClient.ClientF GHC.Types.~ f) => Servant.Client.Core.RunClient.RunClient (Control.Monad.Free.Free f)

-- | Server-sent events
--   
--   See https://www.w3.org/TR/2009/WD-eventsource-20090421/ for
--   more details on server-sent events (SSE).
module Servant.Client.Core.ServerSentEvents

-- | Structured variant of an event line of an event stream
data EventMessage

-- | Dispatch on the accumulated event.
EventDispatch :: EventMessage

-- | Set the name of the current event.
EventSetName :: ByteString -> EventMessage

-- | Set the last event identifier.
EventSetLastId :: ByteString -> EventMessage

-- | Append data to the event's data buffer.
EventData :: ByteString -> EventMessage

-- | Set the event stream's reconnection time.
EventRetry :: Natural -> EventMessage

-- | Ignored
EventIgnore :: EventIgnoreReason -> EventMessage

-- | Reason why a event line can be ignored
data EventIgnoreReason
EventFieldNameUnknown :: ByteString -> EventIgnoreReason
EventRetryNonNumeric :: ByteString -> EventIgnoreReason
EventComment :: ByteString -> EventIgnoreReason

-- | Event sent by the remote
data Event a
Event :: Maybe ByteString -> a -> Event a
[eventName] :: Event a -> Maybe ByteString
[eventData] :: Event a -> a

-- | Server-sent event stream (SSE)
--   
--   See https://www.w3.org/TR/2009/WD-eventsource-20090421/ for
--   more details.
newtype EventStreamT (m :: Type -> Type)
EventStreamT :: SourceT m (Event ByteString) -> EventStreamT (m :: Type -> Type)
[unEventStreamT] :: EventStreamT (m :: Type -> Type) -> SourceT m (Event ByteString)

-- | Server-sent event stream (SSE) for JSON values
newtype JsonEventStreamT (m :: Type -> Type) a
JsonEventStreamT :: SourceT m (Event a) -> JsonEventStreamT (m :: Type -> Type) a
[unJsonEventStreamT] :: JsonEventStreamT (m :: Type -> Type) a -> SourceT m (Event a)

-- | Server-sent event stream (SSE)
--   
--   See https://www.w3.org/TR/2009/WD-eventsource-20090421/ for
--   more details.
newtype EventMessageStreamT (m :: Type -> Type)
EventMessageStreamT :: SourceT m EventMessage -> EventMessageStreamT (m :: Type -> Type)
[unEventMessageStreamT] :: EventMessageStreamT (m :: Type -> Type) -> SourceT m EventMessage
instance GHC.Classes.Eq a => GHC.Classes.Eq (Servant.Client.Core.ServerSentEvents.Event a)
instance GHC.Classes.Eq Servant.Client.Core.ServerSentEvents.EventIgnoreReason
instance GHC.Classes.Eq Servant.Client.Core.ServerSentEvents.EventMessage
instance Control.Monad.IO.Class.MonadIO m => Servant.API.Stream.FromSourceIO Servant.API.ContentTypes.EventStreamChunk (Servant.Client.Core.ServerSentEvents.EventMessageStreamT m)
instance Control.Monad.IO.Class.MonadIO m => Servant.API.Stream.FromSourceIO Servant.API.ContentTypes.EventStreamChunk (Servant.Client.Core.ServerSentEvents.EventStreamT m)
instance (Control.Monad.IO.Class.MonadIO m, Data.Aeson.Types.FromJSON.FromJSON a) => Servant.API.Stream.FromSourceIO Servant.API.ContentTypes.EventStreamChunk (Servant.Client.Core.ServerSentEvents.JsonEventStreamT m a)
instance GHC.Internal.Base.Functor Servant.Client.Core.ServerSentEvents.Event
instance GHC.Internal.Base.Functor m => GHC.Internal.Base.Functor (Servant.Client.Core.ServerSentEvents.JsonEventStreamT m)
instance GHC.Internal.Generics.Generic (Servant.Client.Core.ServerSentEvents.Event a)
instance GHC.Internal.Base.Functor m => GHC.Internal.Base.Monoid (Servant.Client.Core.ServerSentEvents.EventMessageStreamT m)
instance GHC.Internal.Base.Functor m => GHC.Internal.Base.Monoid (Servant.Client.Core.ServerSentEvents.EventStreamT m)
instance GHC.Internal.Base.Functor m => GHC.Internal.Base.Monoid (Servant.Client.Core.ServerSentEvents.JsonEventStreamT m a)
instance GHC.Classes.Ord a => GHC.Classes.Ord (Servant.Client.Core.ServerSentEvents.Event a)
instance GHC.Classes.Ord Servant.Client.Core.ServerSentEvents.EventIgnoreReason
instance GHC.Classes.Ord Servant.Client.Core.ServerSentEvents.EventMessage
instance GHC.Internal.Base.Functor m => GHC.Internal.Base.Semigroup (Servant.Client.Core.ServerSentEvents.EventMessageStreamT m)
instance GHC.Internal.Base.Functor m => GHC.Internal.Base.Semigroup (Servant.Client.Core.ServerSentEvents.EventStreamT m)
instance GHC.Internal.Base.Functor m => GHC.Internal.Base.Semigroup (Servant.Client.Core.ServerSentEvents.JsonEventStreamT m a)
instance GHC.Internal.Show.Show a => GHC.Internal.Show.Show (Servant.Client.Core.ServerSentEvents.Event a)
instance GHC.Internal.Show.Show Servant.Client.Core.ServerSentEvents.EventIgnoreReason
instance GHC.Internal.Show.Show Servant.Client.Core.ServerSentEvents.EventMessage
instance (GHC.Internal.Base.Applicative m, Data.Functor.Classes.Show1 m) => GHC.Internal.Show.Show (Servant.Client.Core.ServerSentEvents.EventMessageStreamT m)
instance GHC.Internal.Show.Show Servant.Client.Core.ServerSentEvents.EventStreamLine
instance (GHC.Internal.Base.Applicative m, Data.Functor.Classes.Show1 m) => GHC.Internal.Show.Show (Servant.Client.Core.ServerSentEvents.EventStreamT m)
instance (GHC.Internal.Base.Applicative m, Data.Functor.Classes.Show1 m, GHC.Internal.Show.Show a) => GHC.Internal.Show.Show (Servant.Client.Core.ServerSentEvents.JsonEventStreamT m a)

module Servant.Client.Core.HasClient

-- | clientIn allows you to produce operations to query an API from
--   a client within a RunClient monad.
--   
--   
--   type MyApi = "books" :> Get '[JSON] [Book] -- GET /books
--           :<|> "books" :> ReqBody '[JSON] Book :> Post '[JSON] Book -- POST /books
--   
--   myApi :: Proxy MyApi
--   myApi = Proxy
--   
--   clientM :: Proxy ClientM
--   clientM = Proxy
--   
--   getAllBooks :: ClientM [Book]
--   postNewBook :: Book -> ClientM Book
--   (getAllBooks :<|> postNewBook) = myApi `clientIn` clientM
--   
clientIn :: forall (m :: Type -> Type) api. HasClient m api => Proxy api -> Proxy m -> Client m api

-- | This class lets us define how each API combinator influences the
--   creation of an HTTP request.
--   
--   Unless you are writing a new backend for servant-client-core
--   or new combinators that you want to support client-generation, you can
--   ignore this class.
class RunClient m => HasClient (m :: Type -> Type) api where {
    type Client (m :: Type -> Type) api;
}
clientWithRoute :: HasClient m api => Proxy m -> Proxy api -> Request -> Client m api
hoistClientMonad :: HasClient m api => Proxy m -> Proxy api -> (forall x. () => mon x -> mon' x) -> Client mon api -> Client mon' api

-- | Singleton type representing a client for an empty API.
data EmptyClient
EmptyClient :: EmptyClient

-- | A type that specifies that an API record contains a client
--   implementation.
data AsClientT (m :: Type -> Type)

-- | Helper to make code using records of clients more readable.
--   
--   Can be mixed with (/:) for supplying arguments.
--   
--   Example:
--   
--   
--   type Api = NamedRoutes RootApi
--   
--   data RootApi mode = RootApi
--     { subApi :: mode :- NamedRoutes SubApi
--     , …
--     } deriving Generic
--   
--   data SubApi mode = SubApi
--     { endpoint :: mode :- Get '[JSON] Person
--     , …
--     } deriving Generic
--   
--   api :: Proxy API
--   api = Proxy
--   
--   rootClient :: RootApi (AsClientT ClientM)
--   rootClient = client api
--   
--   endpointClient :: ClientM Person
--   endpointClient = client // subApi // endpoint
--   
(//) :: a -> (a -> b) -> b
infixl 1 //

-- | Convenience function for supplying arguments to client functions when
--   working with records of clients.
--   
--   Intended to be used in conjunction with (//).
--   
--   Example:
--   
--   
--   type Api = NamedRoutes RootApi
--   
--   data RootApi mode = RootApi
--     { subApi :: mode :- Capture "token" String :> NamedRoutes SubApi
--     , hello :: mode :- Capture "name" String :> Get '[JSON] String
--     , …
--     } deriving Generic
--   
--   data SubApi mode = SubApi
--     { endpoint :: mode :- Get '[JSON] Person
--     , …
--     } deriving Generic
--   
--   api :: Proxy API
--   api = Proxy
--   
--   rootClient :: RootApi (AsClientT ClientM)
--   rootClient = client api
--   
--   hello :: String -> ClientM String
--   hello name = rootClient // hello /: name
--   
--   endpointClient :: ClientM Person
--   endpointClient = client // subApi /: "foobar123" // endpoint
--   
(/:) :: (a -> b -> c) -> b -> a -> c
infixl 2 /:

-- | Convenience function to apply a function to an unknown union element
--   using a type class. All elements of the union must have instances in
--   the type class, and the function is applied unconditionally.
--   
--   See also: matchUnion.
foldMapUnion :: forall c a (as :: [Type]). All c as => Proxy c -> (forall x. c x => x -> a) -> Union as -> a

-- | Convenience function to extract a union element using cast,
--   ie. return the value if the selected type happens to be the actual
--   type of the union in this value, or Nothing otherwise.
--   
--   See also: foldMapUnion.
matchUnion :: forall a (as :: [Type]). IsMember a as => Union as -> Maybe a
fromSomeClientResponse :: forall a m. (Alternative m, Typeable a) => SomeClientResponse -> m (ResponseF a)
instance GHC.Internal.Enum.Bounded Servant.Client.Core.HasClient.EmptyClient
instance GHC.Internal.Enum.Enum Servant.Client.Core.HasClient.EmptyClient
instance GHC.Classes.Eq Servant.Client.Core.HasClient.ClientParseError
instance GHC.Classes.Eq Servant.Client.Core.HasClient.EmptyClient
instance Servant.Client.Core.HasClient.GClientConstraints api m => Servant.Client.Core.HasClient.GClient api m
instance Servant.API.Generic.GenericMode (Servant.Client.Core.HasClient.AsClientT m)
instance (Servant.Client.Core.HasClient.HasClient m a, Servant.Client.Core.HasClient.HasClient m b) => Servant.Client.Core.HasClient.HasClient m (a Servant.API.Alternative.:<|> b)
instance (Servant.Client.Core.HasClient.HasClient m api, Servant.API.ContentTypes.MimeRender ctype chunk, Servant.API.Stream.FramingRender framing, Servant.API.Stream.ToSourceIO chunk a) => Servant.Client.Core.HasClient.HasClient m (Servant.API.Stream.StreamBody' mods framing ctype a Servant.API.Sub.:> api)
instance (GHC.Internal.TypeLits.KnownSymbol path, Servant.Client.Core.HasClient.HasClient m api) => Servant.Client.Core.HasClient.HasClient m (path Servant.API.Sub.:> api)
instance Servant.Client.Core.HasClient.HasClient m api => Servant.Client.Core.HasClient.HasClient m (Data.Vault.Lazy.Vault Servant.API.Sub.:> api)
instance Servant.Client.Core.HasClient.HasClient m api => Servant.Client.Core.HasClient.HasClient m (Servant.API.RemoteHost.RemoteHost Servant.API.Sub.:> api)
instance Servant.Client.Core.HasClient.HasClient m api => Servant.Client.Core.HasClient.HasClient m (Servant.API.IsSecure.IsSecure Servant.API.Sub.:> api)
instance forall k (m :: GHC.Types.Type -> GHC.Types.Type) subapi (res :: k). Servant.Client.Core.HasClient.HasClient m subapi => Servant.Client.Core.HasClient.HasClient m (Servant.API.WithResource.WithResource res Servant.API.Sub.:> subapi)
instance forall k (m :: GHC.Types.Type -> GHC.Types.Type) api (tag :: k). Servant.Client.Core.HasClient.HasClient m api => Servant.Client.Core.HasClient.HasClient m (Servant.API.Experimental.Auth.AuthProtect tag Servant.API.Sub.:> api)
instance (Web.Internal.HttpApiData.ToHttpApiData a, Servant.Client.Core.HasClient.HasClient m api) => Servant.Client.Core.HasClient.HasClient m (Servant.API.Capture.Capture' mods capture a Servant.API.Sub.:> api)
instance (Web.Internal.HttpApiData.ToHttpApiData a, Servant.Client.Core.HasClient.HasClient m sublayout) => Servant.Client.Core.HasClient.HasClient m (Servant.API.Capture.CaptureAll capture a Servant.API.Sub.:> sublayout)
instance (GHC.Internal.TypeLits.KnownSymbol sym, Web.Internal.HttpApiData.ToHttpApiData a, Servant.Client.Core.HasClient.HasClient m api, Data.Singletons.Bool.SBoolI (Servant.API.Modifiers.FoldRequired mods)) => Servant.Client.Core.HasClient.HasClient m (Servant.API.Header.Header' mods sym a Servant.API.Sub.:> api)
instance (Servant.API.TypeLevel.AtMostOneFragment api, Servant.API.TypeLevel.FragmentUnique (Servant.API.Fragment.Fragment a Servant.API.Sub.:> api), Servant.Client.Core.HasClient.HasClient m api) => Servant.Client.Core.HasClient.HasClient m (Servant.API.Fragment.Fragment a Servant.API.Sub.:> api)
instance (GHC.Internal.TypeLits.KnownSymbol sym, Servant.Client.Core.HasClient.HasClient m api) => Servant.Client.Core.HasClient.HasClient m (Servant.API.Host.Host sym Servant.API.Sub.:> api)
instance Servant.Client.Core.HasClient.HasClient m api => Servant.Client.Core.HasClient.HasClient m (Network.HTTP.Types.Version.HttpVersion Servant.API.Sub.:> api)
instance Servant.Client.Core.HasClient.HasClient m api => Servant.Client.Core.HasClient.HasClient m (Servant.API.Description.Summary desc Servant.API.Sub.:> api)
instance Servant.Client.Core.HasClient.HasClient m api => Servant.Client.Core.HasClient.HasClient m (Servant.API.Description.Description desc Servant.API.Sub.:> api)
instance (GHC.Internal.TypeLits.KnownSymbol sym, Web.Internal.HttpApiData.ToHttpApiData a, Servant.Client.Core.HasClient.HasClient m api, Data.Singletons.Bool.SBoolI (Servant.API.Modifiers.FoldRequired mods)) => Servant.Client.Core.HasClient.HasClient m (Servant.API.QueryParam.QueryParam' mods sym a Servant.API.Sub.:> api)
instance (GHC.Internal.TypeLits.KnownSymbol sym, Web.Internal.HttpApiData.ToHttpApiData a, Servant.Client.Core.HasClient.HasClient m api) => Servant.Client.Core.HasClient.HasClient m (Servant.API.QueryParam.QueryParams sym a Servant.API.Sub.:> api)
instance (GHC.Internal.TypeLits.KnownSymbol sym, Servant.Client.Core.HasClient.HasClient m api) => Servant.Client.Core.HasClient.HasClient m (Servant.API.QueryParam.QueryFlag sym Servant.API.Sub.:> api)
instance Servant.Client.Core.HasClient.HasClient m api => Servant.Client.Core.HasClient.HasClient m (Servant.API.QueryString.QueryString Servant.API.Sub.:> api)
instance (GHC.Internal.TypeLits.KnownSymbol sym, Servant.API.QueryString.ToDeepQuery a, Servant.Client.Core.HasClient.HasClient m api) => Servant.Client.Core.HasClient.HasClient m (Servant.API.QueryString.DeepQuery sym a Servant.API.Sub.:> api)
instance (Servant.API.ContentTypes.MimeRender ct a, Servant.Client.Core.HasClient.HasClient m api) => Servant.Client.Core.HasClient.HasClient m (Servant.API.ReqBody.ReqBody' mods (ct : cts) a Servant.API.Sub.:> api)
instance Servant.Client.Core.HasClient.HasClient m api => Servant.Client.Core.HasClient.HasClient m (Servant.API.BasicAuth.BasicAuth realm usr Servant.API.Sub.:> api)
instance forall (m :: GHC.Types.Type -> GHC.Types.Type) a b (arr :: a -> b) sub. (Servant.Client.Core.RunClient.RunClient m, (TypeError ...)) => Servant.Client.Core.HasClient.HasClient m (arr Servant.API.Sub.:> sub)
instance forall k (m :: GHC.Types.Type -> GHC.Types.Type) (ty :: k) sub. (Servant.Client.Core.RunClient.RunClient m, (TypeError ...)) => Servant.Client.Core.HasClient.HasClient m (ty Servant.API.Sub.:> sub)
instance Servant.Client.Core.RunClient.RunClient m => Servant.Client.Core.HasClient.HasClient m Servant.API.Empty.EmptyAPI
instance (Servant.Client.Core.MultiVerb.ResponseUnrender.ResponseListUnrender cs as, Servant.API.ContentTypes.AllMime cs, Servant.API.Verbs.ReflectMethod method, Servant.API.MultiVerb.AsUnion as r, Servant.Client.Core.RunClient.RunClient m) => Servant.Client.Core.HasClient.HasClient m (Servant.API.MultiVerb.MultiVerb method cs as r)
instance (forall (n :: GHC.Types.Type -> GHC.Types.Type). Servant.Client.Core.HasClient.GClient api n, Servant.Client.Core.HasClient.HasClient m (Servant.API.Generic.ToServantApi api), Servant.Client.Core.RunClient.RunClient m, Servant.API.TypeErrors.ErrorIfNoGeneric api) => Servant.Client.Core.HasClient.HasClient m (Servant.API.NamedRoutes.NamedRoutes api)
instance forall k1 (m :: GHC.Types.Type -> GHC.Types.Type) (method :: k1). (Servant.Client.Core.RunClient.RunClient m, Servant.API.Verbs.ReflectMethod method) => Servant.Client.Core.HasClient.HasClient m (Servant.API.Verbs.NoContentVerb method)
instance Servant.Client.Core.RunClient.RunClient m => Servant.Client.Core.HasClient.HasClient m Servant.API.Raw.Raw
instance Servant.Client.Core.RunClient.RunClient m => Servant.Client.Core.HasClient.HasClient m Servant.API.Raw.RawM
instance forall k (m :: GHC.Types.Type -> GHC.Types.Type) (method :: k) (status :: GHC.Internal.TypeNats.Nat). (Servant.Client.Core.RunClient.RunClient m, Servant.Client.Core.HasClient.HasClient m (Servant.Client.Core.HasClient.SseClientDelegate method status (Servant.Client.Core.ServerSentEvents.EventMessageStreamT GHC.Types.IO))) => Servant.Client.Core.HasClient.HasClient m (Servant.API.ServerSentEvents.ServerSentEvents' method status 'Servant.API.ServerSentEvents.RawEvent Servant.Client.Core.ServerSentEvents.EventMessage)
instance forall k (m :: GHC.Types.Type -> GHC.Types.Type) (method :: k) (status :: GHC.Internal.TypeNats.Nat) a. (Servant.Client.Core.RunClient.RunClient m, Servant.Client.Core.HasClient.HasClient m (Servant.Client.Core.HasClient.SseClientDelegate method status (Servant.Client.Core.ServerSentEvents.EventStreamT GHC.Types.IO))) => Servant.Client.Core.HasClient.HasClient m (Servant.API.ServerSentEvents.ServerSentEvents' method status 'Servant.API.ServerSentEvents.RawEvent (Servant.Client.Core.ServerSentEvents.Event a))
instance forall k (m :: GHC.Types.Type -> GHC.Types.Type) (method :: k) (status :: GHC.Internal.TypeNats.Nat) a. (Servant.Client.Core.RunClient.RunClient m, Servant.Client.Core.HasClient.HasClient m (Servant.Client.Core.HasClient.SseClientDelegate method status (Servant.Client.Core.ServerSentEvents.JsonEventStreamT GHC.Types.IO a))) => Servant.Client.Core.HasClient.HasClient m (Servant.API.ServerSentEvents.ServerSentEvents' method status 'Servant.API.ServerSentEvents.JsonEvent a)
instance forall k1 (m :: GHC.Types.Type -> GHC.Types.Type) ct chunk (method :: k1) framing a (status :: GHC.Internal.TypeNats.Nat). (Servant.Client.Core.RunClient.RunStreamingClient m, Servant.API.ContentTypes.MimeUnrender ct chunk, Servant.API.Verbs.ReflectMethod method, Servant.API.Stream.FramingUnrender framing, Servant.API.Stream.FromSourceIO chunk a) => Servant.Client.Core.HasClient.HasClient m (Servant.API.Stream.Stream method status framing ct a)
instance forall k1 (m :: GHC.Types.Type -> GHC.Types.Type) ct chunk (method :: k1) framing a (hs :: [GHC.Types.Type]) (status :: GHC.Internal.TypeNats.Nat). (Servant.Client.Core.RunClient.RunStreamingClient m, Servant.API.ContentTypes.MimeUnrender ct chunk, Servant.API.Verbs.ReflectMethod method, Servant.API.Stream.FramingUnrender framing, Servant.API.Stream.FromSourceIO chunk a, Servant.API.ResponseHeaders.BuildHeadersTo hs) => Servant.Client.Core.HasClient.HasClient m (Servant.API.Stream.Stream method status framing ct (Servant.API.ResponseHeaders.Headers hs a))
instance (Servant.Client.Core.RunClient.RunClient m, contentTypes GHC.Types.~ (contentType : otherContentTypes), as GHC.Types.~ (a : as'), Servant.API.ContentTypes.AllMime contentTypes, Servant.API.Verbs.ReflectMethod method, Data.SOP.Constraint.All (Servant.Client.Core.HasClient.UnrenderResponse contentTypes) as, Data.SOP.Constraint.All Servant.API.UVerb.HasStatus as, Servant.API.UVerb.HasStatuses as', Servant.API.UVerb.Union.Unique (Servant.API.UVerb.Statuses as)) => Servant.Client.Core.HasClient.HasClient m (Servant.API.UVerb.UVerb method contentTypes as)
instance forall k1 (m :: GHC.Types.Type -> GHC.Types.Type) ct a (method :: k1) (cts' :: [GHC.Types.Type]) (cts :: [GHC.Types.Type]) (status :: GHC.Internal.TypeNats.Nat). (Servant.Client.Core.RunClient.RunClient m, Servant.API.ContentTypes.MimeUnrender ct a, Servant.API.Verbs.ReflectMethod method, cts' GHC.Types.~ (ct : cts), GHC.Internal.TypeNats.KnownNat status) => Servant.Client.Core.HasClient.HasClient m (Servant.API.Verbs.Verb method status cts' a)
instance forall k1 (m :: GHC.Types.Type -> GHC.Types.Type) (method :: k1) (status :: GHC.Internal.TypeNats.Nat) (cts :: [GHC.Types.Type]). (Servant.Client.Core.RunClient.RunClient m, Servant.API.Verbs.ReflectMethod method, GHC.Internal.TypeNats.KnownNat status) => Servant.Client.Core.HasClient.HasClient m (Servant.API.Verbs.Verb method status cts Servant.API.ContentTypes.NoContent)
instance forall k1 (m :: GHC.Types.Type -> GHC.Types.Type) ct a (ls :: [GHC.Types.Type]) (status :: GHC.Internal.TypeNats.Nat) (method :: k1) (cts' :: [GHC.Types.Type]) (cts :: [GHC.Types.Type]). (Servant.Client.Core.RunClient.RunClient m, Servant.API.ContentTypes.MimeUnrender ct a, Servant.API.ResponseHeaders.BuildHeadersTo ls, GHC.Internal.TypeNats.KnownNat status, Servant.API.Verbs.ReflectMethod method, cts' GHC.Types.~ (ct : cts)) => Servant.Client.Core.HasClient.HasClient m (Servant.API.Verbs.Verb method status cts' (Servant.API.ResponseHeaders.Headers ls a))
instance forall k1 (m :: GHC.Types.Type -> GHC.Types.Type) (ls :: [GHC.Types.Type]) (method :: k1) (status :: GHC.Internal.TypeNats.Nat) (cts :: [GHC.Types.Type]). (Servant.Client.Core.RunClient.RunClient m, Servant.API.ResponseHeaders.BuildHeadersTo ls, Servant.API.Verbs.ReflectMethod method, GHC.Internal.TypeNats.KnownNat status) => Servant.Client.Core.HasClient.HasClient m (Servant.API.Verbs.Verb method status cts (Servant.API.ResponseHeaders.Headers ls Servant.API.ContentTypes.NoContent))
instance Servant.Client.Core.HasClient.HasClient m subapi => Servant.Client.Core.HasClient.HasClient m (Servant.API.WithNamedContext.WithNamedContext name context subapi)
instance (Servant.Client.Core.RunClient.RunClient m, (TypeError ...)) => Servant.Client.Core.HasClient.HasClient m api
instance GHC.Internal.Show.Show Servant.Client.Core.HasClient.ClientParseError
instance GHC.Internal.Show.Show Servant.Client.Core.HasClient.EmptyClient
instance (Servant.Client.Core.HasClient.UnrenderResponse cts a, Servant.API.ResponseHeaders.BuildHeadersTo h) => Servant.Client.Core.HasClient.UnrenderResponse cts (Servant.API.ResponseHeaders.Headers h a)
instance Servant.Client.Core.HasClient.UnrenderResponse cts a => Servant.Client.Core.HasClient.UnrenderResponse cts (Servant.API.UVerb.WithStatus n a)
instance Servant.API.ContentTypes.AllMimeUnrender cts a => Servant.Client.Core.HasClient.UnrenderResponse cts a

-- | This module is a utility for servant-client-core backend
--   writers. It contains all the functionality from
--   servant-client-core that should be re-exported.
module Servant.Client.Core.Reexport

-- | This class lets us define how each API combinator influences the
--   creation of an HTTP request.
--   
--   Unless you are writing a new backend for servant-client-core
--   or new combinators that you want to support client-generation, you can
--   ignore this class.
class RunClient m => HasClient (m :: Type -> Type) api where {
    type Client (m :: Type -> Type) api;
}
clientWithRoute :: HasClient m api => Proxy m -> Proxy api -> Request -> Client m api
hoistClientMonad :: HasClient m api => Proxy m -> Proxy api -> (forall x. () => mon x -> mon' x) -> Client mon api -> Client mon' api

-- | Convenience function to apply a function to an unknown union element
--   using a type class. All elements of the union must have instances in
--   the type class, and the function is applied unconditionally.
--   
--   See also: matchUnion.
foldMapUnion :: forall c a (as :: [Type]). All c as => Proxy c -> (forall x. c x => x -> a) -> Union as -> a

-- | Convenience function to extract a union element using cast,
--   ie. return the value if the selected type happens to be the actual
--   type of the union in this value, or Nothing otherwise.
--   
--   See also: foldMapUnion.
matchUnion :: forall a (as :: [Type]). IsMember a as => Union as -> Maybe a

-- | A type that specifies that an API record contains a client
--   implementation.
data AsClientT (m :: Type -> Type)

-- | Helper to make code using records of clients more readable.
--   
--   Can be mixed with (/:) for supplying arguments.
--   
--   Example:
--   
--   
--   type Api = NamedRoutes RootApi
--   
--   data RootApi mode = RootApi
--     { subApi :: mode :- NamedRoutes SubApi
--     , …
--     } deriving Generic
--   
--   data SubApi mode = SubApi
--     { endpoint :: mode :- Get '[JSON] Person
--     , …
--     } deriving Generic
--   
--   api :: Proxy API
--   api = Proxy
--   
--   rootClient :: RootApi (AsClientT ClientM)
--   rootClient = client api
--   
--   endpointClient :: ClientM Person
--   endpointClient = client // subApi // endpoint
--   
(//) :: a -> (a -> b) -> b
infixl 1 //

-- | Convenience function for supplying arguments to client functions when
--   working with records of clients.
--   
--   Intended to be used in conjunction with (//).
--   
--   Example:
--   
--   
--   type Api = NamedRoutes RootApi
--   
--   data RootApi mode = RootApi
--     { subApi :: mode :- Capture "token" String :> NamedRoutes SubApi
--     , hello :: mode :- Capture "name" String :> Get '[JSON] String
--     , …
--     } deriving Generic
--   
--   data SubApi mode = SubApi
--     { endpoint :: mode :- Get '[JSON] Person
--     , …
--     } deriving Generic
--   
--   api :: Proxy API
--   api = Proxy
--   
--   rootClient :: RootApi (AsClientT ClientM)
--   rootClient = client api
--   
--   hello :: String -> ClientM String
--   hello name = rootClient // hello /: name
--   
--   endpointClient :: ClientM Person
--   endpointClient = client // subApi /: "foobar123" // endpoint
--   
(/:) :: (a -> b -> c) -> b -> a -> c
infixl 2 /:
type Response = ResponseF ByteString
type StreamingResponse = ResponseF SourceIO ByteString
data ResponseF a
Response :: Status -> Seq Header -> HttpVersion -> a -> ResponseF a
[responseStatusCode] :: ResponseF a -> Status
[responseHeaders] :: ResponseF a -> Seq Header
[responseHttpVersion] :: ResponseF a -> HttpVersion
[responseBody] :: ResponseF a -> a

-- | A type representing possible errors in a request
--   
--   Note that this type substantially changed in 0.12.
data ClientError

-- | The server returned an error response including the failing request.
--   requestPath includes the BaseUrl and the path of the
--   request.
FailureResponse :: RequestF () (BaseUrl, ByteString) -> Response -> ClientError

-- | The body could not be decoded at the expected type
DecodeFailure :: Text -> Response -> ClientError

-- | The content-type of the response is not supported
UnsupportedContentType :: MediaType -> Response -> ClientError

-- | The content-type header is invalid
InvalidContentTypeHeader :: Response -> ClientError

-- | There was a connection error, and no response was received
ConnectionError :: SomeException -> ClientError

-- | Singleton type representing a client for an empty API.
data EmptyClient
EmptyClient :: EmptyClient

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

-- | URI scheme to use
data Scheme

-- | http://
Http :: Scheme

-- | https://
Https :: Scheme

-- | 
--   >>> showBaseUrl <$> parseBaseUrl "api.example.com"
--   "http://api.example.com"
--   
showBaseUrl :: BaseUrl -> String

-- | 
--   >>> parseBaseUrl "api.example.com"
--   BaseUrl {baseUrlScheme = Http, baseUrlHost = "api.example.com", baseUrlPort = 80, baseUrlPath = ""}
--   
--   
--   Note: trailing slash is removed
--   
--   
--   >>> parseBaseUrl "api.example.com/"
--   BaseUrl {baseUrlScheme = Http, baseUrlHost = "api.example.com", baseUrlPort = 80, baseUrlPath = ""}
--   
--   
--   
--   >>> parseBaseUrl "api.example.com/dir/"
--   BaseUrl {baseUrlScheme = Http, baseUrlHost = "api.example.com", baseUrlPort = 80, baseUrlPath = "/dir"}
--   
parseBaseUrl :: MonadThrow m => String -> m BaseUrl
data InvalidBaseUrlException

-- | This module provides backend-agnostic functionality for generating
--   clients from servant APIs. By "backend," we mean something
--   that concretely executes the request, such as:
--   
--   
--   
- The http-client library
--   
- The haxl library
--   
- GHCJS via FFI
--   
--   
--   etc.
--   
--   Each backend is encapsulated in a monad that is an instance of the
--   RunClient class.
--   
--   This library is primarily of interest to backend-writers and
--   combinator-writers. For more information, see the README.md
module Servant.Client.Core

-- | clientIn allows you to produce operations to query an API from
--   a client within a RunClient monad.
--   
--   
--   type MyApi = "books" :> Get '[JSON] [Book] -- GET /books
--           :<|> "books" :> ReqBody '[JSON] Book :> Post '[JSON] Book -- POST /books
--   
--   myApi :: Proxy MyApi
--   myApi = Proxy
--   
--   clientM :: Proxy ClientM
--   clientM = Proxy
--   
--   getAllBooks :: ClientM [Book]
--   postNewBook :: Book -> ClientM Book
--   (getAllBooks :<|> postNewBook) = myApi `clientIn` clientM
--   
clientIn :: forall (m :: Type -> Type) api. HasClient m api => Proxy api -> Proxy m -> Client m api

-- | This class lets us define how each API combinator influences the
--   creation of an HTTP request.
--   
--   Unless you are writing a new backend for servant-client-core
--   or new combinators that you want to support client-generation, you can
--   ignore this class.
class RunClient m => HasClient (m :: Type -> Type) api where {
    type Client (m :: Type -> Type) api;
}
clientWithRoute :: HasClient m api => Proxy m -> Proxy api -> Request -> Client m api
hoistClientMonad :: HasClient m api => Proxy m -> Proxy api -> (forall x. () => mon x -> mon' x) -> Client mon api -> Client mon' api

-- | Convenience function to apply a function to an unknown union element
--   using a type class. All elements of the union must have instances in
--   the type class, and the function is applied unconditionally.
--   
--   See also: matchUnion.
foldMapUnion :: forall c a (as :: [Type]). All c as => Proxy c -> (forall x. c x => x -> a) -> Union as -> a

-- | Convenience function to extract a union element using cast,
--   ie. return the value if the selected type happens to be the actual
--   type of the union in this value, or Nothing otherwise.
--   
--   See also: foldMapUnion.
matchUnion :: forall a (as :: [Type]). IsMember a as => Union as -> Maybe a
type Request = RequestF RequestBody Builder
data RequestF body path
Request :: path -> Seq QueryItem -> Maybe (body, MediaType) -> Seq MediaType -> Seq Header -> HttpVersion -> Method -> RequestF body path
[requestPath] :: RequestF body path -> path
[requestQueryString] :: RequestF body path -> Seq QueryItem
[requestBody] :: RequestF body path -> Maybe (body, MediaType)
[requestAccept] :: RequestF body path -> Seq MediaType
[requestHeaders] :: RequestF body path -> Seq Header
[requestHttpVersion] :: RequestF body path -> HttpVersion
[requestMethod] :: RequestF body path -> Method
defaultRequest :: Request

-- | The request body. R replica of the http-client
--   RequestBody.
data RequestBody
RequestBodyLBS :: ByteString -> RequestBody
RequestBodyBS :: ByteString -> RequestBody
RequestBodySource :: SourceIO ByteString -> RequestBody

-- | Handy helper to avoid wrapping datatypes in tuples everywhere.
--   
--   NOTE: THIS API IS EXPERIMENTAL AND SUBJECT TO CHANGE
mkAuthenticatedRequest :: AuthClientData a -> (AuthClientData a -> Request -> Request) -> AuthenticatedRequest a

-- | Authenticate a request using Basic Authentication
basicAuthReq :: BasicAuthData -> Request -> Request

-- | 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 AuthenticatedRequest a
AuthenticatedRequest :: (AuthClientData a, AuthClientData a -> Request -> Request) -> AuthenticatedRequest a
[unAuthReq] :: AuthenticatedRequest a -> (AuthClientData a, AuthClientData a -> Request -> Request)

-- | 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
type family AuthClientData a

-- | A type representing possible errors in a request
--   
--   Note that this type substantially changed in 0.12.
data ClientError

-- | The server returned an error response including the failing request.
--   requestPath includes the BaseUrl and the path of the
--   request.
FailureResponse :: RequestF () (BaseUrl, ByteString) -> Response -> ClientError

-- | The body could not be decoded at the expected type
DecodeFailure :: Text -> Response -> ClientError

-- | The content-type of the response is not supported
UnsupportedContentType :: MediaType -> Response -> ClientError

-- | The content-type header is invalid
InvalidContentTypeHeader :: Response -> ClientError

-- | There was a connection error, and no response was received
ConnectionError :: SomeException -> ClientError

-- | Singleton type representing a client for an empty API.
data EmptyClient
EmptyClient :: EmptyClient
type Response = ResponseF ByteString
data ResponseF a
Response :: Status -> Seq Header -> HttpVersion -> a -> ResponseF a
[responseStatusCode] :: ResponseF a -> Status
[responseHeaders] :: ResponseF a -> Seq Header
[responseHttpVersion] :: ResponseF a -> HttpVersion
[responseBody] :: ResponseF a -> a
class Monad m => RunClient (m :: Type -> Type)

-- | How to make a request, with an optional list of status codes to not
--   throw exceptions for (default: [200..299]).
runRequestAcceptStatus :: RunClient m => Maybe [Status] -> Request -> m Response
throwClientError :: RunClient m => ClientError -> m a

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

-- | URI scheme to use
data Scheme

-- | http://
Http :: Scheme

-- | https://
Https :: Scheme

-- | 
--   >>> showBaseUrl <$> parseBaseUrl "api.example.com"
--   "http://api.example.com"
--   
showBaseUrl :: BaseUrl -> String

-- | 
--   >>> parseBaseUrl "api.example.com"
--   BaseUrl {baseUrlScheme = Http, baseUrlHost = "api.example.com", baseUrlPort = 80, baseUrlPath = ""}
--   
--   
--   Note: trailing slash is removed
--   
--   
--   >>> parseBaseUrl "api.example.com/"
--   BaseUrl {baseUrlScheme = Http, baseUrlHost = "api.example.com", baseUrlPort = 80, baseUrlPath = ""}
--   
--   
--   
--   >>> parseBaseUrl "api.example.com/dir/"
--   BaseUrl {baseUrlScheme = Http, baseUrlHost = "api.example.com", baseUrlPort = 80, baseUrlPath = "/dir"}
--   
parseBaseUrl :: MonadThrow m => String -> m BaseUrl
newtype InvalidBaseUrlException
InvalidBaseUrlException :: String -> InvalidBaseUrlException
class RunClient m => RunStreamingClient (m :: Type -> Type)
withStreamingRequest :: RunStreamingClient m => Request -> (StreamingResponse -> IO a) -> m a
type StreamingResponse = ResponseF SourceIO ByteString

-- | Add header to the request being constructed.
addHeader :: ToHttpApiData a => HeaderName -> a -> Request -> Request

-- | Append a query parameter to the request being constructed.
appendToQueryString :: Text -> Maybe ByteString -> Request -> Request

-- | Append extra path to the request being constructed.
--   
--   Warning: This function assumes that the path fragment is already
--   URL-encoded.
appendToPath :: Builder -> Request -> Request

-- | Set body and media type of the request being constructed.
--   
--   The body is set to the given bytestring using the
--   RequestBodyLBS constructor.
setRequestBodyLBS :: ByteString -> MediaType -> Request -> Request

-- | Set body and media type of the request being constructed.
setRequestBody :: RequestBody -> MediaType -> Request -> Request

-- | Encode a query parameter value.
encodeQueryParamValue :: ToHttpApiData a => a -> ByteString

module Servant.Client.Free
client :: HasClient (Free ClientF) api => Proxy api -> Client (Free ClientF) api

-- | ClientF cannot stream.
--   
--   Compare to RunClient.
data ClientF a
RunRequest :: Request -> (Response -> a) -> ClientF a
Throw :: ClientError -> ClientF a

module Servant.Client.Generic

-- | A type that specifies that an API record contains a client
--   implementation.
data AsClientT (m :: Type -> Type)

-- | Generate a record of client functions.
genericClient :: forall routes (m :: Type -> Type). (HasClient m (ToServantApi routes), GenericServant routes (AsClientT m), Client m (ToServantApi routes) ~ ToServant routes (AsClientT m)) => routes (AsClientT m)

-- | genericClient but with hoistClientMonad in between.
genericClientHoist :: forall routes m n. (HasClient m (ToServantApi routes), GenericServant routes (AsClientT n), Client n (ToServantApi routes) ~ ToServant routes (AsClientT n)) => (forall x. () => m x -> n x) -> routes (AsClientT n)
