MailChimp avatar MailChimp committed d6dcc30

Add /messages/content API call and add recipient type parameter to sending calls

Comments (0)

Files changed (3)

     port:   443,
     prefix: '/api/1.0/',
     method: 'POST',
-    headers: {'Content-Type': 'application/json', 'User-Agent': 'Mandrill-Node/1.0.36'}
+    headers: {'Content-Type': 'application/json', 'User-Agent': 'Mandrill-Node/1.0.37'}
 }
 
 class exports.Mandrill
              - to[] {Object} a single recipient's information.
                  - email {String} the email address of the recipient
                  - name {String} the optional display name to use for the recipient
+                 - type {String} the header type to use for the recipient, defaults to "to" if not provided
          - headers {Object} optional extra headers to add to the message (most headers are allowed)
          - important {Boolean} whether or not this message is important, and should be delivered ahead of non-important messages
          - track_opens {Boolean} whether or not to turn on open tracking for the message
              - to[] {Object} a single recipient's information.
                  - email {String} the email address of the recipient
                  - name {String} the optional display name to use for the recipient
+                 - type {String} the header type to use for the recipient, defaults to "to" if not provided
          - headers {Object} optional extra headers to add to the message (most headers are allowed)
          - important {Boolean} whether or not this message is important, and should be delivered ahead of non-important messages
          - track_opens {Boolean} whether or not to turn on open tracking for the message
         @master.call('messages/info', params, onsuccess, onerror)
 
     ###
+    Get the full content of a recently sent message
+    @param {Object} params the hash of the parameters to pass to the request
+    @option params {String} id the unique id of the message to get - passed as the "_id" field in webhooks, send calls, or search calls
+    @param {Function} onsuccess an optional callback to execute when the API call is successfully made
+    @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception
+    ###
+    content: (params={}, onsuccess, onerror) ->
+        if typeof params == 'function'
+            onerror = onsuccess
+            onsuccess = params
+            params = {}
+
+
+        @master.call('messages/content', params, onsuccess, onerror)
+
+    ###
     Parse the full MIME document for an email message, returning the content of the message broken into its constituent pieces
     @param {Object} params the hash of the parameters to pass to the request
     @option params {String} raw_message the full MIME document of an email message
     method: 'POST',
     headers: {
       'Content-Type': 'application/json',
-      'User-Agent': 'Mandrill-Node/1.0.36'
+      'User-Agent': 'Mandrill-Node/1.0.37'
     }
   };
 
                  - to[] {Object} a single recipient's information.
                      - email {String} the email address of the recipient
                      - name {String} the optional display name to use for the recipient
+                     - type {String} the header type to use for the recipient, defaults to "to" if not provided
              - headers {Object} optional extra headers to add to the message (most headers are allowed)
              - important {Boolean} whether or not this message is important, and should be delivered ahead of non-important messages
              - track_opens {Boolean} whether or not to turn on open tracking for the message
                  - to[] {Object} a single recipient's information.
                      - email {String} the email address of the recipient
                      - name {String} the optional display name to use for the recipient
+                     - type {String} the header type to use for the recipient, defaults to "to" if not provided
              - headers {Object} optional extra headers to add to the message (most headers are allowed)
              - important {Boolean} whether or not this message is important, and should be delivered ahead of non-important messages
              - track_opens {Boolean} whether or not to turn on open tracking for the message
     };
 
     /*
+        Get the full content of a recently sent message
+        @param {Object} params the hash of the parameters to pass to the request
+        @option params {String} id the unique id of the message to get - passed as the "_id" field in webhooks, send calls, or search calls
+        @param {Function} onsuccess an optional callback to execute when the API call is successfully made
+        @param {Function} onerror an optional callback to execute when the API call errors out - defaults to throwing the error as an exception
+    */
+
+
+    Messages.prototype.content = function(params, onsuccess, onerror) {
+      if (params == null) {
+        params = {};
+      }
+      if (typeof params === 'function') {
+        onerror = onsuccess;
+        onsuccess = params;
+        params = {};
+      }
+      return this.master.call('messages/content', params, onsuccess, onerror);
+    };
+
+    /*
         Parse the full MIME document for an email message, returning the content of the message broken into its constituent pieces
         @param {Object} params the hash of the parameters to pass to the request
         @option params {String} raw_message the full MIME document of an email message
   "author": "Mandrill Devs <community@mandrill.com> (http://mandrill.com)",
   "name": "mandrill-api",
   "description": "The official API client for the Mandrill email as a service product.",
-  "version": "1.0.36",
+  "version": "1.0.37",
   "homepage": "https://bitbucket.org/mailchimp/mandrill-api-node",
   "repository": {
     "type": "git",
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.