postmark 0.2.1 → 0.2.2
raw patch · 2 files changed
+36/−1 lines, 2 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
+ Network.Api.Postmark.Data: HtmlAndText :: TrackLinks
+ Network.Api.Postmark.Data: HtmlOnly :: TrackLinks
+ Network.Api.Postmark.Data: None :: TrackLinks
+ Network.Api.Postmark.Data: TextOnly :: TrackLinks
+ Network.Api.Postmark.Data: [emailTrackLinks'] :: EmailWithTemplate -> Maybe TrackLinks
+ Network.Api.Postmark.Data: [emailTrackLinks] :: Email -> Maybe TrackLinks
+ Network.Api.Postmark.Data: [emailTrackOpens'] :: EmailWithTemplate -> Maybe Bool
+ Network.Api.Postmark.Data: [emailTrackOpens] :: Email -> Maybe Bool
+ Network.Api.Postmark.Data: data TrackLinks
+ Network.Api.Postmark.Data: instance Data.Aeson.Types.ToJSON.ToJSON Network.Api.Postmark.Data.TrackLinks
+ Network.Api.Postmark.Data: instance GHC.Show.Show Network.Api.Postmark.Data.TrackLinks
- Network.Api.Postmark.Data: Email :: Text -> [Text] -> [Text] -> [Text] -> Text -> Maybe Text -> Maybe Text -> Maybe Text -> Text -> Map Text Text -> [Attachment] -> Email
+ Network.Api.Postmark.Data: Email :: Text -> [Text] -> [Text] -> [Text] -> Text -> Maybe Text -> Maybe Text -> Maybe Text -> Text -> Map Text Text -> Maybe Bool -> Maybe TrackLinks -> [Attachment] -> Email
- Network.Api.Postmark.Data: EmailWithTemplate :: Int -> Map Text Text -> Bool -> Text -> [Text] -> [Text] -> [Text] -> Maybe Text -> Text -> Map Text Text -> [Attachment] -> EmailWithTemplate
+ Network.Api.Postmark.Data: EmailWithTemplate :: Int -> Map Text Text -> Bool -> Text -> [Text] -> [Text] -> [Text] -> Maybe Text -> Text -> Map Text Text -> Maybe Bool -> Maybe TrackLinks -> [Attachment] -> EmailWithTemplate
Files
- postmark.cabal +1/−1
- src/Network/Api/Postmark/Data.hs +35/−0
postmark.cabal view
@@ -1,5 +1,5 @@ Name: postmark-Version: 0.2.1+Version: 0.2.2 License: BSD3 License-File: LICENSE Author: Mark Hibberd <mark@hibberd.id.au>
src/Network/Api/Postmark/Data.hs view
@@ -32,9 +32,18 @@ , emailText :: Maybe Text , emailReplyTo :: Text , emailHeaders :: Map Text Text+ , emailTrackOpens :: Maybe Bool+ , emailTrackLinks :: Maybe TrackLinks , emailAttachments :: [Attachment] } +data TrackLinks+ = None+ | HtmlAndText+ | HtmlOnly+ | TextOnly+ deriving (Show)+ data Attachment = Attachment { attachmentName :: Text , attachmentContent :: Text@@ -52,6 +61,8 @@ , emailTag' :: Maybe Text , emailReplyTo' :: Text , emailHeaders' :: Map Text Text+ , emailTrackOpens' :: Maybe Bool+ , emailTrackLinks' :: Maybe TrackLinks , emailAttachments' :: [Attachment] } @@ -67,6 +78,8 @@ , emailText = Nothing , emailReplyTo = "" , emailHeaders = M.empty+ , emailTrackOpens = Nothing+ , emailTrackLinks = Nothing , emailAttachments = [] } @@ -82,6 +95,8 @@ , emailTag' = Nothing , emailReplyTo' = "" , emailHeaders' = M.empty+ , emailTrackOpens' = Nothing+ , emailTrackLinks' = Nothing , emailAttachments' = [] } @@ -98,9 +113,27 @@ , oljson "Cc" (emailCc v) (T.intercalate ",") , oljson "Bcc" (emailBcc v) (T.intercalate ",") , omjson "Headers" (emailHeaders v)+ , ojson "TrackOpens" (emailTrackOpens v)+ , ojson "TrackLinks" (emailTrackLinks v) , oljson "Attachments" (emailAttachments v) id ]) +{- The reason we are being explicit here is because the serialized constructors+ for TrackLinks match the possible values in the Postmark API.+ We don't want to send values wholesale if new constructors come along.+-}+instance ToJSON TrackLinks where+ toJSON v =+ toJSON $ case v of+ None ->+ "None" :: Text+ HtmlAndText ->+ "HtmlAndText"+ HtmlOnly ->+ "HtmlOnly"+ TextOnly ->+ "TextOnly"+ instance ToJSON Attachment where toJSON v = object [ "Name" .= attachmentName v@@ -120,6 +153,8 @@ , oljson "Cc" (emailCc' v) (T.intercalate ",") , oljson "Bcc" (emailBcc' v) (T.intercalate ",") , omjson "Headers" (emailHeaders' v)+ , ojson "TrackOpens" (emailTrackOpens' v)+ , ojson "TrackLinks" (emailTrackLinks' v) , oljson "Attachments" (emailAttachments' v) id ]) -- * Response types