on master help sign in
Rename EmptyAPIClient to EmptyClient
0bbc4f9David Turner
doc/tutorial/Client.lhs+1−3
@@ -77,8 +77,6 @@ hello :: Maybe String -- ^ an optional value for "name"
77
77
78marketing :: ClientInfo -- ^ value for the request body
78marketing :: ClientInfo -- ^ value for the request body
79 -> ClientM Email
79 -> ClientM Email
80−
81−emptyClient :: EmptyAPIClient
82```
80```
83
81
84Each function makes available as an argument any value that the response may
82Each function makes available as an argument any value that the response may
@@ -91,7 +89,7 @@ the function `client`. It takes one argument:
91api :: Proxy API
89api :: Proxy API
92api = Proxy
90api = Proxy
93
91
94−position :<|> hello :<|> marketing :<|> emptyClient = client api
92+position :<|> hello :<|> marketing :<|> EmptyClient = client api
95```
93```
96
94
97`client api` returns client functions for our _entire_ API, combined with `:<|>`, which we can pattern match on as above. You could say `client` "calculates" the correct type and number of client functions for the API type it is given (via a `Proxy`), as well as their implementations.
95`client api` returns client functions for our _entire_ API, combined with `:<|>`, which we can pattern match on as above. You could say `client` "calculates" the correct type and number of client functions for the API type it is given (via a `Proxy`), as well as their implementations.
servant-client/src/Servant/Client.hs+6−6
@@ -24,7 +24,7 @@ module Servant.Client
24 , ClientEnv (ClientEnv)
24 , ClientEnv (ClientEnv)
25 , mkAuthenticateReq
25 , mkAuthenticateReq
26 , ServantError(..)
26 , ServantError(..)
27− , EmptyAPIClient(..)
27+ , EmptyClient(..)
28 , module Servant.Common.BaseUrl
28 , module Servant.Common.BaseUrl
29 ) where
29 ) where
30
30
@@ -90,9 +90,9 @@ instance (HasClient a, HasClient b) => HasClient (a :<|> b) where
90 clientWithRoute (Proxy :: Proxy b) req
90 clientWithRoute (Proxy :: Proxy b) req
91
91
92-- | Singleton type representing a client for an empty API.
92-- | Singleton type representing a client for an empty API.
93−data EmptyAPIClient = EmptyAPIClient
93+data EmptyClient = EmptyClient deriving (Eq, Show, Bounded, Enum)
94
94
95−-- | The client for 'EmptyAPI' is simply 'EmptyAPIClient'.
95+-- | The client for 'EmptyAPI' is simply 'EmptyClient'.
96--
96--
97-- > type MyAPI = "books" :> Get '[JSON] [Book] -- GET /books
97-- > type MyAPI = "books" :> Get '[JSON] [Book] -- GET /books
98-- > :<|> "nothing" :> EmptyAPI
98-- > :<|> "nothing" :> EmptyAPI
@@ -101,10 +101,10 @@ data EmptyAPIClient = EmptyAPIClient
101-- > myApi = Proxy
101-- > myApi = Proxy
102-- >
102-- >
103-- > getAllBooks :: ClientM [Book]
103-- > getAllBooks :: ClientM [Book]
104−-- > (getAllBooks :<|> EmptyAPIClient) = client myApi
104+-- > (getAllBooks :<|> EmptyClient) = client myApi
105instance HasClient EmptyAPI where
105instance HasClient EmptyAPI where
106− type Client EmptyAPI = EmptyAPIClient
106+ type Client EmptyAPI = EmptyClient
107− clientWithRoute Proxy _ = EmptyAPIClient
107+ clientWithRoute Proxy _ = EmptyClient
108
108
109-- | If you use a 'Capture' in one of your endpoints in your API,
109-- | If you use a 'Capture' in one of your endpoints in your API,
110-- the corresponding querying function will automatically take
110-- the corresponding querying function will automatically take
servant-client/test/Servant/ClientSpec.hs+1−1
@@ -146,7 +146,7 @@ getGet
146 :<|> getMultiple
146 :<|> getMultiple
147 :<|> getRespHeaders
147 :<|> getRespHeaders
148 :<|> getDeleteContentType
148 :<|> getDeleteContentType
149− :<|> EmptyAPIClient = client api
149+ :<|> EmptyClient = client api
150
150
151server :: Application
151server :: Application
152server = serve api (
152server = serve api (