MailChimp avatar MailChimp committed 65ebd24

Add subaccounts API

Comments (0)

Files changed (3)

     port:   443,
     prefix: '/api/1.0/',
     method: 'POST',
-    headers: {'Content-Type': 'application/json', 'User-Agent': 'Mandrill-Node/1.0.30'}
+    headers: {'Content-Type': 'application/json', 'User-Agent': 'Mandrill-Node/1.0.31'}
 }
 
 class exports.Mandrill
         @messages = new Messages(this)
         @whitelists = new Whitelists(this)
         @internal = new Internal(this)
+        @subaccounts = new Subaccounts(this)
         @urls = new Urls(this)
         @webhooks = new Webhooks(this)
         @senders = new Senders(this)
                          - content {String} the merge variable's content
          - tags {Array} an array of string to tag the message with.  Stats are accumulated using tags, though we only store the first 100 we see, so this should not be unique or change frequently.  Tags should be 50 characters or less.  Any tags starting with an underscore are reserved for internal use and will cause errors.
              - tags[] {String} a single tag - must not start with an underscore
+         - subaccount {String} the unique id of a subaccount for this message - must already exist or will fail with an error
          - google_analytics_domains {Array} an array of strings indicating for which any matching URLs will automatically have Google Analytics parameters appended to their query string automatically.
          - google_analytics_campaign {Array|string} optional string indicating the value to set for the utm_campaign tracking parameter. If this isn't provided the email's from address will be used instead.
          - metadata {Array} metadata an associative array of user metadata. Mandrill will store this metadata and make it available for retrieval. In addition, you can select up to 10 metadata fields to index and make searchable using the Mandrill search api.
                          - content {String} the merge variable's content
          - tags {Array} an array of string to tag the message with.  Stats are accumulated using tags, though we only store the first 100 we see, so this should not be unique or change frequently.  Tags should be 50 characters or less.  Any tags starting with an underscore are reserved for internal use and will cause errors.
              - tags[] {String} a single tag - must not start with an underscore
+         - subaccount {String} the unique id of a subaccount for this message - must already exist or will fail with an error
          - google_analytics_domains {Array} an array of strings indicating for which any matching URLs will automatically have Google Analytics parameters appended to their query string automatically.
          - google_analytics_campaign {Array|string} optional string indicating the value to set for the utm_campaign tracking parameter. If this isn't provided the email's from address will be used instead.
          - metadata {Array} metadata an associative array of user metadata. Mandrill will store this metadata and make it available for retrieval. In addition, you can select up to 10 metadata fields to index and make searchable using the Mandrill search api.
 class Internal
     constructor: (@master) ->
 
