@@ -1,4 +1,3 @@
1−{-# LANGUAGE AllowAmbiguousTypes #-}
21{-# LANGUAGE CPP #-}
32{-# LANGUAGE DataKinds #-}
43{-# LANGUAGE FlexibleContexts #-}
@@ -17,23 +16,34 @@
1716-- querying functions for each endpoint just from the type representing your
1817-- API.
1918module Servant.Client.Core
20− ( AuthClientData
21− , AuthenticateReq(..)
22− , clientIn
19+ (
20+ -- * Client generation
21+ clientIn
2322 , HasClient(..)
23+
24+ -- * Authentication
2425 , mkAuthenticateReq
26+ , AuthenticateReq(..)
27+ , AuthClientData
28+
29+ -- * Generic Client
30+ , ClientLike(..)
31+ , genericMkClientL
32+ , genericMkClientP
2533 , ServantError(..)
2634 , EmptyClient(..)
27− , RunClient(..)
35+
36+ -- * Request
2837 , Request(..)
2938 , defaultRequest
30− , Response(..)
3139 , RequestBody(..)
40+
41+ -- * Response
42+ , Response(..)
43+ , RunClient(..)
3244 , module Servant.Client.Core.Internal.BaseUrl
33− , ClientLike(..)
34− , genericMkClientL
35− , genericMkClientP
36− -- * Writing instances
45+
46+ -- * Writing HasClient instances
3747 , addHeader
3848 , appendToQueryString
3949 , appendToPath
@@ -84,13 +94,13 @@ import Servant.Client.Core.Internal.BaseUrl (BaseUrl (..),
8494 showBaseUrl)
8595import Servant.Client.Core.Internal.BasicAuth
8696import Servant.Client.Core.Internal.Class
87−import Servant.Client.Core.Internal.Request
8897import Servant.Client.Core.Internal.Generic
98+import Servant.Client.Core.Internal.Request
8999
90100-- * Accessing APIs as a Client
91101
92−-- | 'client' allows you to produce operations to query an API from a client within
93−-- a given monadic context `m`
102+-- | 'clientIn' allows you to produce operations to query an API from a client
103+-- within a 'RunClient' monad.
94104--
95105-- > type MyApi = "books" :> Get '[JSON] [Book] -- GET /books
96106-- > :<|> "books" :> ReqBody '[JSON] Book :> Post '[JSON] Book -- POST /books
@@ -108,9 +118,12 @@ clientIn :: HasClient m api => Proxy api -> Proxy m -> Client m api
108118clientIn p pm = clientWithRoute pm p defaultRequest
109119
110120
111−-- | This class lets us define how each API combinator
112−-- influences the creation of an HTTP request. It's mostly
113−-- an internal class, you can just use 'client'.
121+-- | This class lets us define how each API combinator influences the creation
122+-- of an HTTP request.
123+--
124+-- Unless you are writing a new backend for @servant-client-core@ or new
125+-- combinators that you want to support client-generation, you can ignore this
126+-- class.
114127class RunClient m => HasClient m api where
115128 type Client (m :: * -> *) (api :: *) :: *
116129 clientWithRoute :: Proxy m -> Proxy api -> Request -> Client m api