module refactoring: putting some things in Servant.Common
This commit is contained in:
parent
1cd35034e9
commit
165022a554
17 changed files with 30 additions and 30 deletions
|
@ -22,7 +22,7 @@ import Servant.API
|
||||||
import Servant.Client
|
import Servant.Client
|
||||||
import Servant.Docs
|
import Servant.Docs
|
||||||
import Servant.Server
|
import Servant.Server
|
||||||
import Servant.Utils.BaseUrl
|
import Servant.Common.BaseUrl
|
||||||
|
|
||||||
-- * Example
|
-- * Example
|
||||||
|
|
||||||
|
|
|
@ -26,13 +26,13 @@ library
|
||||||
Servant.API.ReqBody
|
Servant.API.ReqBody
|
||||||
Servant.API.Sub
|
Servant.API.Sub
|
||||||
Servant.Client
|
Servant.Client
|
||||||
|
Servant.Common.BaseUrl
|
||||||
|
Servant.Common.Req
|
||||||
|
Servant.Common.Text
|
||||||
Servant.Docs
|
Servant.Docs
|
||||||
Servant.Server
|
Servant.Server
|
||||||
Servant.Utils.ApiQuasiQuoting
|
Servant.Utils.ApiQuasiQuoting
|
||||||
Servant.Utils.BaseUrl
|
|
||||||
Servant.Utils.Links
|
Servant.Utils.Links
|
||||||
Servant.Utils.Req
|
|
||||||
Servant.Utils.Text
|
|
||||||
build-depends:
|
build-depends:
|
||||||
base >=4.7 && <5
|
base >=4.7 && <5
|
||||||
, either
|
, either
|
||||||
|
|
|
@ -7,16 +7,16 @@ module Servant (
|
||||||
module Servant.Server,
|
module Servant.Server,
|
||||||
-- | For accessing servant APIs as API clients.
|
-- | For accessing servant APIs as API clients.
|
||||||
module Servant.Client,
|
module Servant.Client,
|
||||||
module Servant.Utils.BaseUrl,
|
module Servant.Common.BaseUrl,
|
||||||
-- | For generating documentation for servant APIs.
|
-- | For generating documentation for servant APIs.
|
||||||
module Servant.Docs,
|
module Servant.Docs,
|
||||||
-- | Helper module
|
-- | Helper module
|
||||||
module Servant.Utils.Text,
|
module Servant.Common.Text,
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import Servant.API
|
import Servant.API
|
||||||
import Servant.Client
|
import Servant.Client
|
||||||
|
import Servant.Common.BaseUrl
|
||||||
|
import Servant.Common.Text
|
||||||
import Servant.Docs
|
import Servant.Docs
|
||||||
import Servant.Server
|
import Servant.Server
|
||||||
import Servant.Utils.BaseUrl
|
|
||||||
import Servant.Utils.Text
|
|
||||||
|
|
|
@ -12,10 +12,10 @@ import GHC.TypeLits
|
||||||
import Network.Wai
|
import Network.Wai
|
||||||
import Servant.API.Sub
|
import Servant.API.Sub
|
||||||
import Servant.Client
|
import Servant.Client
|
||||||
|
import Servant.Common.Req
|
||||||
|
import Servant.Common.Text
|
||||||
import Servant.Docs
|
import Servant.Docs
|
||||||
import Servant.Server
|
import Servant.Server
|
||||||
import Servant.Utils.Req
|
|
||||||
import Servant.Utils.Text
|
|
||||||
|
|
||||||
-- * Captures
|
-- * Captures
|
||||||
data Capture sym a
|
data Capture sym a
|
||||||
|
|
|
@ -11,10 +11,10 @@ import Data.Typeable
|
||||||
import Network.HTTP.Types
|
import Network.HTTP.Types
|
||||||
import Network.Wai
|
import Network.Wai
|
||||||
import Servant.Client
|
import Servant.Client
|
||||||
|
import Servant.Common.BaseUrl
|
||||||
|
import Servant.Common.Req
|
||||||
import Servant.Docs
|
import Servant.Docs
|
||||||
import Servant.Server
|
import Servant.Server
|
||||||
import Servant.Utils.BaseUrl
|
|
||||||
import Servant.Utils.Req
|
|
||||||
|
|
||||||
-- | Endpoint for DELETE requests.
|
-- | Endpoint for DELETE requests.
|
||||||
data Delete
|
data Delete
|
||||||
|
|
|
@ -12,10 +12,10 @@ import Data.Typeable
|
||||||
import Network.HTTP.Types
|
import Network.HTTP.Types
|
||||||
import Network.Wai
|
import Network.Wai
|
||||||
import Servant.Client
|
import Servant.Client
|
||||||
|
import Servant.Common.BaseUrl
|
||||||
|
import Servant.Common.Req
|
||||||
import Servant.Docs
|
import Servant.Docs
|
||||||
import Servant.Server
|
import Servant.Server
|
||||||
import Servant.Utils.BaseUrl
|
|
||||||
import Servant.Utils.Req
|
|
||||||
|
|
||||||
-- | Endpoint for simple GET requests. The server doesn't receive any arguments
|
-- | Endpoint for simple GET requests. The server doesn't receive any arguments
|
||||||
-- and serves the contained type as JSON.
|
-- and serves the contained type as JSON.
|
||||||
|
|
|
@ -12,10 +12,10 @@ import Data.Typeable
|
||||||
import Network.HTTP.Types
|
import Network.HTTP.Types
|
||||||
import Network.Wai
|
import Network.Wai
|
||||||
import Servant.Client
|
import Servant.Client
|
||||||
|
import Servant.Common.BaseUrl
|
||||||
|
import Servant.Common.Req
|
||||||
import Servant.Docs
|
import Servant.Docs
|
||||||
import Servant.Server
|
import Servant.Server
|
||||||
import Servant.Utils.BaseUrl
|
|
||||||
import Servant.Utils.Req
|
|
||||||
|
|
||||||
-- | Endpoint for POST requests. The type variable represents the type of the
|
-- | Endpoint for POST requests. The type variable represents the type of the
|
||||||
-- response body (not the request body, use 'Servant.API.RQBody.RQBody' for
|
-- response body (not the request body, use 'Servant.API.RQBody.RQBody' for
|
||||||
|
|
|
@ -12,10 +12,10 @@ import Data.Typeable
|
||||||
import Network.HTTP.Types
|
import Network.HTTP.Types
|
||||||
import Network.Wai
|
import Network.Wai
|
||||||
import Servant.Client
|
import Servant.Client
|
||||||
|
import Servant.Common.BaseUrl
|
||||||
|
import Servant.Common.Req
|
||||||
import Servant.Docs
|
import Servant.Docs
|
||||||
import Servant.Server
|
import Servant.Server
|
||||||
import Servant.Utils.BaseUrl
|
|
||||||
import Servant.Utils.Req
|
|
||||||
|
|
||||||
-- | Endpoint for PUT requests.
|
-- | Endpoint for PUT requests.
|
||||||
data Put a
|
data Put a
|
||||||
|
|
|
@ -16,10 +16,10 @@ import Network.HTTP.Types
|
||||||
import Network.Wai
|
import Network.Wai
|
||||||
import Servant.API.Sub
|
import Servant.API.Sub
|
||||||
import Servant.Client
|
import Servant.Client
|
||||||
|
import Servant.Common.Req
|
||||||
|
import Servant.Common.Text
|
||||||
import Servant.Docs
|
import Servant.Docs
|
||||||
import Servant.Server
|
import Servant.Server
|
||||||
import Servant.Utils.Req
|
|
||||||
import Servant.Utils.Text
|
|
||||||
|
|
||||||
-- * Single query string parameter lookup
|
-- * Single query string parameter lookup
|
||||||
|
|
||||||
|
|
|
@ -11,9 +11,9 @@ import Data.Proxy
|
||||||
import Network.Wai
|
import Network.Wai
|
||||||
import Servant.API.Sub
|
import Servant.API.Sub
|
||||||
import Servant.Client
|
import Servant.Client
|
||||||
|
import Servant.Common.Req
|
||||||
import Servant.Docs
|
import Servant.Docs
|
||||||
import Servant.Server
|
import Servant.Server
|
||||||
import Servant.Utils.Req
|
|
||||||
|
|
||||||
-- * Request Body support
|
-- * Request Body support
|
||||||
data ReqBody a
|
data ReqBody a
|
||||||
|
|
|
@ -9,9 +9,9 @@ import Data.String.Conversions
|
||||||
import GHC.TypeLits
|
import GHC.TypeLits
|
||||||
import Network.Wai
|
import Network.Wai
|
||||||
import Servant.Client
|
import Servant.Client
|
||||||
|
import Servant.Common.Req
|
||||||
import Servant.Docs
|
import Servant.Docs
|
||||||
import Servant.Server
|
import Servant.Server
|
||||||
import Servant.Utils.Req
|
|
||||||
|
|
||||||
-- | The contained API (second argument) can be found under @("/" ++ path)@
|
-- | The contained API (second argument) can be found under @("/" ++ path)@
|
||||||
-- (path being the first argument).
|
-- (path being the first argument).
|
||||||
|
|
|
@ -4,7 +4,7 @@ module Servant.Client where
|
||||||
|
|
||||||
import Data.Proxy
|
import Data.Proxy
|
||||||
|
|
||||||
import Servant.Utils.Req
|
import Servant.Common.Req
|
||||||
|
|
||||||
-- * Accessing APIs as a Client
|
-- * Accessing APIs as a Client
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{-# LANGUAGE DeriveGeneric #-}
|
{-# LANGUAGE DeriveGeneric #-}
|
||||||
{-# LANGUAGE ViewPatterns #-}
|
{-# LANGUAGE ViewPatterns #-}
|
||||||
module Servant.Utils.BaseUrl where
|
module Servant.Common.BaseUrl where
|
||||||
|
|
||||||
import Data.List
|
import Data.List
|
||||||
import GHC.Generics
|
import GHC.Generics
|
|
@ -1,6 +1,6 @@
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
{-# LANGUAGE ScopedTypeVariables #-}
|
{-# LANGUAGE ScopedTypeVariables #-}
|
||||||
module Servant.Utils.Req where
|
module Servant.Common.Req where
|
||||||
|
|
||||||
import Control.Applicative
|
import Control.Applicative
|
||||||
import Control.Concurrent
|
import Control.Concurrent
|
||||||
|
@ -19,7 +19,7 @@ import Data.Text
|
||||||
import Network.HTTP.Client
|
import Network.HTTP.Client
|
||||||
import Network.HTTP.Types
|
import Network.HTTP.Types
|
||||||
import Network.URI
|
import Network.URI
|
||||||
import Servant.Utils.BaseUrl
|
import Servant.Common.BaseUrl
|
||||||
import System.IO.Unsafe
|
import System.IO.Unsafe
|
||||||
|
|
||||||
import qualified Network.HTTP.Client as Client
|
import qualified Network.HTTP.Client as Client
|
|
@ -1,7 +1,7 @@
|
||||||
{-# LANGUAGE FlexibleInstances #-}
|
{-# LANGUAGE FlexibleInstances #-}
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
{-# LANGUAGE TypeSynonymInstances #-}
|
{-# LANGUAGE TypeSynonymInstances #-}
|
||||||
module Servant.Utils.Text where
|
module Servant.Common.Text where
|
||||||
|
|
||||||
import Data.String.Conversions
|
import Data.String.Conversions
|
||||||
import Data.Int
|
import Data.Int
|
|
@ -22,7 +22,7 @@ import Test.QuickCheck
|
||||||
import Servant.API
|
import Servant.API
|
||||||
import Servant.Client
|
import Servant.Client
|
||||||
import Servant.Server
|
import Servant.Server
|
||||||
import Servant.Utils.BaseUrl
|
import Servant.Common.BaseUrl
|
||||||
|
|
||||||
import Servant.ServerSpec
|
import Servant.ServerSpec
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
{-# OPTIONS_GHC -fno-warn-orphans #-}
|
||||||
module Servant.Client.BaseUrlSpec where
|
module Servant.Common.BaseUrlSpec where
|
||||||
|
|
||||||
import Control.Applicative
|
import Control.Applicative
|
||||||
import Control.DeepSeq
|
import Control.DeepSeq
|
||||||
import Test.Hspec
|
import Test.Hspec
|
||||||
import Test.QuickCheck
|
import Test.QuickCheck
|
||||||
|
|
||||||
import Servant.Utils.BaseUrl
|
import Servant.Common.BaseUrl
|
||||||
|
|
||||||
spec :: Spec
|
spec :: Spec
|
||||||
spec = do
|
spec = do
|
Loading…
Reference in a new issue