packages feed

mandrill 0.5.3.6 → 0.5.4.0

raw patch · 4 files changed

+24/−14 lines, 4 filesnew-uploaderPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

API changes (from Hackage documentation)

+ Network.API.Mandrill: newTemplateMessage' :: [EmailAddress] -> MandrillMessage
- Network.API.Mandrill: emptyMessage :: EmailAddress -> [EmailAddress] -> MandrillMessage
+ Network.API.Mandrill: emptyMessage :: Maybe EmailAddress -> [EmailAddress] -> MandrillMessage
- Network.API.Mandrill.Types: MandrillMessage :: MandrillHtml -> Maybe Text -> !Text -> MandrillEmail -> Maybe Text -> [MandrillRecipient] -> MandrillHeaders -> Maybe Bool -> Maybe Bool -> Maybe Bool -> Maybe Bool -> Maybe Bool -> Maybe Bool -> Maybe Bool -> Maybe Bool -> Maybe Bool -> Maybe Text -> Maybe Text -> Maybe Bool -> Maybe Bool -> Maybe Bool -> [MergeVar] -> [MandrillMergeVars] -> [MandrillTags] -> Maybe Text -> [Text] -> Maybe Text -> Object -> [MandrillMetadata] -> [MandrillWebContent] -> [MandrillWebContent] -> MandrillMessage
+ Network.API.Mandrill.Types: MandrillMessage :: MandrillHtml -> Maybe Text -> !Maybe Text -> Maybe MandrillEmail -> Maybe Text -> [MandrillRecipient] -> MandrillHeaders -> Maybe Bool -> Maybe Bool -> Maybe Bool -> Maybe Bool -> Maybe Bool -> Maybe Bool -> Maybe Bool -> Maybe Bool -> Maybe Bool -> Maybe Text -> Maybe Text -> Maybe Bool -> Maybe Bool -> Maybe Bool -> [MergeVar] -> [MandrillMergeVars] -> [MandrillTags] -> Maybe Text -> [Text] -> Maybe Text -> Object -> [MandrillMetadata] -> [MandrillWebContent] -> [MandrillWebContent] -> MandrillMessage
- Network.API.Mandrill.Types: [_mmsg_from_email] :: MandrillMessage -> MandrillEmail
+ Network.API.Mandrill.Types: [_mmsg_from_email] :: MandrillMessage -> Maybe MandrillEmail
- Network.API.Mandrill.Types: [_mmsg_subject] :: MandrillMessage -> !Text
+ Network.API.Mandrill.Types: [_mmsg_subject] :: MandrillMessage -> !Maybe Text
- Network.API.Mandrill.Types: mmsg_from_email :: Lens' MandrillMessage MandrillEmail
+ Network.API.Mandrill.Types: mmsg_from_email :: Lens' MandrillMessage (Maybe MandrillEmail)
- Network.API.Mandrill.Types: mmsg_subject :: Lens' MandrillMessage Text
+ Network.API.Mandrill.Types: mmsg_subject :: Lens' MandrillMessage (Maybe Text)

Files

