├── .github
└── PULL_REQUEST_TEMPLATE.md
├── .travis.yml
├── CHANGELOG.md
├── LICENSE
├── README.md
├── git_push.sh
├── package.json
└── src
├── ApiClient.js
├── api
├── AllowlistsApi.js
├── ExportsApi.js
├── InboundApi.js
├── IpsApi.js
├── MessagesApi.js
├── MetadataApi.js
├── RejectsApi.js
├── SendersApi.js
├── SubaccountsApi.js
├── TagsApi.js
├── TemplatesApi.js
├── UrlsApi.js
├── UsersApi.js
├── WebhooksApi.js
└── WhitelistsApi.js
└── index.js
/.github/PULL_REQUEST_TEMPLATE.md:
--------------------------------------------------------------------------------
1 | Note: This repository is auto-generated, and does not accept pull requests.
2 |
3 | To make changes or open issues for this SDK, use the [code generation repository](https://github.com/mailchimp/mailchimp-client-lib-codegen).
4 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: node_js
2 | node_js:
3 | - "6"
4 | - "6.1"
5 | - "5"
6 | - "5.11"
7 |
8 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | # Changelog
2 |
3 | ## Transactional
4 |
5 | ### 1.0.56
6 | * Adding DMARC and DKIM2 fields to the API reference
7 |
8 | ### 1.0.55
9 | * Updating github actions bot user email
10 |
11 | ### 1.0.54
12 | * Fixing a problem with Github auth token that was preventing builds from being created.
13 |
14 | ### 1.0.53
15 | * Fixed broken ruby SDK test, updated PHP SDK to send form data via JSON
16 |
17 | ### 1.0.52
18 | * Added the `is_broken_template` response to the /template endpoints that include it
19 |
20 | ### 1.0.51
21 | * Fixed `/messages/send-template` documentation where incorrectly referenced the template name usage.
22 |
23 | ### 1.0.50
24 | * Added a response parameter to /messages/send and /messages/send-template called 'queued_response' that details why an email was queued.
25 |
26 | ### 1.0.48
27 | * Allowing users to schedule messages (using messages/send, messages/send-template, messages/send-raw and messages/reschedule APIs) within a year from the date of scheduling.
28 |
29 | ### 1.0.46
30 | * Added a little more granularity to the `set_timeout` method to the Client class in the Ruby SDK; now supports `read`, `write` and `connect` parameters, which will default to the `timeout` param if unspecified, or 300 seconds if `timeout` is unspecified.
31 |
32 | ### 1.0.45
33 | * Added a `set_timeout` method to the Client class in the Ruby SDK
34 |
35 | ### 1.0.44
36 | * Added a `set_timeout` method to the Client class in the Python SDK
37 |
38 | ### 1.0.43
39 | * Added a `setTimeout` method to the Configuration class in the PHP SDK.
40 |
41 | ### 1.0.42
42 | * Added a `setDefaultTimeoutMs` method to the node client. This allows users to override the default timeout for API requests, which is set to 5 minutes by default.
43 |
44 | ### 1.0.41
45 | * Updated the "reject_reasons" response for /messages/send and /messages/send-template to correctly use "hard-bounce" and "soft-bounce" instead of the previously stated "hard_bounce" and "soft_bounce".
46 |
47 | ### 1.0.40
48 | * Added the new /allowlists/ series of endpoints and the /exports/allowlist endpoint to the API reference
49 |
50 | ### 1.0.39
51 | * Fixes the output directory for the Changelog for the php client library
52 |
53 | ### 1.0.38
54 | * A change was made to `mailchimp-transactional-php` - the API client will now always return an `Exception`, instead of an `Exception` or a string, when the API returns an error. Having to parse the response as a string was found to be a bit clunky.
55 |
56 | ### 1.0.37
57 | * Added a changelog, which will be used to describe changes to both transactional and marketing client libraries.
58 |
59 | ## Marketing
60 |
61 | ### 3.0.72
62 | * Updated the `PATCH /automations/.../emails/.../` documentation to state the required `workflow_type`
63 |
64 | ### 3.0.70
65 | * Added more granularity for the `timeout` field in the Ruby Marketing SDK; now supports `read_timeout`, `write_timeout` and `connect_timeout` fields which will default to the `timeout` value.
66 |
67 | ### 3.0.69
68 | * Added handling for a `timeout` field in the config block passed to the client constructor in the Ruby Marketing SDK.
69 |
70 | ### 3.0.68
71 | * Added handling for a `'timeout'` field in `set_config()` in the Python Marketing SDK.
72 |
73 | ### 3.0.67
74 | * Added a `setTimeout()` method to the configuration class in the PHP Marketing SDK, to allow manually setting the timeout for Guzzle requests.
75 |
76 | ### 3.0.65
77 | * Added a new API endpoint, `/3.0/account-exports`, allowing users to programatically export their account information
78 |
79 | ### 3.0.64
80 | * Fixes the output directory for the Changelog for the php client library
81 |
82 | ### 3.0.63
83 | * Added a changelog, which will be used to describe changes to both transactional and marketing client libraries.
84 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | Mailchimp Client Library License Agreement
2 |
3 | IMPORTANT- PLEASE READ CAREFULLY BEFORE OPENING, INSTALLING, COPYING OR USING THE CLIENT LIBRARY. This Client Library License Agreement (“Agreement”) is a legal document by and between you (hereinafter referred to as “You” “Your” or “Licensee”) and The Rocket Science Group LLC (“Mailchimp”) (each a “Party” and collectively, “Parties”) for the client library, including any upgrades, modified versions, updates, additions, and copies of the foregoing, including the software and related documentation (the “Mailchimp Client Library”).
4 |
5 | BY OPENING, INSTALLING, COPYING OR USING THE MAILCHIMP CLIENT LIBRARY OR ANY PORTION THEREOF, YOU AGREE TO ALL THE TERMS OF THIS AGREEMENT. IF YOU ARE AGREEING TO THIS AGREEMENT AS AN INDIVIDUAL, “YOU” “YOUR” AND “LICENSEE” REFERS TO YOU INDIVIDUALLY. IF YOU ARE AGREEING TO THIS AGREEMENT AS A REPRESENTATIVE OF A LEGAL ENTITY, YOU REPRESENT THAT YOU HAVE THE AUTHORITY TO BIND THAT ENTITY AND “YOU” “YOUR” AND “LICENSEE” REFERS TO THAT LEGAL ENTITY AND ALL THE USERS ACCESSING THE SOFTWARE BY, THROUGH OR ON BEHALF OF THAT LEGAL ENTITY. IF YOU DO NOT AGREE WITH ALL OF THE TERMS OF THIS AGREEMENT, DO NOT (AND ENSURE THAT YOUR END USERS DO NOT) OPEN, INSTALL, COPY OR USE THE MAILCHIMP CLIENT LIBRARY.
6 |
7 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
8 | 1. Definitions.
9 | “License” shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 10 of these Terms and Conditions for Use, Reproduction and Distribution.
10 | “Legal Entity” shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, “control” means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
11 | “You” (or “Your”) shall mean an individual or Legal Entity exercising permissions granted by this License.
12 | “Source” form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
13 | “Object” form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
14 | “Work” shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work.
15 | “Derivative Works” shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
16 | “Contribution” shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Mailchimp for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, “submitted” means any form of electronic, verbal, or written communication sent to Mailchimp or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, Mailchimp for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as “Not a Contribution.”
17 | “Contributor” shall mean Mailchimp and any individual or Legal Entity on behalf of whom a Contribution has been received by Mailchimp and subsequently incorporated within the Work.
18 |
19 | 2. Grant of Copyright License. Subject to the terms and conditions of this Agreement, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
20 |
21 | 3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
22 |
23 | 4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
24 | a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
25 | b) You must cause any modified files to carry prominent notices stating that You changed the files; and
26 | c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
27 | d) If the Work includes a “NOTICE” text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
28 | You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
29 |
30 | 5. Submission of Contributions. Any Contribution submitted for inclusion in the Work by You to Mailchimp shall be made under the terms and conditions of the Individual Contributor License Agreement or the Software Grant and Corporate Contributor License Agreement, as applicable.
31 |
32 | 6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of Mailchimp, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
33 |
34 | 7. Export controls. The Mailchimp Client Library is subject to united states export laws and regulations. You must comply with all domestic and international export laws and regulations that apply to the Mailchimp Client Library. These laws include restrictions on destinations, end-users and end use.
35 |
36 | 8. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
37 |
38 | 9. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
39 |
40 | 10. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
41 |
42 | Copyright 2020, The Rocket Science Group LLC
43 |
44 | Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
45 |
46 | You should include a copy of the License, typically in a file called LICENSE, in your work, and consider also including a NOTICE file.
47 |
48 | To apply the License to specific files in your work, attach the following boilerplate declaration, with the fields enclosed by brackets “[]” replaced with your own identifying information. (Don’t include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same “printed page” as the copyright notice for easier identification within third-party archives.
49 | Copyright [yyyy] [name of copyright owner]
50 |
51 | Licensed under the Mailchimp Client Library License Agreement (the “License”); you may not use this file except in compliance with the License. Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either or express or implied.
52 | See the License for the specific language governing permissions and
53 | limitations under the License.
54 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | # Mailchimp Transactional — Node.js
8 |
9 | The official Node.js client library for the Mailchimp Transactional API (v1)
10 |
11 | ## Installation
12 |
13 | ```
14 | npm install @mailchimp/mailchimp_transactional
15 | ```
16 |
17 | ## Quick Start
18 |
19 | ```javascript
20 | const mailchimp = require('@mailchimp/mailchimp_transactional')('YOUR_API_KEY');
21 |
22 | async function callPing() {
23 | const response = await mailchimp.users.ping();
24 | console.log(response);
25 | }
26 |
27 | callPing();
28 | ```
29 |
30 | ## Sending Requests
31 | All requests are sent via POST and accept a single argument as the request body parameter.
32 | ```javascript
33 | mailchimp.templates.publish({ name: 'My Template' });
34 | ```
35 |
36 | ## Output Formats
37 | Optionally, you can set the default response format for **all requests** to one of the following:
38 | - `json` *(default)*
39 | - `xml`
40 | - `php`
41 | - `yaml`
42 |
43 | ```javascript
44 | mailchimp.setDefaultOutputFormat('xml');
45 | ```
46 |
47 | You can also set the response format for a **single request** by passing in a special `outputFormat` param to the request body.
48 | ```javascript
49 | mailchimp.senders.list({ outputFormat: 'php' });
50 | ```
51 |
52 | ## PRs and Issues
53 | This repo is autogenerated from https://github.com/mailchimp/mailchimp-client-lib-codegen -- please submit PRs or issues there!
54 |
55 | ## API Endpoints
56 |
57 | All URIs are relative to *https://mandrillapp.com/api/1.0*
58 |
59 | | Method | Endpoint |
60 | | ---------- | -------- |
61 | | **allowlists.add** | /allowlists/add |
62 | | **allowlists.delete** | /allowlists/delete |
63 | | **allowlists.list** | /allowlists/list |
64 | | **exports.activity** | /exports/activity |
65 | | **exports.allowlist** | /exports/allowlist |
66 | | **exports.info** | /exports/info |
67 | | **exports.list** | /exports/list |
68 | | **exports.rejects** | /exports/rejects |
69 | | **exports.whitelist** | /exports/whitelist |
70 | | **inbound.addDomain** | /inbound/add-domain |
71 | | **inbound.addRoute** | /inbound/add-route |
72 | | **inbound.checkDomain** | /inbound/check-domain |
73 | | **inbound.deleteDomain** | /inbound/delete-domain |
74 | | **inbound.deleteRoute** | /inbound/delete-route |
75 | | **inbound.domains** | /inbound/domains |
76 | | **inbound.routes** | /inbound/routes |
77 | | **inbound.sendRaw** | /inbound/send-raw |
78 | | **inbound.updateRoute** | /inbound/update-route |
79 | | **ips.cancelWarmup** | /ips/cancel-warmup |
80 | | **ips.checkCustomDns** | /ips/check-custom-dns |
81 | | **ips.createPool** | /ips/create-pool |
82 | | **ips.delete** | /ips/delete |
83 | | **ips.deletePool** | /ips/delete-pool |
84 | | **ips.info** | /ips/info |
85 | | **ips.list** | /ips/list |
86 | | **ips.listPools** | /ips/list-pools |
87 | | **ips.poolInfo** | /ips/pool-info |
88 | | **ips.provision** | /ips/provision |
89 | | **ips.setCustomDns** | /ips/set-custom-dns |
90 | | **ips.setPool** | /ips/set-pool |
91 | | **ips.startWarmup** | /ips/start-warmup |
92 | | **messages.cancelScheduled** | /messages/cancel-scheduled |
93 | | **messages.content** | /messages/content |
94 | | **messages.info** | /messages/info |
95 | | **messages.listScheduled** | /messages/list-scheduled |
96 | | **messages.parse** | /messages/parse |
97 | | **messages.reschedule** | /messages/reschedule |
98 | | **messages.search** | /messages/search |
99 | | **messages.searchTimeSeries** | /messages/search-time-series |
100 | | **messages.send** | /messages/send |
101 | | **messages.sendRaw** | /messages/send-raw |
102 | | **messages.sendTemplate** | /messages/send-template |
103 | | **metadata.add** | /metadata/add |
104 | | **metadata.delete** | /metadata/delete |
105 | | **metadata.list** | /metadata/list |
106 | | **metadata.update** | /metadata/update |
107 | | **rejects.add** | /rejects/add |
108 | | **rejects.delete** | /rejects/delete |
109 | | **rejects.list** | /rejects/list |
110 | | **senders.addDomain** | /senders/add-domain |
111 | | **senders.checkDomain** | /senders/check-domain |
112 | | **senders.domains** | /senders/domains |
113 | | **senders.info** | /senders/info |
114 | | **senders.list** | /senders/list |
115 | | **senders.timeSeries** | /senders/time-series |
116 | | **senders.verifyDomain** | /senders/verify-domain |
117 | | **subaccounts.add** | /subaccounts/add |
118 | | **subaccounts.delete** | /subaccounts/delete |
119 | | **subaccounts.info** | /subaccounts/info |
120 | | **subaccounts.list** | /subaccounts/list |
121 | | **subaccounts.pause** | /subaccounts/pause |
122 | | **subaccounts.resume** | /subaccounts/resume |
123 | | **subaccounts.update** | /subaccounts/update |
124 | | **tags.allTimeSeries** | /tags/all-time-series |
125 | | **tags.delete** | /tags/delete |
126 | | **tags.info** | /tags/info |
127 | | **tags.list** | /tags/list |
128 | | **tags.timeSeries** | /tags/time-series |
129 | | **templates.add** | /templates/add |
130 | | **templates.delete** | /templates/delete |
131 | | **templates.info** | /templates/info |
132 | | **templates.list** | /templates/list |
133 | | **templates.publish** | /templates/publish |
134 | | **templates.render** | /templates/render |
135 | | **templates.timeSeries** | /templates/time-series |
136 | | **templates.update** | /templates/update |
137 | | **urls.addTrackingDomain** | /urls/add-tracking-domain |
138 | | **urls.checkTrackingDomain** | /urls/check-tracking-domain |
139 | | **urls.list** | /urls/list |
140 | | **urls.search** | /urls/search |
141 | | **urls.timeSeries** | /urls/time-series |
142 | | **urls.trackingDomains** | /urls/tracking-domains |
143 | | **users.info** | /users/info |
144 | | **users.ping** | /users/ping |
145 | | **users.ping2** | /users/ping2 |
146 | | **users.senders** | /users/senders |
147 | | **webhooks.add** | /webhooks/add |
148 | | **webhooks.delete** | /webhooks/delete |
149 | | **webhooks.info** | /webhooks/info |
150 | | **webhooks.list** | /webhooks/list |
151 | | **webhooks.update** | /webhooks/update |
152 | | **whitelists.add** | /whitelists/add |
153 | | **whitelists.delete** | /whitelists/delete |
154 | | **whitelists.list** | /whitelists/list |
155 |
156 |
157 |
158 | ## Additional Libraries
159 |
160 | Mailchimp Transactional libraries are available in the following languages:
161 |
162 |
176 |
--------------------------------------------------------------------------------
/git_push.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 | # ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/
3 | #
4 | # Usage example: /bin/sh ./git_push.sh wing328 swagger-petstore-perl "minor update"
5 |
6 | git_user_id=$1
7 | git_repo_id=$2
8 | release_note=$3
9 |
10 | if [ "$git_user_id" = "" ]; then
11 | git_user_id="GIT_USER_ID"
12 | echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id"
13 | fi
14 |
15 | if [ "$git_repo_id" = "" ]; then
16 | git_repo_id="GIT_REPO_ID"
17 | echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id"
18 | fi
19 |
20 | if [ "$release_note" = "" ]; then
21 | release_note="Minor update"
22 | echo "[INFO] No command line input provided. Set \$release_note to $release_note"
23 | fi
24 |
25 | # Initialize the local directory as a Git repository
26 | git init
27 |
28 | # Adds the files in the local repository and stages them for commit.
29 | git add .
30 |
31 | # Commits the tracked changes and prepares them to be pushed to a remote repository.
32 | git commit -m "$release_note"
33 |
34 | # Sets the new remote
35 | git_remote=`git remote`
36 | if [ "$git_remote" = "" ]; then # git remote not defined
37 |
38 | if [ "$GIT_TOKEN" = "" ]; then
39 | echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the Git credential in your environment."
40 | git remote add origin https://github.com/${git_user_id}/${git_repo_id}.git
41 | else
42 | git remote add origin https://${git_user_id}:${GIT_TOKEN}@github.com/${git_user_id}/${git_repo_id}.git
43 | fi
44 |
45 | fi
46 |
47 | git pull origin master
48 |
49 | # Pushes (Forces) the changes in the local repository up to the remote repository
50 | echo "Git pushing to https://github.com/${git_user_id}/${git_repo_id}.git"
51 | git push origin master 2>&1 | grep -v 'To https'
52 |
53 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@mailchimp/mailchimp_transactional",
3 | "version": "1.0.59",
4 | "description": "The official Node client library for the Mailchimp Transactional API",
5 | "license": "Apache 2.0",
6 | "main": "src/index.js",
7 | "browser": {
8 | "fs": false
9 | },
10 | "dependencies": {
11 | "axios": "^1.6.7"
12 | },
13 | "homepage": "https://github.com/mailchimp/mailchimp-transactional-node",
14 | "repository": {
15 | "type": "git",
16 | "url": "git+https://github.com/mailchimp/mailchimp-transactional-node.git"
17 | },
18 | "bugs": {
19 | "url": "https://github.com/mailchimp/mailchimp-client-lib-codegen/issues"
20 | },
21 | "keywords": [
22 | "mailchimp",
23 | "api",
24 | "v3",
25 | "transactional"
26 | ],
27 | "engines": {
28 | "node": ">=10.0.0"
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/ApiClient.js:
--------------------------------------------------------------------------------
1 | /*
2 | * Mailchimp Transactional API
3 | * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
4 | *
5 | * OpenAPI spec version: 1.0.59
6 | * Contact: apihelp@mailchimp.com
7 | *
8 | * NOTE: This class is auto generated by the swagger code generator program.
9 | * https://github.com/swagger-api/swagger-codegen.git
10 | *
11 | * Swagger Codegen version: 2.4.12
12 | *
13 | * Do not edit the class manually.
14 | *
15 | */
16 |
17 | var axios = require('axios');
18 |
19 | axios.defaults.timeout = 300000; // 300s
20 |
21 | var Allowlists = require('./api/AllowlistsApi');
22 | var Exports = require('./api/ExportsApi');
23 | var Inbound = require('./api/InboundApi');
24 | var Ips = require('./api/IpsApi');
25 | var Messages = require('./api/MessagesApi');
26 | var Metadata = require('./api/MetadataApi');
27 | var Rejects = require('./api/RejectsApi');
28 | var Senders = require('./api/SendersApi');
29 | var Subaccounts = require('./api/SubaccountsApi');
30 | var Tags = require('./api/TagsApi');
31 | var Templates = require('./api/TemplatesApi');
32 | var Urls = require('./api/UrlsApi');
33 | var Users = require('./api/UsersApi');
34 | var Webhooks = require('./api/WebhooksApi');
35 | var Whitelists = require('./api/WhitelistsApi');
36 |
37 | var exports = function (apiKey = '') {
38 | this.basePath = 'https://mandrillapp.com/api/1.0';
39 | this.apiKey = apiKey;
40 | this.defaultOutputFormat = '';
41 |
42 | this.formatList = ['json', 'xml', 'php', 'yaml'];
43 | this.contentTypes = ['application/json'];
44 | this.accepts = [
45 | 'application/json',
46 | 'application/x-php',
47 | 'application/x-yaml; charset=utf-8'
48 | ];
49 |
50 | // API Routes
51 | this.allowlists = new Allowlists(this);
52 | this.exports = new Exports(this);
53 | this.inbound = new Inbound(this);
54 | this.ips = new Ips(this);
55 | this.messages = new Messages(this);
56 | this.metadata = new Metadata(this);
57 | this.rejects = new Rejects(this);
58 | this.senders = new Senders(this);
59 | this.subaccounts = new Subaccounts(this);
60 | this.tags = new Tags(this);
61 | this.templates = new Templates(this);
62 | this.urls = new Urls(this);
63 | this.users = new Users(this);
64 | this.webhooks = new Webhooks(this);
65 | this.whitelists = new Whitelists(this);
66 | };
67 |
68 | // HTTP POST request helper
69 | exports.prototype.post = function post(path, body = {}) {
70 | var _this = this;
71 | var url = _this.basePath + path;
72 |
73 | // apply API key to the request
74 | body.key = _this.apiKey;
75 |
76 | // apply response format modifier
77 | var formatList = _this.formatList;
78 | var useDefaultOutputFormat = true;
79 |
80 | if (typeof body.outputFormat === 'string') {
81 | var format = body.outputFormat.toLowerCase();
82 | if (formatList.indexOf(format) !== -1) {
83 | url = url + '.' + format;
84 | delete body.outputFormat;
85 | useDefaultOutputFormat = false;
86 | }
87 | }
88 |
89 | // or use the default response format
90 | var defaultOutputFormat = _this.defaultOutputFormat;
91 | if (useDefaultOutputFormat && formatList.indexOf(defaultOutputFormat) !== -1) {
92 | url = url + '.' + defaultOutputFormat;
93 | }
94 |
95 | return axios
96 | .post(url, body)
97 | .then(function (response) {
98 | return response.data;
99 | })
100 | .catch(function (error) {
101 | return error;
102 | })
103 | };
104 |
105 | // Updates the default HTTP request response format (json, xml, php, yaml)
106 | exports.prototype.setDefaultOutputFormat = function (outputFormat) {
107 | var _this = this;
108 | if (_this.formatList.indexOf(outputFormat) !== -1) {
109 | _this.defaultOutputFormat = outputFormat;
110 | }
111 | };
112 |
113 | exports.prototype.setDefaultTimeoutMs = function (timeoutMs) {
114 | axios.defaults.timeout = timeoutMs;
115 | }
116 |
117 | // The default API client implementation.
118 | exports.instance = function (apiKey) {
119 | return new exports(apiKey);
120 | };
121 |
122 | module.exports = exports;
123 |
--------------------------------------------------------------------------------
/src/api/AllowlistsApi.js:
--------------------------------------------------------------------------------
1 | var ApiClient = require('../ApiClient');
2 |
3 | module.exports = function (apiClient) {
4 | this.apiClient = apiClient || ApiClient.instance();
5 |
6 | /**
7 | * Add email to allowlist
8 | * Adds an email to your email rejection allowlist. If the address is currently on your denylist, that denylist entry will be removed automatically.
9 | */
10 | this.add = function (body) {
11 | return this.apiClient.post('/allowlists/add', body);
12 | };
13 |
14 | /**
15 | * Remove email from allowlist
16 | * Removes an email address from the allowlist.
17 | */
18 | this.delete = function (body) {
19 | return this.apiClient.post('/allowlists/delete', body);
20 | };
21 |
22 | /**
23 | * List allowlisted emails
24 | * Retrieves your email rejection allowlist. You can provide an email address or search prefix to limit the results. Returns up to 1000 results.
25 | */
26 | this.list = function (body) {
27 | return this.apiClient.post('/allowlists/list', body);
28 | };
29 |
30 | };
31 |
--------------------------------------------------------------------------------
/src/api/ExportsApi.js:
--------------------------------------------------------------------------------
1 | var ApiClient = require('../ApiClient');
2 |
3 | module.exports = function (apiClient) {
4 | this.apiClient = apiClient || ApiClient.instance();
5 |
6 | /**
7 | * Export activity history
8 | * Begins an export of your activity history. The activity will be exported to a zip archive containing a single file named activity.csv in the same format as you would be able to export from your account's activity view. It includes the following fields: Date, Email Address, Sender, Subject, Status, Tags, Opens, Clicks, Bounce Detail. If you have configured any custom metadata fields, they will be included in the exported data.
9 | */
10 | this.activity = function (body) {
11 | return this.apiClient.post('/exports/activity', body);
12 | };
13 |
14 | /**
15 | * Export Allowlist
16 | * Begins an export of your rejection allowlist. The allowlist will be exported to a zip archive containing a single file named allowlist.csv that includes the following fields: email, detail, created_at.
17 | */
18 | this.allowlist = function (body) {
19 | return this.apiClient.post('/exports/allowlist', body);
20 | };
21 |
22 | /**
23 | * View export info
24 | * Returns information about an export job. If the export job's state is 'complete', the returned data will include a URL you can use to fetch the results. Every export job produces a zip archive, but the format of the archive is distinct for each job type. The api calls that initiate exports include more details about the output format for that job type.
25 | */
26 | this.info = function (body) {
27 | return this.apiClient.post('/exports/info', body);
28 | };
29 |
30 | /**
31 | * List exports
32 | * Returns a list of your exports.
33 | */
34 | this.list = function (body) {
35 | return this.apiClient.post('/exports/list', body);
36 | };
37 |
38 | /**
39 | * Export denylist
40 | * Begins an export of your rejection denylist. The denylist will be exported to a zip archive containing a single file named rejects.csv that includes the following fields: email, reason, detail, created_at, expires_at, last_event_at, expires_at.
41 | */
42 | this.rejects = function (body) {
43 | return this.apiClient.post('/exports/rejects', body);
44 | };
45 |
46 | /**
47 | * Export Allowlist
48 | * Begins an export of your rejection allowlist. The allowlist will be exported to a zip archive containing a single file named allowlist.csv that includes the following fields: email, detail, created_at.
49 | */
50 | this.whitelist = function (body) {
51 | return this.apiClient.post('/exports/whitelist', body);
52 | };
53 |
54 | };
55 |
--------------------------------------------------------------------------------
/src/api/InboundApi.js:
--------------------------------------------------------------------------------
1 | var ApiClient = require('../ApiClient');
2 |
3 | module.exports = function (apiClient) {
4 | this.apiClient = apiClient || ApiClient.instance();
5 |
6 | /**
7 | * Add inbound domain
8 | * Add an inbound domain to your account.
9 | */
10 | this.addDomain = function (body) {
11 | return this.apiClient.post('/inbound/add-domain', body);
12 | };
13 |
14 | /**
15 | * Add mailbox route
16 | * Add a new mailbox route to an inbound domain.
17 | */
18 | this.addRoute = function (body) {
19 | return this.apiClient.post('/inbound/add-route', body);
20 | };
21 |
22 | /**
23 | * Check domain settings
24 | * Check the MX settings for an inbound domain. The domain must have already been added with the add-domain call.
25 | */
26 | this.checkDomain = function (body) {
27 | return this.apiClient.post('/inbound/check-domain', body);
28 | };
29 |
30 | /**
31 | * Delete inbound domain
32 | * Delete an inbound domain from the account. All mail will stop routing for this domain immediately.
33 | */
34 | this.deleteDomain = function (body) {
35 | return this.apiClient.post('/inbound/delete-domain', body);
36 | };
37 |
38 | /**
39 | * Delete mailbox route
40 | * Delete an existing inbound mailbox route.
41 | */
42 | this.deleteRoute = function (body) {
43 | return this.apiClient.post('/inbound/delete-route', body);
44 | };
45 |
46 | /**
47 | * List inbound domains
48 | * List the domains that have been configured for inbound delivery.
49 | */
50 | this.domains = function (body) {
51 | return this.apiClient.post('/inbound/domains', body);
52 | };
53 |
54 | /**
55 | * List mailbox routes
56 | * List the mailbox routes defined for an inbound domain.
57 | */
58 | this.routes = function (body) {
59 | return this.apiClient.post('/inbound/routes', body);
60 | };
61 |
62 | /**
63 | * Send mime document
64 | * Take a raw MIME document destined for a domain with inbound domains set up, and send it to the inbound hook exactly as if it had been sent over SMTP.
65 | */
66 | this.sendRaw = function (body) {
67 | return this.apiClient.post('/inbound/send-raw', body);
68 | };
69 |
70 | /**
71 | * Update mailbox route
72 | * Update the pattern or webhook of an existing inbound mailbox route. If null is provided for any fields, the values will remain unchanged.
73 | */
74 | this.updateRoute = function (body) {
75 | return this.apiClient.post('/inbound/update-route', body);
76 | };
77 |
78 | };
79 |
--------------------------------------------------------------------------------
/src/api/IpsApi.js:
--------------------------------------------------------------------------------
1 | var ApiClient = require('../ApiClient');
2 |
3 | module.exports = function (apiClient) {
4 | this.apiClient = apiClient || ApiClient.instance();
5 |
6 | /**
7 | * Cancel ip warmup
8 | * Cancels the warmup process for a dedicated IP.
9 | */
10 | this.cancelWarmup = function (body) {
11 | return this.apiClient.post('/ips/cancel-warmup', body);
12 | };
13 |
14 | /**
15 | * Test custom dns
16 | * Tests whether a domain name is valid for use as the custom reverse DNS for a dedicated IP.
17 | */
18 | this.checkCustomDns = function (body) {
19 | return this.apiClient.post('/ips/check-custom-dns', body);
20 | };
21 |
22 | /**
23 | * Add ip pool
24 | * Creates a pool and returns it. If a pool already exists with this name, no action will be performed.
25 | */
26 | this.createPool = function (body) {
27 | return this.apiClient.post('/ips/create-pool', body);
28 | };
29 |
30 | /**
31 | * Delete ip address
32 | * Deletes a dedicated IP. This is permanent and cannot be undone.
33 | */
34 | this.delete = function (body) {
35 | return this.apiClient.post('/ips/delete', body);
36 | };
37 |
38 | /**
39 | * Delete ip pool
40 | * Deletes a pool. A pool must be empty before you can delete it, and you cannot delete your default pool.
41 | */
42 | this.deletePool = function (body) {
43 | return this.apiClient.post('/ips/delete-pool', body);
44 | };
45 |
46 | /**
47 | * Get ip info
48 | * Retrieves information about a single dedicated IP.
49 | */
50 | this.info = function (body) {
51 | return this.apiClient.post('/ips/info', body);
52 | };
53 |
54 | /**
55 | * List ip addresses
56 | * Lists your dedicated IPs.
57 | */
58 | this.list = function (body) {
59 | return this.apiClient.post('/ips/list', body);
60 | };
61 |
62 | /**
63 | * List ip pools
64 | * Lists your dedicated IP pools.
65 | */
66 | this.listPools = function (body) {
67 | return this.apiClient.post('/ips/list-pools', body);
68 | };
69 |
70 | /**
71 | * Get ip pool info
72 | * Describes a single dedicated IP pool.
73 | */
74 | this.poolInfo = function (body) {
75 | return this.apiClient.post('/ips/pool-info', body);
76 | };
77 |
78 | /**
79 | * Request additional ip
80 | * Requests an additional dedicated IP for your account. Accounts may have one outstanding request at any time, and provisioning requests are processed within 24 hours.
81 | */
82 | this.provision = function (body) {
83 | return this.apiClient.post('/ips/provision', body);
84 | };
85 |
86 | /**
87 | * Set custom dns
88 | * Configures the custom DNS name for a dedicated IP.
89 | */
90 | this.setCustomDns = function (body) {
91 | return this.apiClient.post('/ips/set-custom-dns', body);
92 | };
93 |
94 | /**
95 | * Move ip to different pool
96 | * Moves a dedicated IP to a different pool.
97 | */
98 | this.setPool = function (body) {
99 | return this.apiClient.post('/ips/set-pool', body);
100 | };
101 |
102 | /**
103 | * Start ip warmup
104 | * Begins the warmup process for a dedicated IP. During the warmup process, the Transactional API will gradually increase the percentage of your mail that is sent over the warming-up IP, over a period of roughly 30 days. The rest of your mail will be sent over shared IPs or other dedicated IPs in the same pool.
105 | */
106 | this.startWarmup = function (body) {
107 | return this.apiClient.post('/ips/start-warmup', body);
108 | };
109 |
110 | };
111 |
--------------------------------------------------------------------------------
/src/api/MessagesApi.js:
--------------------------------------------------------------------------------
1 | var ApiClient = require('../ApiClient');
2 |
3 | module.exports = function (apiClient) {
4 | this.apiClient = apiClient || ApiClient.instance();
5 |
6 | /**
7 | * Cancel scheduled email
8 | * Cancels a scheduled email.
9 | */
10 | this.cancelScheduled = function (body) {
11 | return this.apiClient.post('/messages/cancel-scheduled', body);
12 | };
13 |
14 | /**
15 | * Get message content
16 | * Get the full content of a recently sent message.
17 | */
18 | this.content = function (body) {
19 | return this.apiClient.post('/messages/content', body);
20 | };
21 |
22 | /**
23 | * Get message info
24 | * Get the information for a single recently sent message.
25 | */
26 | this.info = function (body) {
27 | return this.apiClient.post('/messages/info', body);
28 | };
29 |
30 | /**
31 | * List scheduled emails
32 | * Queries your scheduled emails.
33 | */
34 | this.listScheduled = function (body) {
35 | return this.apiClient.post('/messages/list-scheduled', body);
36 | };
37 |
38 | /**
39 | * Parse mime document
40 | * Parse the full MIME document for an email message, returning the content of the message broken into its constituent pieces.
41 | */
42 | this.parse = function (body) {
43 | return this.apiClient.post('/messages/parse', body);
44 | };
45 |
46 | /**
47 | * Reschedule email
48 | * Reschedules a scheduled email.
49 | */
50 | this.reschedule = function (body) {
51 | return this.apiClient.post('/messages/reschedule', body);
52 | };
53 |
54 | /**
55 | * Search messages by date
56 | * Search recently sent messages and optionally narrow by date range, tags, senders, and API keys. If no date range is specified, results within the last 7 days are returned. This method may be called up to 20 times per minute. If you need the data more often, you can use /messages/info.json to get the information for a single message, or webhooks to push activity to your own application for querying.
57 | */
58 | this.search = function (body) {
59 | return this.apiClient.post('/messages/search', body);
60 | };
61 |
62 | /**
63 | * Search messages by hour
64 | * Search the content of recently sent messages and return the aggregated hourly stats for matching messages.
65 | */
66 | this.searchTimeSeries = function (body) {
67 | return this.apiClient.post('/messages/search-time-series', body);
68 | };
69 |
70 | /**
71 | * Send new message
72 | * Send a new transactional message through the Transactional API.
73 | */
74 | this.send = function (body) {
75 | return this.apiClient.post('/messages/send', body);
76 | };
77 |
78 | /**
79 | * Send mime document
80 | * Take a raw MIME document for a message, and send it exactly as if it were sent through the Transactional API's SMTP servers.
81 | */
82 | this.sendRaw = function (body) {
83 | return this.apiClient.post('/messages/send-raw', body);
84 | };
85 |
86 | /**
87 | * Send using message template
88 | * Send a new transactional message through the Transactional API using a template.
89 | */
90 | this.sendTemplate = function (body) {
91 | return this.apiClient.post('/messages/send-template', body);
92 | };
93 |
94 | };
95 |
--------------------------------------------------------------------------------
/src/api/MetadataApi.js:
--------------------------------------------------------------------------------
1 | var ApiClient = require('../ApiClient');
2 |
3 | module.exports = function (apiClient) {
4 | this.apiClient = apiClient || ApiClient.instance();
5 |
6 | /**
7 | * Add metadata field
8 | * Add a new custom metadata field to be indexed for the account.
9 | */
10 | this.add = function (body) {
11 | return this.apiClient.post('/metadata/add', body);
12 | };
13 |
14 | /**
15 | * Delete metadata field
16 | * Delete an existing custom metadata field. Deletion isn't instataneous, and /metadata/list will continue to return the field until the asynchronous deletion process is complete.
17 | */
18 | this.delete = function (body) {
19 | return this.apiClient.post('/metadata/delete', body);
20 | };
21 |
22 | /**
23 | * List metadata fields
24 | * Get the list of custom metadata fields indexed for the account.
25 | */
26 | this.list = function (body) {
27 | return this.apiClient.post('/metadata/list', body);
28 | };
29 |
30 | /**
31 | * Update metadata field
32 | * Update an existing custom metadata field.
33 | */
34 | this.update = function (body) {
35 | return this.apiClient.post('/metadata/update', body);
36 | };
37 |
38 | };
39 |
--------------------------------------------------------------------------------
/src/api/RejectsApi.js:
--------------------------------------------------------------------------------
1 | var ApiClient = require('../ApiClient');
2 |
3 | module.exports = function (apiClient) {
4 | this.apiClient = apiClient || ApiClient.instance();
5 |
6 | /**
7 | * Add email to denylist
8 | * Adds an email to your email rejection denylist. Addresses that you add manually will never expire and there is no reputation penalty for removing them from your denylist. Attempting to denylist an address that has been added to the allowlist will have no effect.
9 | */
10 | this.add = function (body) {
11 | return this.apiClient.post('/rejects/add', body);
12 | };
13 |
14 | /**
15 | * Delete email from denylist
16 | * Deletes an email rejection. There is no limit to how many rejections you can remove from your denylist, but keep in mind that each deletion has an affect on your reputation.
17 | */
18 | this.delete = function (body) {
19 | return this.apiClient.post('/rejects/delete', body);
20 | };
21 |
22 | /**
23 | * List denylisted emails
24 | * Retrieves your email rejection denylist. You can provide an email address to limit the results. Returns up to 1000 results. By default, entries that have expired are excluded from the results; set include_expired to true to include them.
25 | */
26 | this.list = function (body) {
27 | return this.apiClient.post('/rejects/list', body);
28 | };
29 |
30 | };
31 |
--------------------------------------------------------------------------------
/src/api/SendersApi.js:
--------------------------------------------------------------------------------
1 | var ApiClient = require('../ApiClient');
2 |
3 | module.exports = function (apiClient) {
4 | this.apiClient = apiClient || ApiClient.instance();
5 |
6 | /**
7 | * Add sender domain
8 | * Adds a sender domain to your account. Sender domains are added automatically as you send, but you can use this call to add them ahead of time.
9 | */
10 | this.addDomain = function (body) {
11 | return this.apiClient.post('/senders/add-domain', body);
12 | };
13 |
14 | /**
15 | * Check domain settings
16 | * Checks the SPF and DKIM settings for a domain, as well the domain verification. If you haven't already added this domain to your account, it will be added automatically.
17 | */
18 | this.checkDomain = function (body) {
19 | return this.apiClient.post('/senders/check-domain', body);
20 | };
21 |
22 | /**
23 | * List sender domains
24 | * Returns the sender domains that have been added to this account.
25 | */
26 | this.domains = function (body) {
27 | return this.apiClient.post('/senders/domains', body);
28 | };
29 |
30 | /**
31 | * Get sender info
32 | * Return more detailed information about a single sender, including aggregates of recent stats.
33 | */
34 | this.info = function (body) {
35 | return this.apiClient.post('/senders/info', body);
36 | };
37 |
38 | /**
39 | * List account senders
40 | * Return the senders that have tried to use this account.
41 | */
42 | this.list = function (body) {
43 | return this.apiClient.post('/senders/list', body);
44 | };
45 |
46 | /**
47 | * View sender history
48 | * Return the recent history (hourly stats for the last 30 days) for a sender.
49 | */
50 | this.timeSeries = function (body) {
51 | return this.apiClient.post('/senders/time-series', body);
52 | };
53 |
54 | /**
55 | * Verify domain
56 | * Sends a verification email in order to verify ownership of a domain. Domain verification is a required step to confirm ownership of a domain. Once a domain has been verified in a Transactional API account, other accounts may not have their messages signed by that domain unless they also verify the domain. This prevents other Transactional API accounts from sending mail signed by your domain.
57 | */
58 | this.verifyDomain = function (body) {
59 | return this.apiClient.post('/senders/verify-domain', body);
60 | };
61 |
62 | };
63 |
--------------------------------------------------------------------------------
/src/api/SubaccountsApi.js:
--------------------------------------------------------------------------------
1 | var ApiClient = require('../ApiClient');
2 |
3 | module.exports = function (apiClient) {
4 | this.apiClient = apiClient || ApiClient.instance();
5 |
6 | /**
7 | * Add subaccount
8 | * Add a new subaccount.
9 | */
10 | this.add = function (body) {
11 | return this.apiClient.post('/subaccounts/add', body);
12 | };
13 |
14 | /**
15 | * Delete subaccount
16 | * 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.
17 | */
18 | this.delete = function (body) {
19 | return this.apiClient.post('/subaccounts/delete', body);
20 | };
21 |
22 | /**
23 | * Get subaccount info
24 | * Given the ID of an existing subaccount, return the data about it.
25 | */
26 | this.info = function (body) {
27 | return this.apiClient.post('/subaccounts/info', body);
28 | };
29 |
30 | /**
31 | * List subaccounts
32 | * Get the list of subaccounts defined for the account, optionally filtered by a prefix.
33 | */
34 | this.list = function (body) {
35 | return this.apiClient.post('/subaccounts/list', body);
36 | };
37 |
38 | /**
39 | * Pause subaccount
40 | * 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.
41 | */
42 | this.pause = function (body) {
43 | return this.apiClient.post('/subaccounts/pause', body);
44 | };
45 |
46 | /**
47 | * Resume subaccount
48 | * Resume a paused subaccount's sending.
49 | */
50 | this.resume = function (body) {
51 | return this.apiClient.post('/subaccounts/resume', body);
52 | };
53 |
54 | /**
55 | * Update subaccount
56 | * Update an existing subaccount.
57 | */
58 | this.update = function (body) {
59 | return this.apiClient.post('/subaccounts/update', body);
60 | };
61 |
62 | };
63 |
--------------------------------------------------------------------------------
/src/api/TagsApi.js:
--------------------------------------------------------------------------------
1 | var ApiClient = require('../ApiClient');
2 |
3 | module.exports = function (apiClient) {
4 | this.apiClient = apiClient || ApiClient.instance();
5 |
6 | /**
7 | * View all tags history
8 | * Return the recent history (hourly stats for the last 30 days) for all tags.
9 | */
10 | this.allTimeSeries = function (body) {
11 | return this.apiClient.post('/tags/all-time-series', body);
12 | };
13 |
14 | /**
15 | * Delete tag
16 | * Deletes a tag permanently. Deleting a tag removes the tag from any messages that have been sent, and also deletes the tag's stats. There is no way to undo this operation, so use it carefully.
17 | */
18 | this.delete = function (body) {
19 | return this.apiClient.post('/tags/delete', body);
20 | };
21 |
22 | /**
23 | * Get tag info
24 | * Return more detailed information about a single tag, including aggregates of recent stats.
25 | */
26 | this.info = function (body) {
27 | return this.apiClient.post('/tags/info', body);
28 | };
29 |
30 | /**
31 | * List tags
32 | * Return all of the user-defined tag information.
33 | */
34 | this.list = function (body) {
35 | return this.apiClient.post('/tags/list', body);
36 | };
37 |
38 | /**
39 | * View tag history
40 | * Return the recent history (hourly stats for the last 30 days) for a tag.
41 | */
42 | this.timeSeries = function (body) {
43 | return this.apiClient.post('/tags/time-series', body);
44 | };
45 |
46 | };
47 |
--------------------------------------------------------------------------------
/src/api/TemplatesApi.js:
--------------------------------------------------------------------------------
1 | var ApiClient = require('../ApiClient');
2 |
3 | module.exports = function (apiClient) {
4 | this.apiClient = apiClient || ApiClient.instance();
5 |
6 | /**
7 | * Add template
8 | * Add a new template.
9 | */
10 | this.add = function (body) {
11 | return this.apiClient.post('/templates/add', body);
12 | };
13 |
14 | /**
15 | * Delete template
16 | * Delete a template.
17 | */
18 | this.delete = function (body) {
19 | return this.apiClient.post('/templates/delete', body);
20 | };
21 |
22 | /**
23 | * Get template info
24 | * Get the information for an existing template.
25 | */
26 | this.info = function (body) {
27 | return this.apiClient.post('/templates/info', body);
28 | };
29 |
30 | /**
31 | * List templates
32 | * Return a list of all the templates available to this user.
33 | */
34 | this.list = function (body) {
35 | return this.apiClient.post('/templates/list', body);
36 | };
37 |
38 | /**
39 | * Publish template content
40 | * Publish the content for the template. Any new messages sent using this template will start using the content that was previously in draft.
41 | */
42 | this.publish = function (body) {
43 | return this.apiClient.post('/templates/publish', body);
44 | };
45 |
46 | /**
47 | * Render html template
48 | * Inject content and optionally merge fields into a template, returning the HTML that results.
49 | */
50 | this.render = function (body) {
51 | return this.apiClient.post('/templates/render', body);
52 | };
53 |
54 | /**
55 | * Get template history
56 | * Return the recent history (hourly stats for the last 30 days) for a template.
57 | */
58 | this.timeSeries = function (body) {
59 | return this.apiClient.post('/templates/time-series', body);
60 | };
61 |
62 | /**
63 | * Update template
64 | * Update the code for an existing template. If null is provided for any fields, the values will remain unchanged.
65 | */
66 | this.update = function (body) {
67 | return this.apiClient.post('/templates/update', body);
68 | };
69 |
70 | };
71 |
--------------------------------------------------------------------------------
/src/api/UrlsApi.js:
--------------------------------------------------------------------------------
1 | var ApiClient = require('../ApiClient');
2 |
3 | module.exports = function (apiClient) {
4 | this.apiClient = apiClient || ApiClient.instance();
5 |
6 | /**
7 | * Add tracking domains
8 | * Add a tracking domain to your account.
9 | */
10 | this.addTrackingDomain = function (body) {
11 | return this.apiClient.post('/urls/add-tracking-domain', body);
12 | };
13 |
14 | /**
15 | * Check cname settings
16 | * Checks the CNAME settings for a tracking domain. The domain must have been added already with the add-tracking-domain call.
17 | */
18 | this.checkTrackingDomain = function (body) {
19 | return this.apiClient.post('/urls/check-tracking-domain', body);
20 | };
21 |
22 | /**
23 | * List most clicked urls
24 | * Get the 100 most clicked URLs.
25 | */
26 | this.list = function (body) {
27 | return this.apiClient.post('/urls/list', body);
28 | };
29 |
30 | /**
31 | * Search most clicked urls
32 | * Return the 100 most clicked URLs that match the search query given.
33 | */
34 | this.search = function (body) {
35 | return this.apiClient.post('/urls/search', body);
36 | };
37 |
38 | /**
39 | * Get url history
40 | * Return the recent history (hourly stats for the last 30 days) for a URL
41 | */
42 | this.timeSeries = function (body) {
43 | return this.apiClient.post('/urls/time-series', body);
44 | };
45 |
46 | /**
47 | * List tracking domains
48 | * Get the list of tracking domains set up for this account.
49 | */
50 | this.trackingDomains = function (body) {
51 | return this.apiClient.post('/urls/tracking-domains', body);
52 | };
53 |
54 | };
55 |
--------------------------------------------------------------------------------
/src/api/UsersApi.js:
--------------------------------------------------------------------------------
1 | var ApiClient = require('../ApiClient');
2 |
3 | module.exports = function (apiClient) {
4 | this.apiClient = apiClient || ApiClient.instance();
5 |
6 | /**
7 | * Get user info
8 | * Return the information about the API-connected user.
9 | */
10 | this.info = function (body) {
11 | return this.apiClient.post('/users/info', body);
12 | };
13 |
14 | /**
15 | * Ping
16 | * Validate an API key and respond to a ping.
17 | */
18 | this.ping = function (body) {
19 | return this.apiClient.post('/users/ping', body);
20 | };
21 |
22 | /**
23 | * Ping 2
24 | * Validate an API key and respond to a ping (JSON parser version).
25 | */
26 | this.ping2 = function (body) {
27 | return this.apiClient.post('/users/ping2', body);
28 | };
29 |
30 | /**
31 | * List account senders
32 | * Return the senders that have tried to use this account, both verified and unverified.
33 | */
34 | this.senders = function (body) {
35 | return this.apiClient.post('/users/senders', body);
36 | };
37 |
38 | };
39 |
--------------------------------------------------------------------------------
/src/api/WebhooksApi.js:
--------------------------------------------------------------------------------
1 | var ApiClient = require('../ApiClient');
2 |
3 | module.exports = function (apiClient) {
4 | this.apiClient = apiClient || ApiClient.instance();
5 |
6 | /**
7 | * Add webhook
8 | * Add a new webhook.
9 | */
10 | this.add = function (body) {
11 | return this.apiClient.post('/webhooks/add', body);
12 | };
13 |
14 | /**
15 | * Delete webhook
16 | * Delete an existing webhook.
17 | */
18 | this.delete = function (body) {
19 | return this.apiClient.post('/webhooks/delete', body);
20 | };
21 |
22 | /**
23 | * Get webhook info
24 | * Given the ID of an existing webhook, return the data about it.
25 | */
26 | this.info = function (body) {
27 | return this.apiClient.post('/webhooks/info', body);
28 | };
29 |
30 | /**
31 | * List webhooks
32 | * Get the list of all webhooks defined on the account.
33 | */
34 | this.list = function (body) {
35 | return this.apiClient.post('/webhooks/list', body);
36 | };
37 |
38 | /**
39 | * Update webhook
40 | * Update an existing webhook.
41 | */
42 | this.update = function (body) {
43 | return this.apiClient.post('/webhooks/update', body);
44 | };
45 |
46 | };
47 |
--------------------------------------------------------------------------------
/src/api/WhitelistsApi.js:
--------------------------------------------------------------------------------
1 | var ApiClient = require('../ApiClient');
2 |
3 | module.exports = function (apiClient) {
4 | this.apiClient = apiClient || ApiClient.instance();
5 |
6 | /**
7 | * Add email to allowlist
8 | * Adds an email to your email rejection allowlist. If the address is currently on your denylist, that denylist entry will be removed automatically.
9 | */
10 | this.add = function (body) {
11 | return this.apiClient.post('/whitelists/add', body);
12 | };
13 |
14 | /**
15 | * Remove email from allowlist
16 | * Removes an email address from the allowlist.
17 | */
18 | this.delete = function (body) {
19 | return this.apiClient.post('/whitelists/delete', body);
20 | };
21 |
22 | /**
23 | * List allowlisted emails
24 | * Retrieves your email rejection allowlist. You can provide an email address or search prefix to limit the results. Returns up to 1000 results.
25 | */
26 | this.list = function (body) {
27 | return this.apiClient.post('/whitelists/list', body);
28 | };
29 |
30 | };
31 |
--------------------------------------------------------------------------------
/src/index.js:
--------------------------------------------------------------------------------
1 | var ApiClient = require('./ApiClient');
2 |
3 | module.exports = function(apiKey) {
4 | return ApiClient.instance(apiKey);
5 | };
6 |
--------------------------------------------------------------------------------