@@ -62,6 +62,7 @@ Enough chitchat, let's see an example. Consider the following API type from the
6262type API = "position" :> Capture "x" Int :> Capture "y" Int :> Get '[JSON] Position
6363 :<|> "hello" :> QueryParam "name" String :> Get '[JSON] HelloMessage
6464 :<|> "marketing" :> ReqBody '[JSON] ClientInfo :> Post '[JSON] Email
65+ :<|> EmptyAPI
6566```
6667
6768What we are going to get with **servant-client** here is three functions, one to query each endpoint:
@@ -76,6 +77,8 @@ hello :: Maybe String -- ^ an optional value for "name"
7677
7778marketing :: ClientInfo -- ^ value for the request body
7879 -> ClientM Email
80+
81+emptyClient :: EmptyAPIClient
7982```
8083
8184Each function makes available as an argument any value that the response may
@@ -88,7 +91,7 @@ the function `client`. It takes one argument:
8891api :: Proxy API
8992api = Proxy
9093
91−position :<|> hello :<|> marketing = client api
94+position :<|> hello :<|> marketing :<|> emptyClient = client api
9295```
9396
9497`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.