api-builder 0.9.1.0 → 0.10.0.0
raw patch · 7 files changed
+16/−20 lines, 7 filesdep +http-client-tlsdep −attoparsecdep ~aesondep ~http-clientdep ~http-conduitPVP ok
version bump matches the API change (PVP)
Dependencies added: http-client-tls
Dependencies removed: attoparsec
Dependency ranges changed: aeson, http-client, http-conduit
API changes (from Hackage documentation)
- Network.API.Builder.Receive: eitherDecode :: FromJSON a => ByteString -> Either String a
Files
- api-builder.cabal +5/−6
- src/Network/API/Builder/API.hs +3/−2
- src/Network/API/Builder/Builder.hs +1/−1
- src/Network/API/Builder/Error.hs +2/−1
- src/Network/API/Builder/Receive.hs +3/−8
- src/Network/API/Builder/Send.hs +1/−1
- src/Network/API/Builder/Send/Multipart.hs +1/−1
api-builder.cabal view
@@ -1,5 +1,5 @@ name: api-builder-version: 0.9.1.0+version: 0.10.0.0 synopsis: Library for easily building REST API wrappers in Haskell license: BSD3 license-file: LICENSE@@ -18,7 +18,7 @@ source-repository this type: git location: git://github.com/intolerable/api-builder.git- tag: v0.9.1.0+ tag: v0.10.0.0 library exposed-modules:@@ -34,13 +34,12 @@ Network.API.Builder.Send.Multipart build-depends: base >= 4.6 && < 4.9,- aeson >= 0.7 && < 0.9,- attoparsec >= 0.11 && < 0.14,+ aeson >= 0.9 && < 0.10, bifunctors >= 4.0 && < 6.0, bytestring == 0.10.*, HTTP == 4000.*,- http-client == 0.4.7.* || (>= 0.4.11 && < 0.4.17),- http-conduit == 2.*,+ http-client >= 0.4.11 && < 0.4.19,+ http-client-tls >= 0.2 && < 0.2.3, http-types == 0.8.*, text == 1.*, transformers >= 0.4 && < 0.5
src/Network/API/Builder/API.hs view
@@ -36,7 +36,8 @@ import Control.Monad.Trans.State import Data.ByteString.Lazy (ByteString) import Data.Text (Text)-import Network.HTTP.Conduit+import Network.HTTP.Client+import Network.HTTP.Client.TLS -- | Main API type. @s@ is the API's internal state, @e@ is the API's custom error type, -- and @a@ is the result when the API runs. Based on the @APIT@ transformer.@@ -78,7 +79,7 @@ -> APIT s e m a -- ^ the actual @API@ to run -> m (Either (APIError e) a) -- ^ IO action that returns either an error or the result execAPI b s api = do- m <- liftIO $ newManager conduitManagerSettings+ m <- liftIO $ newManager tlsManagerSettings (res, _, _) <- runAPI b m s api liftIO $ closeManager m return res
src/Network/API/Builder/Builder.hs view
@@ -5,7 +5,7 @@ import Network.API.Builder.Routes import Data.Text (Text)-import Network.HTTP.Conduit (Request)+import Network.HTTP.Client (Request) import qualified Data.Text as T -- | Builder type for the API. Keeps track of the API's name and base URL, and how
src/Network/API/Builder/Error.hs view
@@ -2,7 +2,8 @@ ( APIError(..) ) where import Data.Monoid-import Network.HTTP.Conduit (HttpException)+import Network.HTTP.Client (HttpException)+import Prelude -- | Error type for the @API@, where @a@ is the type that should be returned when -- something goes wrong on the other end - i.e. any error that isn't directly related
src/Network/API/Builder/Receive.hs view
@@ -3,12 +3,10 @@ import Network.API.Builder.Error import Control.Applicative-import Data.Aeson hiding (decode, eitherDecode)-import Data.Aeson.Parser-import Data.Aeson.Types (parseEither)-import Data.Attoparsec.Lazy (parse, eitherResult)+import Data.Aeson import Data.ByteString.Lazy (ByteString)-import Network.HTTP.Conduit+import Network.HTTP.Client+import Prelude class Receivable r where receive :: ErrorReceivable e => Response ByteString -> Either (APIError e) r@@ -60,9 +58,6 @@ case eitherDecode (responseBody resp) of Right x -> Just x Left _ -> Nothing--eitherDecode :: FromJSON a => ByteString -> Either String a-eitherDecode s = eitherResult (parse value s) >>= parseEither parseJSON newtype JSONResponse a = JSONResponse { unwrapJSON :: a } deriving (Show, Read, Eq, Ord)
src/Network/API/Builder/Send.hs view
@@ -5,7 +5,7 @@ import Data.Aeson import Data.ByteString.Lazy (ByteString)-import Network.HTTP.Conduit+import Network.HTTP.Client import qualified Data.ByteString.Char8 as ByteString import qualified Data.Text as Text
src/Network/API/Builder/Send/Multipart.hs view
@@ -9,7 +9,7 @@ import Control.Monad import Control.Monad.IO.Class import Network.HTTP.Client.MultipartFormData-import Network.HTTP.Conduit (Request)+import Network.HTTP.Client (Request) -- | A type for multipart forms, which uses 'Part's from 'Network.HTTP.Client.MultipartFormData'. -- Construct it and send it with 'sendMultipart' (not 'send').