mandrill.cabal view
@@ -1,5 +1,5 @@ name:                mandrill-version:             0.5.3.6+version:             0.5.4.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.hs view
@@ -14,6 +14,7 @@   , newTextMessage   , newHtmlMessage   , newTemplateMessage+  , newTemplateMessage'   , liftIO    -- * Appendix: Example Usage@@ -58,12 +59,12 @@ -- | Builds an empty message, given only the email of the sender and -- the emails of the receiver. Please note that the "Subject" will be empty, -- so you need to use either @newTextMessage@ or @newHtmlMessage@ to populate it.-emptyMessage :: EmailAddress -> [EmailAddress] -> MandrillMessage+emptyMessage :: Maybe EmailAddress -> [EmailAddress] -> MandrillMessage emptyMessage f t = MandrillMessage {    _mmsg_html = mempty  , _mmsg_text = Nothing- , _mmsg_subject = T.empty- , _mmsg_from_email = (MandrillEmail f)+ , _mmsg_subject = Nothing+ , _mmsg_from_email = MandrillEmail <$> f  , _mmsg_from_name = Nothing  , _mmsg_to = map newRecipient t  , _mmsg_headers = H.empty@@ -106,7 +107,7 @@                -- ^ The HTML body                -> MandrillMessage newHtmlMessage f t subj html = let body = mkMandrillHtml html in-  (emptyMessage f t) { _mmsg_html = body, _mmsg_subject = subj }+  (emptyMessage (Just f) t) { _mmsg_html = body, _mmsg_subject = Just subj }  -------------------------------------------------------------------------------- -- | Create a new template message (no HTML).@@ -117,9 +118,18 @@                    -> T.Text                    -- ^ Subject                    -> MandrillMessage-newTemplateMessage f t subj = (emptyMessage f t) { _mmsg_subject = subj }+newTemplateMessage f t subj = (emptyMessage (Just f) t) { _mmsg_subject = Just subj }  --------------------------------------------------------------------------------+-- | Create a new template message (no HTML) with recipient addresses only.+-- This function is preferred when the template being used has the sender +-- address and subject already configured in the Mandrill server.+newTemplateMessage' :: [EmailAddress]+                    -- ^ Receivers email+                    -> MandrillMessage+newTemplateMessage' = emptyMessage Nothing++-------------------------------------------------------------------------------- -- | Create a new textual message. By default Mandrill doesn't require you -- to specify the @mmsg_text@ when sending out the JSON Payload, and this -- function ensure it will be present.@@ -133,10 +143,10 @@                -- ^ The body, as normal text.                -> MandrillMessage newTextMessage f t subj txt = let body = unsafeMkMandrillHtml txt in-  (emptyMessage f t) {+  (emptyMessage (Just f) t) {        _mmsg_html = body      , _mmsg_text = Just txt-     , _mmsg_subject = subj+     , _mmsg_subject = Just subj      }  
src/Network/API/Mandrill/HTTP.hs view
@@ -18,7 +18,7 @@                    -> IO (MandrillResponse a) toMandrillResponse ep rq mbMgr = do   let fullUrl = mandrillUrl <> toUrl ep-  rq' <- parseUrl (T.unpack fullUrl)+  rq' <- parseRequest (T.unpack fullUrl)   let headers = [(hContentType, "application/json")]   let jsonBody = encode rq   let req = rq' {
src/Network/API/Mandrill/Types.hs view
@@ -252,9 +252,9 @@    -- ^ The full HTML content to be sent  , _mmsg_text                      :: Maybe T.Text    -- ^ Optional full text content to be sent- , _mmsg_subject                   :: !T.Text+ , _mmsg_subject                   :: !(Maybe T.Text)    -- ^ The message subject- , _mmsg_from_email                :: MandrillEmail+ , _mmsg_from_email                :: Maybe MandrillEmail    -- ^ The sender email address  , _mmsg_from_name                 :: Maybe T.Text    -- ^ Optional from name to be used@@ -336,8 +336,8 @@ instance Arbitrary MandrillMessage where   arbitrary = MandrillMessage <$> arbitrary                               <*> pure Nothing-                              <*> pure "Test Subject"-                              <*> pure (MandrillEmail . fromJust $ emailAddress "sender@example.com")+                              <*> pure (Just "Test Subject")+                              <*> pure (MandrillEmail <$> emailAddress "sender@example.com")                               <*> pure Nothing                               <*> resize 2 arbitrary                               <*> pure H.empty@@ -389,6 +389,6 @@  instance FromJSON MandrillDate where   parseJSON = withText "MandrillDate" $ \t ->-      case timeParse defaultTimeLocale "%Y-%m-%d %I:%M:%S%Q" (T.unpack t) of+      case timeParse defaultTimeLocale "%Y-%m-%d %H:%M:%S%Q" (T.unpack t) of         Just d -> pure $ MandrillDate d         _      -> fail "could not parse Mandrill date"