on master help sign in
More reorganization
commit35599d8b38413553020765d0bd6e3af7c809742d authorJulian K. Arni <jkarni@gmail.com> dateThu 7 Sep 2017, 10:05 (9 years ago) parent95fac32
13 files changed+53−49
servant-client-core/servant-client-core.cabal+21−1 servant-client/src/Servant/Client.hs → servant-client-core/src/Servant/Client/Core.hs+1−1 servant-client-core/src/Servant/Client/Core/Internal/Auth.hs+2−6 servant-client-core/src/Servant/Client/Core/Internal/BaseUrl.hs+1−1 servant-client-core/src/Servant/Client/Core/Internal/BasicAuth.hs+2−4 servant-client-core/src/Servant/Client/Core/Internal/Class.hs+2−2 servant-client-core/src/Servant/Client/Core/Internal/Generic.hs+2−3 servant-client-core/src/Servant/Client/Core/Internal/Request.hs+18−18 servant-client/servant-client.cabal−13 stack-ghc-7.10.3.yaml+1 stack-ghc-7.8.4.yaml+1 stack-ghc-8.2.1.yaml+1 stack.yaml+1
servant-client-core/servant-client-core.cabal+21−1
@@ -9,6 +9,7 @@ author: Servant Contributors
99maintainer: haskell-servant-maintainers@googlegroups.com
1010homepage: http://haskell-servant.readthedocs.org/
1111bug-reports: http://github.com/haskell-servant/servant/issues
12+cabal-version: >=1.10
1213-- copyright:
1314category: Web
1415build-type: Simple
@@ -19,15 +20,34 @@ extra-source-files:
1920source-repository head
2021 type: git
2122 location: http://github.com/haskell-servant/servant.git
22−cabal-version: >=1.10
2323
2424library
2525 exposed-modules:
26+ Servant.Client.Core
27+ Servant.Client.Core.Internal.Auth
28+ Servant.Client.Core.Internal.BaseUrl
29+ Servant.Client.Core.Internal.BasicAuth
30+ Servant.Client.Core.Internal.Class
31+ Servant.Client.Core.Internal.Generic
32+ Servant.Client.Core.Internal.Request
2633 build-depends:
2734 base >= 4.7 && < 4.11
2835 , base-compat >= 0.9.1 && < 0.10
36+ , base64-bytestring >= 1.0.0.1 && < 1.1
37+ , bytestring >= 0.10 && < 0.11
38+ , containers >= 0.5 && < 0.6
39+ , exceptions >= 0.8 && < 0.9
40+ , generics-sop >= 0.1.0.0 && < 0.4
41+ , http-api-data >= 0.3.6 && < 0.4
42+ , http-media >= 0.6.2 && < 0.8
43+ , http-types >= 0.8.6 && < 0.10
44+ , network-uri >= 2.6 && < 2.7
45+ , safe >= 0.3.9 && < 0.4
46+ , servant == 0.11.*
47+ , text >= 1.2 && < 1.3
2948 hs-source-dirs: src
3049 default-language: Haskell2010
50+ include-dirs: include
3151
3252test-suite spec
3353 type: exitcode-stdio-1.0
servant-client/src/Servant/Client.hs → servant-client-core/src/Servant/Client/Core.hsrenamed+1−1
@@ -16,7 +16,7 @@
1616-- | This module provides 'client' which can automatically generate
1717-- querying functions for each endpoint just from the type representing your
1818-- API.
19−module Servant.Client
19+module Servant.Client.Core
2020 ( AuthClientData
2121 , AuthenticateReq(..)
2222 , client
servant-client-core/src/Servant/Client/Core/Internal/Auth.hs+2−6
@@ -4,13 +4,9 @@
44
55-- | Authentication for clients
66
7−module Servant.Client.Experimental.Auth (
8− AuthenticateReq(AuthenticateReq, unAuthReq)
9− , AuthClientData
10− , mkAuthenticateReq
11− ) where
7+module Servant.Client.Core.Internal.Auth where
128
13−import Servant.Common.Req (Request)
9+import Servant.Client.Core.Internal.Request (Request)
1410
1511-- | For a resource protected by authentication (e.g. AuthProtect), we need
1612-- to provide the client with some data used to add authentication data
servant-client-core/src/Servant/Client/Core/Internal/BaseUrl.hs+1−1
@@ -1,7 +1,7 @@
11{-# LANGUAGE DeriveDataTypeable #-}
22{-# LANGUAGE DeriveGeneric #-}
33{-# LANGUAGE ViewPatterns #-}
4−module Servant.Common.BaseUrl (
4+module Servant.Client.Core.Internal.BaseUrl (
55 -- * types
66 BaseUrl (..)
77 , InvalidBaseUrlException
servant-client-core/src/Servant/Client/Core/Internal/BasicAuth.hs+2−4
@@ -4,14 +4,12 @@
44
55-- | Basic Authentication for clients
66
7−module Servant.Common.BasicAuth (
8− basicAuthReq
9− ) where
7+module Servant.Client.Core.Internal.BasicAuth where
108
119import Data.ByteString.Base64 (encode)
1210import Data.Monoid ((<>))
1311import Data.Text.Encoding (decodeUtf8)
14−import Servant.Common.Req (addHeader, Request)
12+import Servant.Client.Core.Internal.Request (addHeader, Request)
1513import Servant.API.BasicAuth (BasicAuthData(BasicAuthData))
1614
1715-- | Authenticate a request using Basic Authentication
servant-client-core/src/Servant/Client/Core/Internal/Class.hs+2−2
@@ -1,10 +1,10 @@
11{-# LANGUAGE MultiParamTypeClasses #-}
22{-| Types for possible backends to run client-side `Request` queries -}
3−module Servant.Client.Class where
3+module Servant.Client.Core.Internal.Class where
44
55import Data.Proxy
66import Network.HTTP.Types
7−import Servant.Common.Req (Request, Response)
7+import Servant.Client.Core.Internal.Request (Request, Response)
88
99class (Monad m) => RunClient m ct where
1010 runRequest :: Proxy ct
servant-client-core/src/Servant/Client/Core/Internal/Generic.hs+2−3
@@ -10,7 +10,7 @@
1010
1111#include "overlapping-compat.h"
1212
13−module Servant.Client.Generic
13+module Servant.Client.Core.Internal.Generic
1414 ( ClientLike(..)
1515 , genericMkClientL
1616 , genericMkClientP
@@ -18,7 +18,6 @@ module Servant.Client.Generic
1818
1919import Generics.SOP (Code, Generic, I(..), NP(..), NS(Z), SOP(..), to)
2020import Servant.API ((:<|>)(..))
21−import Servant.Client (ClientM)
2221
2322-- | This class allows us to match client structure with client functions
2423-- produced with 'client' without explicit pattern-matching.
@@ -111,7 +110,7 @@ instance ClientLike client custom
111110 => ClientLike (a -> client) (a -> custom) where
112111 mkClient c = mkClient . c
113112
114−instance ClientLike (ClientM a) (ClientM a) where
113+instance ClientLike (m a) (m a) where
115114 mkClient = id
116115
117116-- | Match client structure with client functions, regarding left-nested API clients
servant-client-core/src/Servant/Client/Core/Internal/Request.hs+18−18
@@ -7,7 +7,7 @@
77{-# LANGUAGE ScopedTypeVariables #-}
88{-# LANGUAGE TypeFamilies #-}
99
10−module Servant.Common.Request where
10+module Servant.Client.Core.Internal.Request where
1111
1212import Prelude ()
1313import Prelude.Compat
@@ -16,13 +16,12 @@ import qualified Data.ByteString.Builder as Builder
1616import qualified Data.ByteString.Lazy as LBS
1717import Data.Semigroup ((<>))
1818import qualified Data.Sequence as Seq
19−import Data.String.Conversions (cs)
2019import Data.Text (Text)
2120import Data.Typeable (Typeable)
2221import GHC.Generics (Generic)
2322import Network.HTTP.Media (MediaType)
2423import Network.HTTP.Types (Header, HeaderName, HttpVersion,
25− Method, QueryItem, Status, http11)
24+ QueryItem, Status, http11)
2625import Web.HttpApiData (ToHttpApiData, toEncodedUrlPiece,
2726 toHeader)
2827
@@ -126,21 +125,22 @@ setRequestBody b t req = req { requestBody = Just (b, t) }
126125 {-toProperHeader (name, val) =-}
127126 {-(fromString name, encodeUtf8 val)-}
128127
129−#if !MIN_VERSION_http_client(0,4,30)
130−-- 'parseRequest' is introduced in http-client-0.4.30
131−-- it differs from 'parseUrl', by not throwing exceptions on non-2xx http statuses
132−--
133−-- See for implementations:
134−-- http://hackage.haskell.org/package/http-client-0.4.30/docs/src/Network-HTTP-Client-Request.html#parseRequest
135−-- http://hackage.haskell.org/package/http-client-0.5.0/docs/src/Network-HTTP-Client-Request.html#parseRequest
136−parseRequest :: MonadThrow m => String -> m Request
137−parseRequest url = liftM disableStatusCheck (parseUrl url)
138− where
139− disableStatusCheck req = req { checkStatus = \ _status _headers _cookies -> Nothing }
140−#endif
128+
129+ {- #if !MIN_VERSION_http_client(0,4,30)-}
130+ {--- 'parseRequest' is introduced in http-client-0.4.30-}
131+ {--- it differs from 'parseUrl', by not throwing exceptions on non-2xx http statuses-}
132+ {----}
133+ {--- See for implementations:-}
134+ {--- http://hackage.haskell.org/package/http-client-0.4.30/docs/src/Network-HTTP-Client-Request.html#parseRequest-}
135+ {--- http://hackage.haskell.org/package/http-client-0.5.0/docs/src/Network-HTTP-Client-Request.html#parseRequest-}
136+ {-parseRequest :: MonadThrow m => String -> m Request-}
137+ {-parseRequest url = liftM disableStatusCheck (parseUrl url)-}
138+ {-where-}
139+ {-disableStatusCheck req = req { checkStatus = \ _status _headers _cookies -> Nothing }-}
140+ {- #endif-}
141141
142142
143−-- * performing requests
143+ {--- * performing requests-}
144144
145−displayHttpRequest :: Method -> String
146−displayHttpRequest httpmethod = "HTTP " ++ cs httpmethod ++ " request"
145+ {-displayHttpRequest :: Method -> String-}
146+ {-displayHttpRequest httpmethod = "HTTP " ++ cs httpmethod ++ " request"-}
servant-client/servant-client.cabal−13
@@ -42,23 +42,10 @@ library
4242 , base-compat >= 0.9.1 && < 0.10
4343 , aeson >= 0.7 && < 1.3
4444 , attoparsec >= 0.12 && < 0.14
45− , base64-bytestring >= 1.0.0.1 && < 1.1
46− , bytestring >= 0.10 && < 0.11
47− , containers >= 0.5 && < 0.6
48− , exceptions >= 0.8 && < 0.9
49− , generics-sop >= 0.1.0.0 && < 0.4
50− , http-api-data >= 0.3.6 && < 0.4
5145 , http-client >= 0.4.18.1 && < 0.6
5246 , http-client-tls >= 0.2.2 && < 0.4
53− , http-media >= 0.6.2 && < 0.8
54− , http-types >= 0.8.6 && < 0.10
5547 , monad-control >= 1.0.0.4 && < 1.1
56− , network-uri >= 2.6 && < 2.7
57− , safe >= 0.3.9 && < 0.4
5848 , semigroupoids >= 4.3 && < 5.3
59− , servant == 0.11.*
60− , string-conversions >= 0.3 && < 0.5
61− , text >= 1.2 && < 1.3
6249 , transformers >= 0.3 && < 0.6
6350 , transformers-base >= 0.4.4 && < 0.5
6451 , transformers-compat >= 0.4 && < 0.6
stack-ghc-7.10.3.yaml+1
@@ -2,6 +2,7 @@ flags: {}
22packages:
33- servant/
44- servant-client/
5+- servant-client-core/
56- servant-docs/
67- servant-foreign/
78- servant-server/
stack-ghc-7.8.4.yaml+1
@@ -2,6 +2,7 @@ flags: {}
22packages:
33- servant/
44- servant-client/
5+- servant-client-core/
56- servant-docs/
67- servant-foreign/
78- servant-server/
stack-ghc-8.2.1.yaml+1
@@ -1,6 +1,7 @@
11resolver: nightly-2017-09-01
22packages:
33- servant-client/
4+- servant-client-core/
45- servant-docs/
56- servant-foreign/
67- servant-server/
stack.yaml+1
@@ -2,6 +2,7 @@ resolver: nightly-2017-04-01
22packages:
33- servant/
44- servant-client/
5+- servant-client-core/
56- servant-docs/
67- servant-foreign/
78- servant-server/