ses-html 0.1.0.0 → 0.2.0.0
raw patch · 2 files changed
+14/−8 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Network.SES: Error :: SESError -> SESResult
+ Network.SES: Success :: SESResult
+ Network.SES: data SESResult
- Network.SES: sendEmail :: PublicKey -> SecretKey -> Region -> From -> To -> Subject -> ByteString -> IO (Either SESError ())
+ Network.SES: sendEmail :: PublicKey -> SecretKey -> Region -> From -> To -> Subject -> ByteString -> IO SESResult
- Network.SES: sendEmailBlaze :: PublicKey -> SecretKey -> Region -> From -> To -> Subject -> Html -> IO (Either SESError ())
+ Network.SES: sendEmailBlaze :: PublicKey -> SecretKey -> Region -> From -> To -> Subject -> Html -> IO SESResult
Files
- ses-html.cabal +2/−2
- src/Network/SES.hs +12/−6
ses-html.cabal view
@@ -1,6 +1,6 @@ name: ses-html-version: 0.1.0.0-synopsis: Send html emails written in Haskell +version: 0.2.0.0+synopsis: Send HTML formatted emails using Amazon's SES REST API with blaze license: BSD3 license-file: LICENSE author: David Johnson
src/Network/SES.hs view
@@ -12,6 +12,7 @@ , Region (..) , SESErrorType (..) , SESError (..)+ , SESResult (..) , SESErrorCode , SESErrorMessage ) where@@ -56,6 +57,11 @@ newtype SecretKey = SecretKey ByteString deriving (Show, Eq) ------------------------------------------------------------------------------+-- | The result of invoking an SES action+data SESResult = Error SESError -- ^ The encapsulated 'SESError'+ | Success -- ^ A successful email has been sent++------------------------------------------------------------------------------ -- | Types for AWS 'Region's data Region = USEast1 -- ^ US East 1 Region | USWest2 -- ^ US West 2 Region@@ -91,7 +97,7 @@ -> To -- ^ The Email recipient -> Subject -- ^ The Subject of the Email -> Html -- ^ The Html of the email body- -> IO (Either SESError ())+ -> IO SESResult sendEmailBlaze publicKey secretKey@@ -111,7 +117,7 @@ -> To -- ^ The Email recipient -> Subject -- ^ The Subject of the Email -> L.ByteString -- ^ Raw Html - -> IO (Either SESError ())+ -> IO SESResult sendEmail = makeRequest ------------------------------------------------------------------------------@@ -162,7 +168,7 @@ -> To -- ^ The Email recipient -> Subject -- ^ The Subject of the Email -> L.ByteString -- ^ Raw Html - -> IO (Either SESError ())+ -> IO SESResult makeRequest (PublicKey publicKey) (SecretKey secretKey)@@ -213,14 +219,14 @@ code = let c = getFromTagSoup "Code" tags in fromMaybe UnknownErrorType (readMaybe (unpack c) :: Maybe SESErrorType) sesMsg = getFromTagSoup "Message" tags- return $ Left $ SESError (getStatusCode resp) code sesMsg+ return $ Error $ SESError (getStatusCode resp) code sesMsg where getFromTagSoup x tags = let [ _, TagText d] = filterFront . filterBack $ tags filterFront = dropWhile (/=(TagOpen x [])) filterBack = takeWhile (/=(TagClose x)) in d- connectionError = return . Left . SESConnectionError . pack . show- returnSuccess = return $ Right ()+ connectionError = return . Error . SESConnectionError . pack . show+ returnSuccess = return Success ------------------------------------------------------------------------------ -- | Digital Signature creation