git.iko.soy/typeable/mandrill
on issue-38-support-aeson-1.0 help sign in
122 lines 3.2 kB history raw
1[![Build Status](https://travis-ci.org/adinapoli/mandrill.svg?branch=master)](https://travis-ci.org/adinapoli/mandrill)
2[![Coverage Status](https://img.shields.io/coveralls/adinapoli/mandrill.svg)](https://coveralls.io/r/adinapoli/mandrill)
4# Haskell Client for the Mandrill JSON API
6This module implement a low-level, 1:1 mapping API to
7the [Mandrill](http://mandrillapp.com) transactional email service.
9# Changelog
11## Version 0.5.2.3
13* Added support for aeson-1.0.0.0 by relaxing its upper bound.
15## Version 0.5.2.2
17* Added support for QuickCheck-2.9 by relaxing its upper bound.
19## Version 0.5.2.1
21* Added `Functor`, `Foldable` and `Traversable` instances to `MandrillResponse` (Courtesy of @dredozubov)
23## Version 0.5.2.0
25* Added inbound calls (Courtesy of @mwotton)
27## Version 0.5.1.0
29* Relaxed the constraint on `aeson` to allow `0.11.0.0`.
31## Version 0.5.0.0
33* Changed the `MandrillHeaders` type synonym from `Value` to `Object`.
35* Changed the `mmsg_metadata` and `mmdt_values` fields from `MandrillVars` to `Object`.
37* Changed the `mmsg_global_merge_vars` and `mmvr_vars` fields from `[MandrillVars]` to `[MergeVar]`
39* Added the `MergeVar` data type:
41```haskell
42data MergeVar = MergeVar {
43 _mv_name :: !Text
44 , _mv_content :: Value
45 }
46```
48* Removed the `MandrillVars` type synonym.
50## Version 0.4.0.0
52* Modified the `Base64ByteString` type to accept another constructor. This
53 allows the user to pass already-encoded Base64 strings which might be coming
54 upstream.
56# Example
58This package was built with pragmatism and reuse in mind. This means
59this API comes in two flavours: an IO-based and an handy monad transformer
60which can be plugged in your stack of choice.
61Example:
63``` haskell
64{-# LANGUAGE OverloadedStrings #-}
65import Text.Email.Validate
66import Network.API.Mandrill
68main :: IO ()
69main = do
70 case validate "foo@example.com" of
71 Left err -> print $ "Invalid email!" ++ show err
72 Right addr -> runMandrill "MYTOKENHERE" $ do
73 let msg = "<p>My Html</p>"
74 res <- sendEmail (newTextMessage addr [addr] "Hello" msg)
75 case res of
76 MandrillSuccess k -> liftIO (print k)
77 MandrillFailure f -> liftIO (print f)
78```
80# Supported API versions
82* 1.0 (partially)
83 - [Users call](https://mandrillapp.com/api/docs/users.JSON.html) - 100%
84 + info.json
85 + ~~ping.json~~ (as **doesn't return valid json!**)
86 + ping2.json
87 + senders.json
89 - [Messages call](https://mandrillapp.com/api/docs/messages.JSON.html)
90 + send.json
92 - [Senders call](https://mandrillapp.com/api/docs/senders.JSON.html)
93 + verify-domain.json
95 - [Inbound call](https://mandrillapp.com/api/docs/inbound.JSON.html)
96 + add-route.json
97 + add-domain.json
99# Testing online API
101To test the online API, first build the package with tests enabled:
103```
104cabal install --enable-tests
105```
107Then export an environment variable with your Mandrill **Test** token:
109```
110export MANDRILL_API_KEY="YOURKEYGOESHERE"
111```
113And finally execute the testsuite:
115```
116cabal test
117```
119# Contributions
120This library scratches my own itches, but please fork away!
121Pull requests are encouraged to implement the part of the API
122you need.