packages feed

servant-client 0.7 → 0.7.1

raw patch · 5 files changed

+94/−7 lines, 5 files

Files

+ CHANGELOG.md view
@@ -0,0 +1,45 @@+0.7.1+-----++* Support GHC 8.0+* `ServantError` has an `Eq` instance now.++0.6+---++* `client` no longer takes `BaseUrl` and `Manager` arguments. Instead, each function returned by `client` requires these two arguments.++0.5+---++* Use the `text` package instead of `String`.+* Support for the `HttpVersion`, `IsSecure`, `RemoteHost` and `Vault` combinators+* Added support for `path` on `BaseUrl`.+* `client` now takes an explicit `Manager` argument.+* Use `http-api-data` instead of `Servant.Common.Text`+* Client functions now consider any 2xx successful.+* Remove matrix params.+* Added support for Basic authentication+* Add generalized authentication support via the `AuthClientData` type family and+  `AuthenticateReq` data type++0.4.1+-----+* The `HasClient` instance for `Delete cts ()` now does not care at all about content types provided.++0.4+---+* `Delete` now is like `Get`, `Post`, `Put`, and `Patch` and returns a response body+* Support content-type aware combinators and `Accept`/`Content-type` headers+* Added a lot of tests+* Support multiple concurrent threads+* Use `ServantError` to report Errors instead of `String`+* Make the clients for `Raw` endpoints return the whole `Response` value (to be able to access response headers for example)+* Support for PATCH+* Make () instances expect No Content status code, and not try to decode body.+* Add support for response headers++0.2.2+-----+* Add TLS support+* Add matrix parameter support
+ README.md view
@@ -0,0 +1,21 @@+# servant-client++![servant](https://raw.githubusercontent.com/haskell-servant/servant/master/servant.png)++This library lets you automatically derive Haskell functions that let you query each endpoint of a *servant* webservice.++## Example++``` haskell+type MyApi = "books" :> Get '[JSON] [Book] -- GET /books+        :<|> "books" :> ReqBody Book :> Post '[JSON] Book -- POST /books++myApi :: Proxy MyApi+myApi = Proxy++getAllBooks :: ExceptT String IO [Book]+postNewBook :: Book -> ExceptT String IO Book+-- 'client' allows you to produce operations to query an API from a client.+(getAllBooks :<|> postNewBook) = client myApi host+  where host = BaseUrl Http "localhost" 8080+```
servant-client.cabal view
@@ -1,11 +1,11 @@ name:                servant-client-version:             0.7+version:             0.7.1 synopsis: automatical derivation of querying functions for servant webservices description:   This library lets you derive automatically Haskell functions that   let you query each endpoint of a <http://hackage.haskell.org/package/servant servant> webservice.   .-  See <http://haskell-servant.github.io/tutorial/client.html the client section of the tutorial>.+  See <http://haskell-servant.readthedocs.org/en/stable/tutorial/Client.html the client section of the tutorial>.   .   <https://github.com/haskell-servant/servant/blob/master/servant-client/CHANGELOG.md CHANGELOG> license:             BSD3@@ -15,11 +15,14 @@ copyright:           2014-2016 Zalora South East Asia Pte Ltd, Servant Contributors category:            Web build-type:          Simple-extra-source-files:  include/*.h cabal-version:       >=1.10 tested-with:         GHC >= 7.8-homepage:            http://haskell-servant.github.io/+homepage:            http://haskell-servant.readthedocs.org/ Bug-reports:         http://github.com/haskell-servant/servant/issues+extra-source-files:+  include/*.h+  CHANGELOG.md+  README.md source-repository head   type: git   location: http://github.com/haskell-servant/servant.git@@ -53,12 +56,13 @@   hs-source-dirs: src   default-language: Haskell2010   ghc-options: -Wall+  if impl(ghc >= 8.0)+    ghc-options: -Wno-redundant-constraints   include-dirs: include  test-suite spec   type: exitcode-stdio-1.0-  ghc-options:-    -Wall -fno-warn-name-shadowing -fno-warn-missing-signatures+  ghc-options: -Wall   default-language: Haskell2010   hs-source-dirs: test   main-is: Spec.hs
src/Servant/Common/Req.hs view
@@ -55,6 +55,19 @@     }   deriving (Show, Typeable) +instance Eq ServantError where+  FailureResponse a b c == FailureResponse x y z =+    (a, b, c) == (x, y, z)+  DecodeFailure a b c == DecodeFailure x y z =+    (a, b, c) == (x, y, z)+  UnsupportedContentType a b == UnsupportedContentType x y =+    (a, b) == (x, y)+  InvalidContentTypeHeader a b == InvalidContentTypeHeader x y =+    (a, b) == (x, y)+  ConnectionError a == ConnectionError x =+    show a == show x+  _ == _ = False+ instance Exception ServantError  data Req = Req
test/Servant/ClientSpec.hs view
@@ -15,7 +15,11 @@ {-# LANGUAGE TypeFamilies           #-} {-# LANGUAGE TypeOperators          #-} {-# LANGUAGE UndecidableInstances   #-}+#if __GLASGOW_HASKELL__ >= 800+{-# OPTIONS_GHC -freduction-depth=100 #-}+#else {-# OPTIONS_GHC -fcontext-stack=100 #-}+#endif {-# OPTIONS_GHC -fno-warn-orphans #-} {-# OPTIONS_GHC -fno-warn-name-shadowing #-} @@ -28,7 +32,7 @@ import           Control.Arrow              (left) import           Control.Concurrent         (forkIO, killThread, ThreadId) import           Control.Exception          (bracket)-import           Control.Monad.Trans.Except (ExceptT, throwE, runExceptT)+import           Control.Monad.Trans.Except (throwE, runExceptT) import           Data.Aeson import qualified Data.ByteString.Lazy       as BS import           Data.Char                  (chr, isPrint)