+class Subaccounts
+    constructor: (@master) ->
+
+
+    ###
+    Get the list of subaccounts defined for the account, optionally filtered by a prefix
+    @param {Object} params the hash of the parameters to pass to the request
+    @option params {String} q an optional prefix to filter the subaccounts' ids and names
+    @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
+    ###
+    list: (params={}, onsuccess, onerror) ->
+        if typeof params == 'function'
+            onerror = onsuccess
+            onsuccess = params
+            params = {}
+
+        params["q"] ?= null
+
+        @master.call('subaccounts/list', params, onsuccess, onerror)
+
+    ###
+    Add a new subaccount
+    @param {Object} params the hash of the parameters to pass to the request
+    @option params {String} id a unique identifier for the subaccount to be used in sending calls
+    @option params {String} name an optional display name to further identify the subaccount
+    @option params {String} notes optional extra text to associate with the subaccount
+    @option params {Integer} custom_quota an optional manual hourly quota for the subaccount. If not specified, Mandrill will manage this based on reputation
+    @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
+    ###
+    add: (params={}, onsuccess, onerror) ->
+        if typeof params == 'function'
+            onerror = onsuccess
+            onsuccess = params
+            params = {}
+
+        params["name"] ?= null
+        params["notes"] ?= null
+        params["custom_quota"] ?= null
+
+        @master.call('subaccounts/add', params, onsuccess, onerror)
+
+    ###
+    Given the ID of an existing subaccount, return the data about it
+    @param {Object} params the hash of the parameters to pass to the request
+    @option params {String} id the unique identifier of the subaccount to query
+    @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
+    ###
+    info: (params={}, onsuccess, onerror) ->
+        if typeof params == 'function'
+            onerror = onsuccess
+            onsuccess = params
+            params = {}
+
+
+        @master.call('subaccounts/info', params, onsuccess, onerror)
+
+    ###
+    Update an existing subaccount
+    @param {Object} params the hash of the parameters to pass to the request
+    @option params {String} id the unique identifier of the subaccount to update
+    @option params {String} name an optional display name to further identify the subaccount
+    @option params {String} notes optional extra text to associate with the subaccount
+    @option params {Integer} custom_quota an optional manual hourly quota for the subaccount. If not specified, Mandrill will manage this based on reputation
+    @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
+    ###
+    update: (params={}, onsuccess, onerror) ->
+        if typeof params == 'function'
+            onerror = onsuccess
+            onsuccess = params
+            params = {}
+
+        params["name"] ?= null
+        params["notes"] ?= null
+        params["custom_quota"] ?= null
+
+        @master.call('subaccounts/update', params, onsuccess, onerror)
+
+    ###
+    Delete an existing subaccount. Any email related to the subaccount will be saved, but stats will be removed and any future sending calls to this subaccount will fail.
+    @param {Object} params the hash of the parameters to pass to the request
+    @option params {String} id the unique identifier of the subaccount to delete
+    @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
+    ###
+    delete: (params={}, onsuccess, onerror) ->
+        if typeof params == 'function'
+            onerror = onsuccess
+            onsuccess = params
+            params = {}
+
+
+        @master.call('subaccounts/delete', params, onsuccess, onerror)
+
+    ###
+    Pause a subaccount's sending. Any future emails delivered to this subaccount will be queued for a maximum of 3 days until the subaccount is resumed.
+    @param {Object} params the hash of the parameters to pass to the request
+    @option params {String} id the unique identifier of the subaccount to pause
+    @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
+    ###
+    pause: (params={}, onsuccess, onerror) ->
+        if typeof params == 'function'
+            onerror = onsuccess
+            onsuccess = params
+            params = {}
+
+
+        @master.call('subaccounts/pause', params, onsuccess, onerror)
+
+    ###
+    Resume a paused subaccount's sending
+    @param {Object} params the hash of the parameters to pass to the request
+    @option params {String} id the unique identifier of the subaccount to resume
+    @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
+    ###
+    resume: (params={}, onsuccess, onerror) ->
+        if typeof params == 'function'
+            onerror = onsuccess
+            onsuccess = params
+            params = {}
+
+
+        @master.call('subaccounts/resume', params, onsuccess, onerror)
 class Urls
     constructor: (@master) ->
 
 // Generated by CoffeeScript 1.3.3
 (function() {
-  var Exports, Inbound, Internal, Messages, OPTS, Rejects, Senders, Tags, Templates, Urls, Users, Webhooks, Whitelists, https;
+  var Exports, Inbound, Internal, Messages, OPTS, Rejects, Senders, Subaccounts, Tags, Templates, Urls, Users, Webhooks, Whitelists, https;
 
   https = require('https');
 
     method: 'POST',
     headers: {
       'Content-Type': 'application/json',
-      'User-Agent': 'Mandrill-Node/1.0.30'
+      'User-Agent': 'Mandrill-Node/1.0.31'
     }
   };
 
       this.messages = new Messages(this);
       this.whitelists = new Whitelists(this);
       this.internal = new Internal(this);
+      this.subaccounts = new Subaccounts(this);
       this.urls = new Urls(this);
       this.webhooks = new Webhooks(this);
       this.senders = new Senders(this);
                              - content {String} the merge variable's content
              - tags {Array} an array of string to tag the message with.  Stats are accumulated using tags, though we only store the first 100 we see, so this should not be unique or change frequently.  Tags should be 50 characters or less.  Any tags starting with an underscore are reserved for internal use and will cause errors.
                  - tags[] {String} a single tag - must not start with an underscore
+             - subaccount {String} the unique id of a subaccount for this message - must already exist or will fail with an error
              - google_analytics_domains {Array} an array of strings indicating for which any matching URLs will automatically have Google Analytics parameters appended to their query string automatically.
              - google_analytics_campaign {Array|string} optional string indicating the value to set for the utm_campaign tracking parameter. If this isn't provided the email's from address will be used instead.
              - metadata {Array} metadata an associative array of user metadata. Mandrill will store this metadata and make it available for retrieval. In addition, you can select up to 10 metadata fields to index and make searchable using the Mandrill search api.
                              - content {String} the merge variable's content
              - tags {Array} an array of string to tag the message with.  Stats are accumulated using tags, though we only store the first 100 we see, so this should not be unique or change frequently.  Tags should be 50 characters or less.  Any tags starting with an underscore are reserved for internal use and will cause errors.
                  - tags[] {String} a single tag - must not start with an underscore
+             - subaccount {String} the unique id of a subaccount for this message - must already exist or will fail with an error
              - google_analytics_domains {Array} an array of strings indicating for which any matching URLs will automatically have Google Analytics parameters appended to their query string automatically.
              - google_analytics_campaign {Array|string} optional string indicating the value to set for the utm_campaign tracking parameter. If this isn't provided the email's from address will be used instead.
              - metadata {Array} metadata an associative array of user metadata. Mandrill will store this metadata and make it available for retrieval. In addition, you can select up to 10 metadata fields to index and make searchable using the Mandrill search api.
 
   })();
 
