-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Library for postmarkapp.com HTTP Api -- -- Library for postmarkapp.com HTTP Api. @package postmark @version 0.2.7 module Network.Api.Postmark.Data -- | Email data type. It is recommended that you use the defaultEmail -- function and selector syntax to build an email, e.g.: -- --
-- defaultEmail {
-- emailFrom = "you@yourdomain.com"
-- , emailTo = "person@example.com"
-- , emailSubject = "This is an example email!"
-- }
--
data Email
Email :: Text -> [Text] -> [Text] -> [Text] -> Text -> Maybe Text -> Maybe Text -> Maybe Text -> Text -> Map Text Text -> Maybe Bool -> Maybe TrackLinks -> [Attachment] -> Email
[emailFrom] :: Email -> Text
[emailTo] :: Email -> [Text]
[emailCc] :: Email -> [Text]
[emailBcc] :: Email -> [Text]
[emailSubject] :: Email -> Text
[emailTag] :: Email -> Maybe Text
[emailHtml] :: Email -> Maybe Text
[emailText] :: Email -> Maybe Text
[emailReplyTo] :: Email -> Text
[emailHeaders] :: Email -> Map Text Text
[emailTrackOpens] :: Email -> Maybe Bool
[emailTrackLinks] :: Email -> Maybe TrackLinks
[emailAttachments] :: Email -> [Attachment]
defaultEmail :: Email
data EmailWithTemplate
EmailWithTemplate :: Int -> Map Text Text -> Bool -> Text -> [Text] -> [Text] -> [Text] -> Maybe Text -> Text -> Map Text Text -> Maybe Bool -> Maybe TrackLinks -> [Attachment] -> EmailWithTemplate
[templateId] :: EmailWithTemplate -> Int
[templateModel] :: EmailWithTemplate -> Map Text Text
[inlineCss] :: EmailWithTemplate -> Bool
[emailFrom'] :: EmailWithTemplate -> Text
[emailTo'] :: EmailWithTemplate -> [Text]
[emailCc'] :: EmailWithTemplate -> [Text]
[emailBcc'] :: EmailWithTemplate -> [Text]
[emailTag'] :: EmailWithTemplate -> Maybe Text
[emailReplyTo'] :: EmailWithTemplate -> Text
[emailHeaders'] :: EmailWithTemplate -> Map Text Text
[emailTrackOpens'] :: EmailWithTemplate -> Maybe Bool
[emailTrackLinks'] :: EmailWithTemplate -> Maybe TrackLinks
[emailAttachments'] :: EmailWithTemplate -> [Attachment]
defaultEmailWithTemplate :: EmailWithTemplate
-- | When “link tracking” is enabled, Postmark will record statistics when
-- a user clicks on a link in an email. You can use this feature to
-- determine if a particular recipient has clicked a link that was
-- emailed to them.
--
--
-- https://postmarkapp.com/developer/user-guide/tracking-links#enabling-link-tracking
data TrackLinks
-- | No links will be replaced or tracked.
None :: TrackLinks
-- | Links will be replaced in both HTML and text bodies.
HtmlAndText :: TrackLinks
-- | Links will be replaced in only the HTML body. You may want this option
-- if you do not want encoded tracking links to appear in the plain text
-- of an email.
HtmlOnly :: TrackLinks
-- | Links will be replaced in only the text body.
TextOnly :: TrackLinks
data Attachment
Attachment :: Text -> Text -> Text -> Attachment
[attachmentName] :: Attachment -> Text
[attachmentContent] :: Attachment -> Text
[attachmentContentType] :: Attachment -> Text
data Sent
Sent :: Text -> Text -> Text -> Sent
[postmarkMessageId] :: Sent -> Text
[postmarkSubmittedAt] :: Sent -> Text
[postmarkTo] :: Sent -> Text
ojson :: ToJSON a => Text -> Maybe a -> Maybe (Text, Value)
oljson :: ToJSON b => Text -> [a] -> ([a] -> b) -> Maybe (Text, Value)
omjson :: ToJSON a => Text -> Map Text a -> Maybe (Text, Value)
toText :: ByteString -> Text
instance GHC.Show.Show Network.Api.Postmark.Data.Sent
instance GHC.Classes.Eq Network.Api.Postmark.Data.Sent
instance GHC.Show.Show Network.Api.Postmark.Data.TrackLinks
instance Data.Aeson.Types.FromJSON.FromJSON Network.Api.Postmark.Data.Sent
instance Data.Aeson.Types.ToJSON.ToJSON Network.Api.Postmark.Data.EmailWithTemplate
instance Data.Aeson.Types.ToJSON.ToJSON Network.Api.Postmark.Data.Email
instance Data.Aeson.Types.ToJSON.ToJSON Network.Api.Postmark.Data.Attachment
instance Data.Aeson.Types.ToJSON.ToJSON Network.Api.Postmark.Data.TrackLinks
module Network.Api.Postmark.Error
data PostmarkError
PostmarkError :: PostmarkErrorType -> Text -> PostmarkError
[errorType] :: PostmarkError -> PostmarkErrorType
[errorMessage] :: PostmarkError -> Text
data PostmarkErrorType
PostmarkBadApiToken :: PostmarkErrorType
PostmarkInvalidEmail :: PostmarkErrorType
PostmarkSenderNotFound :: PostmarkErrorType
PostmarkSenderNotConfirmed :: PostmarkErrorType
PostmarkInvalidJson :: PostmarkErrorType
PostmarkIncompatibleJson :: PostmarkErrorType
PostmarkNotAllowed :: PostmarkErrorType
PostmarkInactive :: PostmarkErrorType
PostmarkBounceNotFound :: PostmarkErrorType
PostmarkBounceQueryException :: PostmarkErrorType
PostmarkJsonRequired :: PostmarkErrorType
PostmarkTooManyMessages :: PostmarkErrorType
PostmarkTemplateQueryException :: PostmarkErrorType
PostmarkTemplateNotFound :: PostmarkErrorType
PostmarkTemplateLimitWouldBeExceeded :: PostmarkErrorType
PostmarkTemplateNoDataReceived :: PostmarkErrorType
PostmarkTemplateRequiredFieldMissing :: PostmarkErrorType
PostmarkTemplateFieldTooLarge :: PostmarkErrorType
PostmarkTemplateFieldInvalid :: PostmarkErrorType
PostmarkUnkownError :: Int -> PostmarkErrorType
instance GHC.Show.Show Network.Api.Postmark.Error.PostmarkError
instance GHC.Classes.Eq Network.Api.Postmark.Error.PostmarkError
instance GHC.Classes.Eq Network.Api.Postmark.Error.PostmarkErrorType
instance Data.Aeson.Types.FromJSON.FromJSON Network.Api.Postmark.Error.PostmarkError
instance GHC.Show.Show Network.Api.Postmark.Error.PostmarkErrorType
module Network.Api.Postmark.Request
data PostmarkRequest e a
[PostmarkRequest] :: (FromJSON e, FromJSON a) => StdMethod -> Text -> RequestTransformer -> PostmarkRequest e a
type PostmarkRequest' a = PostmarkRequest PostmarkError a
module Network.Api.Postmark.Response
data PostmarkResponse e a
PostmarkSuccess :: a -> PostmarkResponse e a
PostmarkUnauthorized :: PostmarkResponse e a
PostmarkFailure :: e -> PostmarkResponse e a
PostmarkUnexpected :: PostmarkUnexpectedType -> Int -> Maybe Text -> Maybe Text -> PostmarkResponse e a
data PostmarkUnexpectedType
ServerError :: PostmarkUnexpectedType
UnexpectedResponseCode :: PostmarkUnexpectedType
JsonSyntaxError :: PostmarkUnexpectedType
JsonFormatError :: PostmarkUnexpectedType
type PostmarkResponse' a = PostmarkResponse PostmarkError a
syntaxErr :: Int -> ByteString -> Text -> PostmarkResponse e a
formatErr :: Int -> ByteString -> Text -> PostmarkResponse e a
instance (GHC.Show.Show a, GHC.Show.Show e) => GHC.Show.Show (Network.Api.Postmark.Response.PostmarkResponse e a)
instance (GHC.Classes.Eq a, GHC.Classes.Eq e) => GHC.Classes.Eq (Network.Api.Postmark.Response.PostmarkResponse e a)
instance GHC.Show.Show Network.Api.Postmark.Response.PostmarkUnexpectedType
instance GHC.Classes.Eq Network.Api.Postmark.Response.PostmarkUnexpectedType
module Network.Api.Postmark.Settings
-- | To construct PostmarkSettings, use postmarkHttps or
-- postmarkHttp.
--
-- Or to use the test API instead, use postmarkHttpsTest or
-- postmarkHttpTest.
data PostmarkSettings
PostmarkSettings :: Text -> PostmarkApiToken -> PostmarkSettings
[apiUrl] :: PostmarkSettings -> Text
[apiToken] :: PostmarkSettings -> PostmarkApiToken
-- | The Postmark “server token” which is sent via the
-- X-Postmark-Server-Token HTTP header. You can find your server
-- token under the “Credentials” tab on the Postmark website.
--
-- If you do not yet have a Postmark account, or if you want to send test
-- emails that don't actually get delivered, you may use
-- postmarkTestToken.
--
-- https://postmarkapp.com/developer/api/overview#authentication
type PostmarkApiToken = Text
-- | Constructs Postmark settings using the HTTP protocol and your API
-- token.
--
-- HTTPS is recommended instead (postmarkHttps).
postmarkHttp :: PostmarkApiToken -> PostmarkSettings
-- | Constructs Postmark settings using the HTTPS protocol and your API
-- token.
postmarkHttps :: PostmarkApiToken -> PostmarkSettings
-- | An API token that you can use when you want to send test emails that
-- don't actually get delivered to the recipient.
--
-- https://postmarkapp.com/developer/api/overview#authentication
postmarkTestToken :: PostmarkApiToken
-- | Postmark settings using the HTTP protocol and the test API token
-- (postmarkTestToken).
--
-- HTTPS is recommended instead (postmarkHttpsTest).
postmarkHttpTest :: PostmarkSettings
-- | Postmark settings using the HTTPS protocol and the test API token
-- (postmarkTestToken).
postmarkHttpsTest :: PostmarkSettings
instance GHC.Show.Show Network.Api.Postmark.Settings.PostmarkSettings
instance GHC.Classes.Eq Network.Api.Postmark.Settings.PostmarkSettings
module Network.Api.Postmark.Core
-- | Send a single email:
-- http://developer.postmarkapp.com/developer-build.html
email :: Email -> PostmarkRequest' Sent
-- | Bulk send emails:
-- http://developer.postmarkapp.com/developer-build.html#batching-messages
emails :: [Email] -> PostmarkRequest' [Sent]
-- | Send a single email using a template:
-- https://postmarkapp.com/developer/api/templates-api#email-with-template
emailWithTemplate :: EmailWithTemplate -> PostmarkRequest' Sent
-- | Run the specified request with the specified settings.
request :: PostmarkSettings -> PostmarkRequest e a -> IO (PostmarkResponse e a)
-- | Library for postmarkapp.com HTTP Api.
--
-- To get start see some examples in the
-- Network.Api.Postmark.Tutorial module.
--
-- Source and more information can be found at
-- https://github.com/apiengine/postmark.
--
-- To experiment with a live demo try:
--
-- -- $ git clone https://github.com/apiengine/postmark -- $ cd postmark -- $ cabal install --only-dependencies && cabal configure -f demo && cabal build -- $ ./dist/build/postmark-demo/postmark-demo ---- -- Issues can be reported at -- https://github.com/apiengine/postmark/issues. module Network.Api.Postmark -- | To construct PostmarkSettings, use postmarkHttps or -- postmarkHttp. -- -- Or to use the test API instead, use postmarkHttpsTest or -- postmarkHttpTest. data PostmarkSettings PostmarkSettings :: Text -> PostmarkApiToken -> PostmarkSettings [apiUrl] :: PostmarkSettings -> Text [apiToken] :: PostmarkSettings -> PostmarkApiToken -- | The Postmark “server token” which is sent via the -- X-Postmark-Server-Token HTTP header. You can find your server -- token under the “Credentials” tab on the Postmark website. -- -- If you do not yet have a Postmark account, or if you want to send test -- emails that don't actually get delivered, you may use -- postmarkTestToken. -- -- https://postmarkapp.com/developer/api/overview#authentication type PostmarkApiToken = Text -- | Constructs Postmark settings using the HTTP protocol and your API -- token. -- -- HTTPS is recommended instead (postmarkHttps). postmarkHttp :: PostmarkApiToken -> PostmarkSettings -- | Constructs Postmark settings using the HTTPS protocol and your API -- token. postmarkHttps :: PostmarkApiToken -> PostmarkSettings -- | An API token that you can use when you want to send test emails that -- don't actually get delivered to the recipient. -- -- https://postmarkapp.com/developer/api/overview#authentication postmarkTestToken :: PostmarkApiToken -- | Postmark settings using the HTTP protocol and the test API token -- (postmarkTestToken). -- -- HTTPS is recommended instead (postmarkHttpsTest). postmarkHttpTest :: PostmarkSettings -- | Postmark settings using the HTTPS protocol and the test API token -- (postmarkTestToken). postmarkHttpsTest :: PostmarkSettings -- | Send a single email: -- http://developer.postmarkapp.com/developer-build.html email :: Email -> PostmarkRequest' Sent -- | Bulk send emails: -- http://developer.postmarkapp.com/developer-build.html#batching-messages emails :: [Email] -> PostmarkRequest' [Sent] -- | Email data type. It is recommended that you use the defaultEmail -- function and selector syntax to build an email, e.g.: -- --
-- defaultEmail {
-- emailFrom = "you@yourdomain.com"
-- , emailTo = "person@example.com"
-- , emailSubject = "This is an example email!"
-- }
--
data Email
Email :: Text -> [Text] -> [Text] -> [Text] -> Text -> Maybe Text -> Maybe Text -> Maybe Text -> Text -> Map Text Text -> Maybe Bool -> Maybe TrackLinks -> [Attachment] -> Email
[emailFrom] :: Email -> Text
[emailTo] :: Email -> [Text]
[emailCc] :: Email -> [Text]
[emailBcc] :: Email -> [Text]
[emailSubject] :: Email -> Text
[emailTag] :: Email -> Maybe Text
[emailHtml] :: Email -> Maybe Text
[emailText] :: Email -> Maybe Text
[emailReplyTo] :: Email -> Text
[emailHeaders] :: Email -> Map Text Text
[emailTrackOpens] :: Email -> Maybe Bool
[emailTrackLinks] :: Email -> Maybe TrackLinks
[emailAttachments] :: Email -> [Attachment]
defaultEmail :: Email
-- | Send a single email using a template:
-- https://postmarkapp.com/developer/api/templates-api#email-with-template
emailWithTemplate :: EmailWithTemplate -> PostmarkRequest' Sent
data EmailWithTemplate
EmailWithTemplate :: Int -> Map Text Text -> Bool -> Text -> [Text] -> [Text] -> [Text] -> Maybe Text -> Text -> Map Text Text -> Maybe Bool -> Maybe TrackLinks -> [Attachment] -> EmailWithTemplate
[templateId] :: EmailWithTemplate -> Int
[templateModel] :: EmailWithTemplate -> Map Text Text
[inlineCss] :: EmailWithTemplate -> Bool
[emailFrom'] :: EmailWithTemplate -> Text
[emailTo'] :: EmailWithTemplate -> [Text]
[emailCc'] :: EmailWithTemplate -> [Text]
[emailBcc'] :: EmailWithTemplate -> [Text]
[emailTag'] :: EmailWithTemplate -> Maybe Text
[emailReplyTo'] :: EmailWithTemplate -> Text
[emailHeaders'] :: EmailWithTemplate -> Map Text Text
[emailTrackOpens'] :: EmailWithTemplate -> Maybe Bool
[emailTrackLinks'] :: EmailWithTemplate -> Maybe TrackLinks
[emailAttachments'] :: EmailWithTemplate -> [Attachment]
defaultEmailWithTemplate :: EmailWithTemplate
-- | When “link tracking” is enabled, Postmark will record statistics when
-- a user clicks on a link in an email. You can use this feature to
-- determine if a particular recipient has clicked a link that was
-- emailed to them.
--
--
-- https://postmarkapp.com/developer/user-guide/tracking-links#enabling-link-tracking
data TrackLinks
-- | No links will be replaced or tracked.
None :: TrackLinks
-- | Links will be replaced in both HTML and text bodies.
HtmlAndText :: TrackLinks
-- | Links will be replaced in only the HTML body. You may want this option
-- if you do not want encoded tracking links to appear in the plain text
-- of an email.
HtmlOnly :: TrackLinks
-- | Links will be replaced in only the text body.
TextOnly :: TrackLinks
data Attachment
Attachment :: Text -> Text -> Text -> Attachment
[attachmentName] :: Attachment -> Text
[attachmentContent] :: Attachment -> Text
[attachmentContentType] :: Attachment -> Text
data Sent
Sent :: Text -> Text -> Text -> Sent
[postmarkMessageId] :: Sent -> Text
[postmarkSubmittedAt] :: Sent -> Text
[postmarkTo] :: Sent -> Text
data PostmarkError
PostmarkError :: PostmarkErrorType -> Text -> PostmarkError
[errorType] :: PostmarkError -> PostmarkErrorType
[errorMessage] :: PostmarkError -> Text
data PostmarkErrorType
PostmarkBadApiToken :: PostmarkErrorType
PostmarkInvalidEmail :: PostmarkErrorType
PostmarkSenderNotFound :: PostmarkErrorType
PostmarkSenderNotConfirmed :: PostmarkErrorType
PostmarkInvalidJson :: PostmarkErrorType
PostmarkIncompatibleJson :: PostmarkErrorType
PostmarkNotAllowed :: PostmarkErrorType
PostmarkInactive :: PostmarkErrorType
PostmarkBounceNotFound :: PostmarkErrorType
PostmarkBounceQueryException :: PostmarkErrorType
PostmarkJsonRequired :: PostmarkErrorType
PostmarkTooManyMessages :: PostmarkErrorType
PostmarkTemplateQueryException :: PostmarkErrorType
PostmarkTemplateNotFound :: PostmarkErrorType
PostmarkTemplateLimitWouldBeExceeded :: PostmarkErrorType
PostmarkTemplateNoDataReceived :: PostmarkErrorType
PostmarkTemplateRequiredFieldMissing :: PostmarkErrorType
PostmarkTemplateFieldTooLarge :: PostmarkErrorType
PostmarkTemplateFieldInvalid :: PostmarkErrorType
PostmarkUnkownError :: Int -> PostmarkErrorType
-- | Run the specified request with the specified settings.
request :: PostmarkSettings -> PostmarkRequest e a -> IO (PostmarkResponse e a)
data PostmarkRequest e a
[PostmarkRequest] :: (FromJSON e, FromJSON a) => StdMethod -> Text -> RequestTransformer -> PostmarkRequest e a
type PostmarkRequest' a = PostmarkRequest PostmarkError a
data PostmarkResponse e a
PostmarkSuccess :: a -> PostmarkResponse e a
PostmarkUnauthorized :: PostmarkResponse e a
PostmarkFailure :: e -> PostmarkResponse e a
PostmarkUnexpected :: PostmarkUnexpectedType -> Int -> Maybe Text -> Maybe Text -> PostmarkResponse e a
data PostmarkUnexpectedType
ServerError :: PostmarkUnexpectedType
UnexpectedResponseCode :: PostmarkUnexpectedType
JsonSyntaxError :: PostmarkUnexpectedType
JsonFormatError :: PostmarkUnexpectedType
type PostmarkResponse' a = PostmarkResponse PostmarkError a
syntaxErr :: Int -> ByteString -> Text -> PostmarkResponse e a
formatErr :: Int -> ByteString -> Text -> PostmarkResponse e a
-- | postmark is a haskell toolkit for dealing with the
-- postmarkapp.com api for sending and receiving email.
module Network.Api.Postmark.Tutorial