hailgun 0.1.1.0 → 0.2.0.0
raw patch · 2 files changed
+11/−3 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Mail.Hailgun: hailgunProxy :: HailgunContext -> Maybe Proxy
- Mail.Hailgun: HailgunContext :: String -> String -> HailgunContext
+ Mail.Hailgun: HailgunContext :: String -> String -> Maybe Proxy -> HailgunContext
Files
- Mail/Hailgun.hs +10/−2
- hailgun.cabal +1/−1
Mail/Hailgun.hs view
@@ -36,7 +36,8 @@ import Data.Time.Clock (UTCTime(..)) import Data.Time.LocalTime (zonedTimeToUTC) import Text.Email.Validate-import Network.HTTP.Client (Request(..), Response(..), parseUrl, httpLbs, withManager, responseStatus, responseBody, applyBasicAuth, setQueryString)+import Network.HTTP.Client (Request(..), Response(..), parseUrl, httpLbs, withManager, responseStatus, responseBody, applyBasicAuth, setQueryString, Proxy(..))+import Network.HTTP.Client.Internal (addProxy) import Network.HTTP.Client.MultipartFormData (Part(..), formDataBody, partBS) import Network.HTTP.Client.TLS (tlsManagerSettings) import qualified Network.HTTP.Types.Status as NT@@ -182,6 +183,7 @@ -- TODO better way to represent a domain { hailgunDomain :: String -- ^ The domain of the mailgun account that you wish to send the emails through. , hailgunApiKey :: String -- ^ The API key for the mailgun account so that you can successfully make requests. Please note that it should include the 'key' prefix.+ , hailgunProxy :: Maybe Proxy } -- TODO replace with MailgunSendResponse@@ -303,7 +305,13 @@ return $ applyHailgunAuth context requestWithBody applyHailgunAuth :: HailgunContext -> Request -> Request-applyHailgunAuth context = applyBasicAuth (BC.pack "api") (BC.pack . hailgunApiKey $ context)+applyHailgunAuth context = addRequestProxy (hailgunProxy context) . authRequest+ where + addRequestProxy :: Maybe Proxy -> Request -> Request+ addRequestProxy (Just proxy) = addProxy (proxyHost proxy) (proxyPort proxy)+ addRequestProxy _ = id++ authRequest = applyBasicAuth (BC.pack "api") (BC.pack . hailgunApiKey $ context) data HailgunDomainResponse = HailgunDomainResponse { hdrTotalCount :: Integer
hailgun.cabal view
@@ -10,7 +10,7 @@ -- PVP summary: +-+------- breaking API changes -- | | +----- non-breaking API additions -- | | | +--- code changes with no API change-version: 0.1.1.0+version: 0.2.0.0 -- A short (one-line) description of the package. synopsis: Mailgun REST api interface for Haskell.