+  Subaccounts = (function() {
+
+    function Subaccounts(master) {
+      this.master = master;
+    }
+
+    /*
+        Get the list of subaccounts defined for the account, optionally filtered by a prefix
+        @param {Object} params the hash of the parameters to pass to the request
+        @option params {String} q an optional prefix to filter the subaccounts' ids and names
+        @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
+    */
+
+
+    Subaccounts.prototype.list = function(params, onsuccess, onerror) {
+      var _ref;
+      if (params == null) {
+        params = {};
+      }
+      if (typeof params === 'function') {
+        onerror = onsuccess;
+        onsuccess = params;
+        params = {};
+      }
+      if ((_ref = params["q"]) == null) {
+        params["q"] = null;
+      }
+      return this.master.call('subaccounts/list', params, onsuccess, onerror);
+    };
+
+    /*
+        Add a new subaccount
+        @param {Object} params the hash of the parameters to pass to the request
+        @option params {String} id a unique identifier for the subaccount to be used in sending calls
+        @option params {String} name an optional display name to further identify the subaccount
+        @option params {String} notes optional extra text to associate with the subaccount
+        @option params {Integer} custom_quota an optional manual hourly quota for the subaccount. If not specified, Mandrill will manage this based on reputation
+        @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
+    */
+
+
+    Subaccounts.prototype.add = function(params, onsuccess, onerror) {
+      var _ref, _ref1, _ref2;
+      if (params == null) {
+        params = {};
+      }
+      if (typeof params === 'function') {
+        onerror = onsuccess;
+        onsuccess = params;
+        params = {};
+      }
+      if ((_ref = params["name"]) == null) {
+        params["name"] = null;
+      }
+      if ((_ref1 = params["notes"]) == null) {
+        params["notes"] = null;
+      }
+      if ((_ref2 = params["custom_quota"]) == null) {
+        params["custom_quota"] = null;
+      }
+      return this.master.call('subaccounts/add', params, onsuccess, onerror);
+    };
+
+    /*
+        Given the ID of an existing subaccount, return the data about it
+        @param {Object} params the hash of the parameters to pass to the request
+        @option params {String} id the unique identifier of the subaccount to query
+        @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
+    */
+
+
+    Subaccounts.prototype.info = function(params, onsuccess, onerror) {
+      if (params == null) {
+        params = {};
+      }
+      if (typeof params === 'function') {
+        onerror = onsuccess;
+        onsuccess = params;
+        params = {};
+      }
+      return this.master.call('subaccounts/info', params, onsuccess, onerror);
+    };
+
+    /*
+        Update an existing subaccount
+        @param {Object} params the hash of the parameters to pass to the request
+        @option params {String} id the unique identifier of the subaccount to update
+        @option params {String} name an optional display name to further identify the subaccount
+        @option params {String} notes optional extra text to associate with the subaccount
+        @option params {Integer} custom_quota an optional manual hourly quota for the subaccount. If not specified, Mandrill will manage this based on reputation
+        @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
+    */
+
+
+    Subaccounts.prototype.update = function(params, onsuccess, onerror) {
+      var _ref, _ref1, _ref2;
+      if (params == null) {
+        params = {};
+      }
+      if (typeof params === 'function') {
+        onerror = onsuccess;
+        onsuccess = params;
+        params = {};
+      }
+      if ((_ref = params["name"]) == null) {
+        params["name"] = null;
+      }
+      if ((_ref1 = params["notes"]) == null) {
+        params["notes"] = null;
+      }
+      if ((_ref2 = params["custom_quota"]) == null) {
+        params["custom_quota"] = null;
+      }
+      return this.master.call('subaccounts/update', params, onsuccess, onerror);
+    };
+
+    /*
+        Delete an existing subaccount. Any email related to the subaccount will be saved, but stats will be removed and any future sending calls to this subaccount will fail.
+        @param {Object} params the hash of the parameters to pass to the request
+        @option params {String} id the unique identifier of the subaccount to delete
+        @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
+    */
+
+
+    Subaccounts.prototype["delete"] = function(params, onsuccess, onerror) {
+      if (params == null) {
+        params = {};
+      }
+      if (typeof params === 'function') {
+        onerror = onsuccess;
+        onsuccess = params;
+        params = {};
+      }
+      return this.master.call('subaccounts/delete', params, onsuccess, onerror);
+    };
+
+    /*
+        Pause a subaccount's sending. Any future emails delivered to this subaccount will be queued for a maximum of 3 days until the subaccount is resumed.
+        @param {Object} params the hash of the parameters to pass to the request
+        @option params {String} id the unique identifier of the subaccount to pause
+        @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
+    */
+
+
+    Subaccounts.prototype.pause = function(params, onsuccess, onerror) {
+      if (params == null) {
+        params = {};
+      }
+      if (typeof params === 'function') {
+        onerror = onsuccess;
+        onsuccess = params;
+        params = {};
+      }
+      return this.master.call('subaccounts/pause', params, onsuccess, onerror);
+    };
+
+    /*
+        Resume a paused subaccount's sending
+        @param {Object} params the hash of the parameters to pass to the request
+        @option params {String} id the unique identifier of the subaccount to resume
+        @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
+    */
+
+
+    Subaccounts.prototype.resume = function(params, onsuccess, onerror) {
+      if (params == null) {
+        params = {};
+      }
+      if (typeof params === 'function') {
+        onerror = onsuccess;
+        onsuccess = params;
+        params = {};
+      }
+      return this.master.call('subaccounts/resume', params, onsuccess, onerror);
+    };
+
+    return Subaccounts;
+
+  })();
+
   Urls = (function() {
 
     function Urls(master) {
   "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.30",
+  "version": "1.0.31",
   "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.