packages feed

mandrill 0.3.0.0 → 0.4.0.0

raw patch · 2 files changed

+10/−6 lines, 2 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

- Network.API.Mandrill.Types: B64BS :: ByteString -> Base64ByteString
- Network.API.Mandrill.Types: newtype Base64ByteString
+ Network.API.Mandrill.Types: EncodedB64BS :: ByteString -> Base64ByteString
+ Network.API.Mandrill.Types: PlainBS :: ByteString -> Base64ByteString
+ Network.API.Mandrill.Types: data Base64ByteString

Files

mandrill.cabal view
@@ -1,5 +1,5 @@ name:                mandrill-version:             0.3.0.0+version:             0.4.0.0 synopsis:            Library for interfacing with the Mandrill JSON API description:         Pure Haskell client for the Mandrill JSON API license:             MIT
src/Network/API/Mandrill/Types.hs view
@@ -196,15 +196,19 @@ deriveJSON defaultOptions { fieldLabelModifier = drop 6 } ''MandrillMetadata  -newtype Base64ByteString = B64BS B.ByteString deriving Show+data Base64ByteString =+    EncodedB64BS B.ByteString+  -- ^ An already-encoded Base64 ByteString.+  | PlainBS B.ByteString+  -- ^ A plain Base64 ByteString which requires encoding.+  deriving Show  instance ToJSON Base64ByteString where-  toJSON (B64BS bs) = String . TL.decodeUtf8 . Base64.encode $ bs+  toJSON (PlainBS bs)      = String . TL.decodeUtf8 . Base64.encode $ bs+  toJSON (EncodedB64BS bs) = String . TL.decodeUtf8 $ bs  instance FromJSON Base64ByteString where-  parseJSON (String v) = case Base64.decode (TL.encodeUtf8 v) of-    Left err -> fail err-    Right rs -> return $ B64BS rs+  parseJSON (String v) = pure $ EncodedB64BS (TL.encodeUtf8 v)   parseJSON rest = typeMismatch "Base64ByteString must be a String." rest  --------------------------------------------------------------------------------