servant-client-core 0.18.1 → 0.18.2
raw patch · 3 files changed
+49/−9 lines, 3 filesdep ~hspecdep ~servant
Dependency ranges changed: hspec, servant
Files
- CHANGELOG.md +7/−0
- servant-client-core.cabal +2/−2
- src/Servant/Client/Core/HasClient.hs +40/−7
CHANGELOG.md view
@@ -1,6 +1,13 @@ [The latest version of this document is on GitHub.](https://github.com/haskell-servant/servant/blob/master/servant-client-core/CHANGELOG.md) [Changelog for `servant` package contains significant entries for all core packages.](https://github.com/haskell-servant/servant/blob/master/servant/CHANGELOG.md) +0.18.2+------++### Significant changes++- Support `Fragment` combinator.+ 0.18.1 ------
servant-client-core.cabal view
@@ -1,6 +1,6 @@ cabal-version: >=1.10 name: servant-client-core-version: 0.18.1+version: 0.18.2 synopsis: Core functionality and class for client function generation for servant APIs category: Servant, Web@@ -64,7 +64,7 @@ -- Servant dependencies build-depends:- servant >= 0.18 && <0.19+ servant >= 0.18.1 && <0.19 -- Other dependencies: Lower bound around what is in the latest Stackage LTS. -- Here can be exceptions if we really need features from the newer versions.
src/Servant/Client/Core/HasClient.hs view
@@ -1,4 +1,5 @@ {-# LANGUAGE ConstraintKinds #-}+{-# LANGUAGE CPP #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-}@@ -13,6 +14,10 @@ {-# LANGUAGE TypeOperators #-} {-# LANGUAGE UndecidableInstances #-} +#if MIN_VERSION_base(4,9,0) && __GLASGOW_HASKELL__ >= 802+#define HAS_TYPE_ERROR+#endif+ module Servant.Client.Core.HasClient ( clientIn, HasClient (..),@@ -63,17 +68,18 @@ import Servant.API ((:<|>) ((:<|>)), (:>), AuthProtect, BasicAuth, BasicAuthData, BuildHeadersTo (..), Capture', CaptureAll, Description,- EmptyAPI, FramingRender (..), FramingUnrender (..),+ EmptyAPI, Fragment, FramingRender (..), FramingUnrender (..), FromSourceIO (..), Header', Headers (..), HttpVersion, IsSecure, MimeRender (mimeRender),- MimeUnrender (mimeUnrender), NoContent (NoContent), QueryFlag,- QueryParam', QueryParams, Raw, ReflectMethod (..), RemoteHost,- ReqBody', SBoolI, Stream, StreamBody', Summary, ToHttpApiData,- ToSourceIO (..), Vault, Verb, NoContentVerb, WithNamedContext,- contentType, getHeadersHList, getResponse, toQueryParam,- toUrlPiece)+ MimeUnrender (mimeUnrender), NoContent (NoContent),+ NoContentVerb, QueryFlag, QueryParam', QueryParams, Raw,+ ReflectMethod (..), RemoteHost, ReqBody', SBoolI, Stream,+ StreamBody', Summary, ToHttpApiData, ToSourceIO (..), Vault,+ Verb, WithNamedContext, contentType, getHeadersHList,+ getResponse, toQueryParam, toUrlPiece) import Servant.API.ContentTypes (contentTypes, AllMime (allMime), AllMimeUnrender (allMimeUnrender))+import Servant.API.TypeLevel (FragmentUnique, AtLeastOneFragment) import Servant.API.Modifiers (FoldRequired, RequiredArgument, foldRequiredArgument) import Servant.API.UVerb@@ -744,6 +750,33 @@ hoistClientMonad pm _ f cl = \authreq -> hoistClientMonad pm (Proxy :: Proxy api) f (cl authreq)++-- | Ignore @'Fragment'@ in client functions.+-- See <https://ietf.org/rfc/rfc2616.html#section-15.1.3> for more details.+-- +-- Example:+--+-- > type MyApi = "books" :> Fragment Text :> Get '[JSON] [Book]+-- >+-- > myApi :: Proxy MyApi+-- > myApi = Proxy+-- >+-- > getBooks :: ClientM [Book]+-- > getBooks = client myApi+-- > -- then you can just use "getBooksBy" to query that endpoint.+-- > -- 'getBooks' for all books.+#ifdef HAS_TYPE_ERROR+instance (AtLeastOneFragment api, FragmentUnique (Fragment a :> api), HasClient m api+#else+instance ( HasClient m api+#endif+ ) => HasClient m (Fragment a :> api) where++ type Client m (Fragment a :> api) = Client m api++ clientWithRoute pm _ = clientWithRoute pm (Proxy :: Proxy api) ++ hoistClientMonad pm _ = hoistClientMonad pm (Proxy :: Proxy api) -- * Basic Authentication