@@ -56,11 +56,11 @@
57-- > where g = Greet "Hello, haskeller!"
57-- > where g = Greet "Hello, haskeller!"
59−-- > instance ToParam (GetParam "capital" Bool) where
59+-- > instance ToParam (QueryParam "capital" Bool) where
60-- > toParam _ =
60-- > toParam _ =
61−-- > DocGetParam "capital"
61+-- > DocQueryParam "capital"
62−-- > ["true", "false"]
62+-- > ["true", "false"]
63−-- > "Get the greeting message in uppercase (true) or not (false). Default is false."
63+-- > "Get the greeting message in uppercase (true) or not (false). Default is false."
65-- > instance ToCapture (Capture "name" Text) where
65-- > instance ToCapture (Capture "name" Text) where
66-- > toCapture _ = DocCapture "name" "name of the person to greet"
66-- > toCapture _ = DocCapture "name" "name of the person to greet"
@@ -70,7 +70,7 @@
71-- > -- API specification
71-- > -- API specification
72-- > type TestApi =
72-- > type TestApi =
73−-- > "hello" :> Capture "name" Text :> GetParam "capital" Bool :> Get Greet
73+-- > "hello" :> Capture "name" Text :> QueryParam "capital" Bool :> Get Greet
74-- > :<|> "greet" :> RQBody Greet :> Post Greet
74-- > :<|> "greet" :> RQBody Greet :> Post Greet
75-- > :<|> "delete" :> Capture "greetid" Text :> Delete
75-- > :<|> "delete" :> Capture "greetid" Text :> Delete
@@ -95,7 +95,7 @@ module Servant.Docs
95 , Endpoint, path, method, defEndpoint
95 , Endpoint, path, method, defEndpoint
96 , API, emptyAPI
96 , API, emptyAPI
97 , DocCapture(..), capSymbol, capDesc
97 , DocCapture(..), capSymbol, capDesc
98− , DocGetParam(..), paramName, paramValues, paramDesc
98+ , DocQueryParam(..), paramName, paramValues, paramDesc
99 , Response, respStatus, respBody, defResponse
99 , Response, respStatus, respBody, defResponse
100 , Action, captures, params, rqbody, response, defAction
100 , Action, captures, params, rqbody, response, defAction
@@ -190,12 +190,12 @@ data DocCapture = DocCapture
190 , _capDesc :: String -- user supplied
190 , _capDesc :: String -- user supplied
191 } deriving (Eq, Show)
191 } deriving (Eq, Show)
193−-- | A type to represent /GET/ parameters. Holds its name,
193+-- | A type to represent a /GET/ parameter from the Query String. Holds its name,
194-- the possible values (leave empty if there isn't a finite number of them),
194-- the possible values (leave empty if there isn't a finite number of them),
195-- and a description of how it influences the output or behavior.
195-- and a description of how it influences the output or behavior.
197-- Write a 'ToParam' instance for your GET parameter types
197-- Write a 'ToParam' instance for your GET parameter types
198−data DocGetParam = DocGetParam
198+data DocQueryParam = DocQueryParam
199 { _paramName :: String -- type supplied
199 { _paramName :: String -- type supplied
200 , _paramValues :: [String] -- user supplied
200 , _paramValues :: [String] -- user supplied
201 , _paramDesc :: String -- user supplied
201 , _paramDesc :: String -- user supplied
@@ -243,7 +243,7 @@ defResponse = Response 200 Nothing
243-- to transform an action and add some information to it.
243-- to transform an action and add some information to it.
244data Action = Action
244data Action = Action
245 { _captures :: [DocCapture] -- type collected + user supplied info
245 { _captures :: [DocCapture] -- type collected + user supplied info
246− , _params :: [DocGetParam] -- type collected + user supplied info
246+ , _params :: [DocQueryParam] -- type collected + user supplied info
247 , _rqbody :: Maybe ByteString -- user supplied
247 , _rqbody :: Maybe ByteString -- user supplied
248 , _response :: Response -- user supplied
248 , _response :: Response -- user supplied
249 } deriving (Eq, Show)
249 } deriving (Eq, Show)
@@ -273,7 +273,7 @@ single = HM.singleton
273-- gimme some lenses
273-- gimme some lenses
274makeLenses ''Endpoint
274makeLenses ''Endpoint
275makeLenses ''DocCapture
275makeLenses ''DocCapture
276−makeLenses ''DocGetParam
276+makeLenses ''DocQueryParam
277makeLenses ''Response
277makeLenses ''Response
278makeLenses ''Action
278makeLenses ''Action
@@ -319,13 +319,13 @@ class ToJSON a => ToSample a where
320-- Example of an instance:
320-- Example of an instance:
322−-- > instance ToParam (GetParam "capital" Bool) where
322+-- > instance ToParam (QueryParam "capital" Bool) where
323-- > toParam _ =
323-- > toParam _ =
324−-- > DocGetParam "capital"
324+-- > DocQueryParam "capital"
325−-- > ["true", "false"]
325+-- > ["true", "false"]
326−-- > "Get the greeting message in uppercase (true) or not (false). Default is false."
326+-- > "Get the greeting message in uppercase (true) or not (false). Default is false."
327class ToParam t where
327class ToParam t where
328− toParam :: Proxy t -> DocGetParam
328+ toParam :: Proxy t -> DocQueryParam
330-- | The class that helps us automatically get documentation
330-- | The class that helps us automatically get documentation
331-- for URL captures.
331-- for URL captures.
@@ -364,7 +364,7 @@ printMarkdown = imapM_ printEndpoint
364 captureStr cap =
364 captureStr cap =
365 putStrLn $ "- *" ++ (cap ^. capSymbol) ++ "*: " ++ (cap ^. capDesc)
365 putStrLn $ "- *" ++ (cap ^. capSymbol) ++ "*: " ++ (cap ^. capDesc)
367− paramsStr :: [DocGetParam] -> IO ()
367+ paramsStr :: [DocQueryParam] -> IO ()
368 paramsStr [] = return ()
368 paramsStr [] = return ()
369 paramsStr l = do
369 paramsStr l = do
370 putStrLn "**GET Parameters**: "
370 putStrLn "**GET Parameters**: "