2018-03-11 16:58:31 +01:00
|
|
|
{-# LANGUAGE DataKinds #-}
|
2016-01-16 19:17:46 +01:00
|
|
|
{-# LANGUAGE TypeOperators #-}
|
|
|
|
|
2016-01-18 19:55:14 +01:00
|
|
|
-- | This is a module containing an API with all `Servant.API` combinators. It
|
|
|
|
-- is used for testing only (in particular, checking that instances exist for
|
|
|
|
-- the core servant classes for each combinator), and should not be imported.
|
2016-01-16 19:17:46 +01:00
|
|
|
module Servant.API.Internal.Test.ComprehensiveAPI where
|
|
|
|
|
|
|
|
import Data.Proxy
|
2018-06-23 22:09:28 +02:00
|
|
|
(Proxy (..))
|
2016-01-16 19:17:46 +01:00
|
|
|
import Servant.API
|
2018-06-26 19:11:28 +02:00
|
|
|
import Servant.Types.SourceT
|
|
|
|
(SourceT)
|
2016-01-16 19:17:46 +01:00
|
|
|
|
2016-07-08 09:11:34 +02:00
|
|
|
type GET = Get '[JSON] NoContent
|
2016-01-16 19:17:46 +01:00
|
|
|
|
|
|
|
type ComprehensiveAPI =
|
2016-08-17 15:51:10 +02:00
|
|
|
ComprehensiveAPIWithoutRaw :<|>
|
|
|
|
Raw
|
|
|
|
|
|
|
|
comprehensiveAPI :: Proxy ComprehensiveAPI
|
|
|
|
comprehensiveAPI = Proxy
|
|
|
|
|
|
|
|
type ComprehensiveAPIWithoutRaw =
|
2016-01-16 19:17:46 +01:00
|
|
|
GET :<|>
|
|
|
|
Get '[JSON] Int :<|>
|
2018-02-09 11:05:30 +01:00
|
|
|
Capture' '[Description "example description"] "foo" Int :> GET :<|>
|
2016-01-16 19:17:46 +01:00
|
|
|
Header "foo" Int :> GET :<|>
|
2017-12-10 13:25:14 +01:00
|
|
|
Header' '[Required, Lenient] "bar" Int :> GET :<|>
|
2016-01-16 19:34:44 +01:00
|
|
|
HttpVersion :> GET :<|>
|
2016-01-16 19:17:46 +01:00
|
|
|
IsSecure :> GET :<|>
|
|
|
|
QueryParam "foo" Int :> GET :<|>
|
2017-12-10 13:25:14 +01:00
|
|
|
QueryParam' '[Required, Lenient] "bar" Int :> GET :<|>
|
2016-01-16 19:17:46 +01:00
|
|
|
QueryParams "foo" Int :> GET :<|>
|
|
|
|
QueryFlag "foo" :> GET :<|>
|
2016-01-18 11:01:30 +01:00
|
|
|
RemoteHost :> GET :<|>
|
2016-01-16 19:17:46 +01:00
|
|
|
ReqBody '[JSON] Int :> GET :<|>
|
2017-12-10 13:25:14 +01:00
|
|
|
ReqBody' '[Lenient] '[JSON] Int :> GET :<|>
|
2016-07-08 09:11:34 +02:00
|
|
|
Get '[JSON] (Headers '[Header "foo" Int] NoContent) :<|>
|
2016-01-16 19:17:46 +01:00
|
|
|
"foo" :> GET :<|>
|
|
|
|
Vault :> GET :<|>
|
2016-07-08 09:11:34 +02:00
|
|
|
Verb 'POST 204 '[JSON] NoContent :<|>
|
2016-01-18 21:27:19 +01:00
|
|
|
Verb 'POST 204 '[JSON] Int :<|>
|
2018-06-26 19:11:28 +02:00
|
|
|
StreamBody NetstringFraming JSON (SourceT IO Int) :> Stream 'GET 200 NetstringFraming JSON (SourceT IO Int) :<|>
|
2016-07-04 14:38:00 +02:00
|
|
|
WithNamedContext "foo" '[] GET :<|>
|
2017-05-16 12:26:06 +02:00
|
|
|
CaptureAll "foo" Int :> GET :<|>
|
2017-06-08 16:35:24 +02:00
|
|
|
Summary "foo" :> GET :<|>
|
|
|
|
Description "foo" :> GET :<|>
|
2017-05-16 12:26:06 +02:00
|
|
|
EmptyAPI
|
2016-01-16 19:17:46 +01:00
|
|
|
|
2016-08-17 15:51:10 +02:00
|
|
|
comprehensiveAPIWithoutRaw :: Proxy ComprehensiveAPIWithoutRaw
|
|
|
|
comprehensiveAPIWithoutRaw = Proxy
|