mailgun.js 3.5.8 → 3.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc +27 -11
- package/CHANGELOG.md +35 -0
- package/README.md +138 -50
- package/commitlint.config.js +1 -2
- package/dist/index.d.ts +1 -1
- package/dist/lib/client.d.ts +1 -1
- package/dist/lib/events.d.ts +9 -25
- package/dist/lib/interfaces/APIErrorOptions.d.ts +2 -1
- package/dist/lib/interfaces/ApiResponse.d.ts +2 -1
- package/dist/lib/interfaces/Events.d.ts +24 -0
- package/dist/lib/interfaces/IpPools.d.ts +12 -0
- package/dist/lib/interfaces/Options.d.ts +2 -1
- package/dist/lib/interfaces/RequestOptions.d.ts +2 -1
- package/dist/lib/interfaces/StatsOptions.d.ts +2 -1
- package/dist/lib/interfaces/mailListMembers.d.ts +6 -6
- package/dist/lib/ip-pools.d.ts +11 -14
- package/dist/lib/ips.d.ts +6 -6
- package/dist/lib/messages.d.ts +1 -1
- package/dist/lib/suppressions.d.ts +1 -1
- package/dist/mailgun.node.js +3 -0
- package/dist/{mailgun.js.LICENSE.txt → mailgun.node.js.LICENSE.txt} +1 -1
- package/dist/mailgun.web.js +3 -0
- package/dist/mailgun.web.js.LICENSE.txt +7 -0
- package/examples/addresses.js +1 -0
- package/examples/list-domains.js +1 -0
- package/examples/send-email.js +1 -0
- package/index.ts +1 -1
- package/lib/client.ts +3 -2
- package/lib/events.ts +21 -19
- package/lib/interfaces/APIErrorOptions.ts +3 -1
- package/lib/interfaces/ApiResponse.ts +3 -1
- package/lib/interfaces/Events.ts +25 -0
- package/lib/interfaces/IFormData.ts +4 -3
- package/lib/interfaces/IpPools.ts +16 -1
- package/lib/interfaces/Ips.ts +1 -0
- package/lib/interfaces/Options.ts +5 -2
- package/lib/interfaces/RequestOptions.ts +4 -2
- package/lib/interfaces/StatsOptions.ts +4 -2
- package/lib/interfaces/Supressions.ts +1 -1
- package/lib/interfaces/lists.ts +1 -0
- package/lib/interfaces/mailListMembers.ts +18 -12
- package/lib/interfaces/routes.ts +1 -0
- package/lib/ip-pools.ts +8 -7
- package/lib/ips.ts +3 -3
- package/lib/lists.ts +1 -1
- package/lib/messages.ts +1 -1
- package/lib/parse.ts +4 -3
- package/lib/stats.ts +3 -2
- package/lib/suppressions.ts +16 -11
- package/lib/validate.ts +0 -1
- package/package.json +10 -10
- package/test/client.test.ts +7 -2
- package/test/events.test.ts +1 -2
- package/test/ips.test.ts +2 -1
- package/test/lists.test.ts +5 -7
- package/test/mailListMembers.test.ts +47 -43
- package/test/messageAttachment.test.ts +3 -4
- package/test/messages.test.ts +1 -1
- package/test/parse.test.ts +2 -2
- package/test/routes.test.ts +1 -0
- package/test/stats.test.ts +1 -1
- package/test/suppressions.test.ts +12 -10
- package/test/validate.test.ts +1 -1
- package/test/webhooks.test.ts +1 -2
- package/tsconfig.webpack.json +1 -1
- package/webpack/webpack.common.config.js +47 -0
- package/webpack/webpack.dev.config.js +18 -0
- package/webpack/webpack.release.config.js +37 -0
- package/dist/mailgun.js +0 -3
- package/webpack.config.js +0 -49
- package/webpack.release.config.js +0 -29
package/.eslintrc
CHANGED
|
@@ -7,20 +7,17 @@
|
|
|
7
7
|
"mocha": true
|
|
8
8
|
},
|
|
9
9
|
"extends": [
|
|
10
|
-
"airbnb-base"
|
|
11
|
-
"plugin:@typescript-eslint/eslint-recommended",
|
|
12
|
-
"plugin:@typescript-eslint/recommended"
|
|
10
|
+
"airbnb-base"
|
|
13
11
|
],
|
|
14
|
-
"plugins": [
|
|
15
|
-
"eslint-plugin-tsdoc",
|
|
16
|
-
"@typescript-eslint"
|
|
17
|
-
],
|
|
18
|
-
"parser": "@typescript-eslint/parser",
|
|
19
12
|
"parserOptions": {
|
|
20
13
|
"ecmaVersion": 12
|
|
21
14
|
},
|
|
22
15
|
"settings": {
|
|
23
|
-
|
|
16
|
+
"import/resolver": {
|
|
17
|
+
"node": {
|
|
18
|
+
"extensions": [".js", ".jsx", ".ts", ".tsx"]
|
|
19
|
+
}
|
|
20
|
+
}
|
|
24
21
|
},
|
|
25
22
|
"ignorePatterns": ["docs/assets/js/*", "dist/**"],
|
|
26
23
|
"rules": {
|
|
@@ -33,6 +30,25 @@
|
|
|
33
30
|
"class-methods-use-this": 0,
|
|
34
31
|
"prefer-destructuring": 0,
|
|
35
32
|
"import/extensions": 0,
|
|
36
|
-
"lines-between-class-members": ["error", "always", { "exceptAfterSingleLine": true }]
|
|
37
|
-
|
|
33
|
+
"lines-between-class-members": ["error", "always", { "exceptAfterSingleLine": true }],
|
|
34
|
+
"import/no-extraneous-dependencies" :["error", {"devDependencies": true, "optionalDependencies": false, "peerDependencies": false}]
|
|
35
|
+
},
|
|
36
|
+
"overrides": [
|
|
37
|
+
{
|
|
38
|
+
"files": ["*.ts", "*.tsx"],
|
|
39
|
+
"extends": [
|
|
40
|
+
"plugin:@typescript-eslint/eslint-recommended",
|
|
41
|
+
"plugin:@typescript-eslint/recommended"
|
|
42
|
+
],
|
|
43
|
+
"parser": "@typescript-eslint/parser",
|
|
44
|
+
"rules": {
|
|
45
|
+
"import/extensions": 0
|
|
46
|
+
// "import/no-extraneous-dependencies" :["error", {"devDependencies": true, "optionalDependencies": false, "peerDependencies": false}]
|
|
47
|
+
},
|
|
48
|
+
"plugins": [
|
|
49
|
+
"eslint-plugin-tsdoc",
|
|
50
|
+
"@typescript-eslint"
|
|
51
|
+
]
|
|
52
|
+
}
|
|
53
|
+
]
|
|
38
54
|
}
|
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,41 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
|
|
4
4
|
|
|
5
|
+
## [3.7.0](https://github.com/mailgun/mailgun-js/compare/v3.6.1...v3.7.0) (2021-10-20)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* Fix linter errors ([126ba03](https://github.com/mailgun/mailgun-js/commits/126ba039bccfbdb257ddde7d17a58790e4cd30a3))
|
|
11
|
+
|
|
12
|
+
### [3.6.1](https://github.com/mailgun/mailgun-js/compare/v3.6.0...v3.6.1) (2021-10-18)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Other changes
|
|
16
|
+
|
|
17
|
+
* Update eslint dependency. Regenerate package-lock file ([0e1fef6](https://github.com/mailgun/mailgun-js/commits/0e1fef683b86e05852a04c6e2f6199db0e39ff22))
|
|
18
|
+
* Update mocha to v9 ([768ed1f](https://github.com/mailgun/mailgun-js/commits/768ed1f5896c2bbb7fff59f4fbb68d425ea5a594))
|
|
19
|
+
|
|
20
|
+
## [3.6.0](https://github.com/mailgun/mailgun-js/compare/v3.5.9...v3.6.0) (2021-10-13)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
### Features
|
|
24
|
+
|
|
25
|
+
* Split the distro for different targets ([1a55085](https://github.com/mailgun/mailgun-js/commits/1a550854765c7cdbb68b13b32c1f1392003abf30))
|
|
26
|
+
* Update commitlint rules ([262ce0c](https://github.com/mailgun/mailgun-js/commits/262ce0ccd594bbcd97c9aa9ba5f11ad6ce6fc8c5))
|
|
27
|
+
|
|
28
|
+
### [3.5.9](https://github.com/mailgun/mailgun-js/compare/v3.5.8...v3.5.9) (2021-09-16)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
### Bug Fixes
|
|
32
|
+
|
|
33
|
+
* Update @commitlint/cli and standard-version dependencies ([fe0233e](https://github.com/mailgun/mailgun-js/commits/fe0233e9afbd546f33b0f1c73930ca9329b5fa38))
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
### Other changes
|
|
37
|
+
|
|
38
|
+
* Add templates examples to readme ([f0bf0b8](https://github.com/mailgun/mailgun-js/commits/f0bf0b8cc66b3e7e5899fa913f2f79582f547a37))
|
|
39
|
+
|
|
5
40
|
### [3.5.8](https://github.com/mailgun/mailgun-js/compare/v3.5.7...v3.5.8) (2021-09-02)
|
|
6
41
|
|
|
7
42
|
|
package/README.md
CHANGED
|
@@ -125,32 +125,53 @@ Method naming conventions:
|
|
|
125
125
|
|
|
126
126
|
`mg.messages.create(domain, data)` - [api docs](https://documentation.mailgun.com/api-sending.html#sending)
|
|
127
127
|
|
|
128
|
-
|
|
128
|
+
Options:
|
|
129
129
|
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
130
|
+
Parameter | Description
|
|
131
|
+
:---------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
|
|
132
|
+
to | Email address of the recipient(s). Example: "Bob <bob@host.com>". You can use commas to separate multiple recipients (e.g.: "test@example.com,test@example.com" or ["test@example.com", "test@example.com"]). Make sure to include all To, Cc and Bcc recipients of the message.
|
|
133
|
+
html | HTML version of the message.
|
|
134
|
+
text | Text version of the message.
|
|
135
|
+
message | MIME string of the message. Make sure to use multipart/form-data to send this as a file upload.
|
|
136
|
+
attachment | File attachment. You can post multiple attachment values. Important: You must use multipart/form-data encoding when sending attachments. Also you can use `{data: file, filename: filename}` to define custom filename.
|
|
137
|
+
o:tag | Tag string. See Tagging for more information.
|
|
138
|
+
o:campaign | Id of the campaign the message belongs to. See um-campaign-analytics for details.
|
|
139
|
+
o:deliverytime | Desired time of delivery. See Date Format. Note: Messages can be scheduled for a maximum of 3 days in the future.
|
|
140
|
+
o:dkim | Enables/disabled DKIM signatures on per-message basis. Pass yes or no
|
|
141
|
+
o:testmode | Enables sending in test mode. Pass yes if needed. See Sending in Test Mode
|
|
142
|
+
o:tracking | Toggles tracking on a per-message basis, see Tracking Messages for details. Pass yes or no.
|
|
143
|
+
o:tracking-clicks | Toggles clicks tracking on a per-message basis. Has higher priority than domain-level setting. Pass yes, no or htmlonly.
|
|
144
|
+
o:tracking-opens | Toggles opens tracking on a per-message basis. Has higher priority than domain-level setting. Pass yes or no.
|
|
145
|
+
h:X-My-Header | h: prefix followed by an arbitrary value allows to append a custom MIME header to the message (X-My-Header in this case). For example, h:Reply-To to specify Reply-To address.
|
|
146
|
+
v:my-var | v: prefix followed by an arbitrary name allows to attach a custom JSON data to the message. See Attaching Data to Messages for more information.
|
|
141
147
|
|
|
142
|
-
MIME Example:
|
|
143
148
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
149
|
+
- HTML/TEXT Example:
|
|
150
|
+
|
|
151
|
+
```js
|
|
152
|
+
mg.messages.create('sandbox-123.mailgun.org', {
|
|
153
|
+
from: "Excited User <mailgun@sandbox-123.mailgun.org>",
|
|
154
|
+
to: ["test@example.com"],
|
|
155
|
+
subject: "Hello",
|
|
156
|
+
text: "Testing some Mailgun awesomness!",
|
|
157
|
+
html: "<h1>Testing some Mailgun awesomness!</h1>"
|
|
158
|
+
})
|
|
159
|
+
.then(msg => console.log(msg)) // logs response data
|
|
160
|
+
.catch(err => console.log(err)); // logs any error
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
- MIME Example:
|
|
164
|
+
|
|
165
|
+
```js
|
|
166
|
+
mg.messages.create('sandbox-123.mailgun.org', {
|
|
167
|
+
from: "Excited User <mailgun@sandbox-123.mailgun.org>",
|
|
168
|
+
to: ["test@example.com"],
|
|
169
|
+
subject: "Hello",
|
|
170
|
+
text: "<mime encoded string here>"
|
|
171
|
+
})
|
|
172
|
+
.then(msg => console.log(msg)) // logs response data
|
|
173
|
+
.catch(err => console.log(err)); // logs any error
|
|
174
|
+
```
|
|
154
175
|
|
|
155
176
|
Messages with attachments:
|
|
156
177
|
|
|
@@ -164,7 +185,7 @@ Messages with attachments:
|
|
|
164
185
|
from: "Excited User <mailgun@sandbox-123.mailgun.org>",
|
|
165
186
|
to: ["test@example.com"],
|
|
166
187
|
subject: "Test subject",
|
|
167
|
-
|
|
188
|
+
text: "Hello here is a file in the attachment"
|
|
168
189
|
}
|
|
169
190
|
|
|
170
191
|
fsPromises.readFile(filepath)
|
|
@@ -191,7 +212,7 @@ Messages with attachments:
|
|
|
191
212
|
from: "Excited User <mailgun@sandbox-123.mailgun.org>",
|
|
192
213
|
to: ["test@example.com"],
|
|
193
214
|
subject: "Test subject",
|
|
194
|
-
|
|
215
|
+
text: "Test message"
|
|
195
216
|
}
|
|
196
217
|
|
|
197
218
|
(async () =>{
|
|
@@ -270,34 +291,101 @@ Messages with attachments:
|
|
|
270
291
|
|
|
271
292
|
const res = await mg.messages.create(DOMAIN, messageParams);
|
|
272
293
|
```
|
|
273
|
-
Promise Returns:
|
|
294
|
+
Promise Returns:
|
|
274
295
|
|
|
275
|
-
```
|
|
276
|
-
{
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
}
|
|
280
|
-
```
|
|
296
|
+
```js
|
|
297
|
+
{
|
|
298
|
+
id: '<20151025002517.117282.79817@sandbox-123.mailgun.org>',
|
|
299
|
+
message: 'Queued. Thank you.'
|
|
300
|
+
}
|
|
301
|
+
```
|
|
302
|
+
#### Templates
|
|
281
303
|
|
|
282
|
-
|
|
304
|
+
Mailgun’s templates uses a fork of the very popular template engine [handlebars](https://handlebarsjs.com/).
|
|
283
305
|
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
306
|
+
To provide values for a substitution you need to use 'h:X-Mailgun-Variables' property in the message description.
|
|
307
|
+
|
|
308
|
+
Make sure that this property is a JSON string like {"title":"A title", "body":"The body"}.
|
|
309
|
+
|
|
310
|
+
You can find few examples of how to use templates below.
|
|
311
|
+
- Providing values for **title** and **slug** variables to render in template
|
|
312
|
+
```js
|
|
313
|
+
...
|
|
314
|
+
const {
|
|
315
|
+
title,
|
|
316
|
+
slug,
|
|
317
|
+
} = someDataSource;
|
|
318
|
+
|
|
319
|
+
const mailgunData = {
|
|
320
|
+
from: 'mailer@example.com>',
|
|
321
|
+
to: 'recipient@example.com',
|
|
322
|
+
subject: `Email ${title}`,
|
|
323
|
+
template: 'name-of-the-template-you-made-in-mailgun-web-portal',
|
|
324
|
+
'h:X-Mailgun-Variables': JSON.stringify({ // be sure to stringify your payload
|
|
325
|
+
title,
|
|
326
|
+
slug,
|
|
327
|
+
}),
|
|
328
|
+
'h:Reply-To': 'reply-to@example.com',
|
|
329
|
+
};
|
|
330
|
+
|
|
331
|
+
try {
|
|
332
|
+
const response = await mailgun.messages.create(DOMAIN_NAME, mailgunData);
|
|
333
|
+
...
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
- Providing an array of objects to render them in the template
|
|
337
|
+
```JS
|
|
338
|
+
...
|
|
339
|
+
const mailgunData = {
|
|
340
|
+
from: 'mailer@example.com>',
|
|
341
|
+
to: 'recipient@example.com',
|
|
342
|
+
subject: `Email ${title}`,
|
|
343
|
+
template: 'name-of-the-another-template-you-made-in-mailgun-web-portal',
|
|
344
|
+
'h:X-Mailgun-Variables': JSON.stringify({
|
|
345
|
+
"arrayItems": [
|
|
346
|
+
{
|
|
347
|
+
"question": "test_question",
|
|
348
|
+
"answer": "test_answer"
|
|
349
|
+
},
|
|
350
|
+
{
|
|
351
|
+
"question": "test_question",
|
|
352
|
+
"answer": "test_answer"
|
|
353
|
+
}
|
|
354
|
+
]})
|
|
355
|
+
};
|
|
356
|
+
try {
|
|
357
|
+
const response = await mailgun.messages.create(DOMAIN_NAME, mailgunData);
|
|
358
|
+
...
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
#### Recipient Variables
|
|
362
|
+
[Docs](https://documentation.mailgun.com/en/latest/user_manual.html#batch-sending)
|
|
363
|
+
|
|
364
|
+
Recipient Variables are custom variables that you define, which you can then reference in the message body. They give you the ability to send a custom message to each recipient while still using a single API Call.
|
|
365
|
+
|
|
366
|
+
```Js
|
|
367
|
+
...
|
|
368
|
+
const mailgunData = {
|
|
369
|
+
from: 'Example.com Mailer <mailer@mailer.example.com>',
|
|
370
|
+
to: ['me@example.com', 'you@example.com'],
|
|
371
|
+
subject: 'Recipient - %recipient.title%',
|
|
372
|
+
html: 'Here\'s %recipient.title% and <a href="%recipient.link%">link</a>',
|
|
373
|
+
'recipient-variables': JSON.stringify({
|
|
374
|
+
'me@example.com': {
|
|
375
|
+
title: 'Me',
|
|
376
|
+
link: 'href-var',
|
|
377
|
+
},
|
|
378
|
+
'you@example.com': {
|
|
379
|
+
title: 'You',
|
|
380
|
+
link: 'slug-recipient-var-c',
|
|
381
|
+
},
|
|
382
|
+
}),
|
|
383
|
+
};
|
|
384
|
+
|
|
385
|
+
try {
|
|
386
|
+
const response = await mailgun.messages.create(DOMAIN_NAME, mailgunData);
|
|
387
|
+
...
|
|
388
|
+
```
|
|
301
389
|
|
|
302
390
|
### domains
|
|
303
391
|
|
package/commitlint.config.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
module.exports = {
|
|
2
2
|
extends: ['@commitlint/config-conventional'],
|
|
3
3
|
rules: {
|
|
4
|
-
'type-enum': [2, 'always', ['
|
|
5
|
-
'type-case': [2, 'always', 'pascal-case'],
|
|
4
|
+
'type-enum': [2, 'always', ['breaking', 'feature', 'fix', 'other']],
|
|
6
5
|
'subject-case': [2, 'always', 'sentence-case']
|
|
7
6
|
},
|
|
8
7
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import Options from './lib/interfaces/Options';
|
|
|
3
3
|
import IFormData from './lib/interfaces/IFormData';
|
|
4
4
|
declare class Mailgun {
|
|
5
5
|
private formData;
|
|
6
|
-
constructor(FormData: new (...args:
|
|
6
|
+
constructor(FormData: new (...args: unknown[]) => IFormData);
|
|
7
7
|
client(options: Options): Client;
|
|
8
8
|
}
|
|
9
9
|
export = Mailgun;
|
package/dist/lib/client.d.ts
CHANGED
|
@@ -28,5 +28,5 @@ export default class Client {
|
|
|
28
28
|
ips: IpsClient;
|
|
29
29
|
ip_pools: IpPoolsClient;
|
|
30
30
|
lists: ListsClient;
|
|
31
|
-
constructor(options: Options, formData: new (...args:
|
|
31
|
+
constructor(options: Options, formData: new (...args: unknown[]) => IFormData);
|
|
32
32
|
}
|
package/dist/lib/events.d.ts
CHANGED
|
@@ -1,29 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
import { EventsList, EventsPage, EventsResponse, PagesList } from './interfaces/Events';
|
|
2
|
+
import Request from './request';
|
|
2
3
|
export default class EventClient {
|
|
3
|
-
request:
|
|
4
|
-
constructor(request:
|
|
4
|
+
request: Request;
|
|
5
|
+
constructor(request: Request);
|
|
5
6
|
_parsePageNumber(url: string): string;
|
|
6
|
-
_parsePage(id: string, url: string):
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
url: string;
|
|
10
|
-
};
|
|
11
|
-
_parsePageLinks(response: {
|
|
12
|
-
body: {
|
|
13
|
-
paging: any;
|
|
14
|
-
};
|
|
15
|
-
}): any;
|
|
16
|
-
_parseEventList(response: {
|
|
17
|
-
body: {
|
|
18
|
-
items: any;
|
|
19
|
-
paging: any;
|
|
20
|
-
};
|
|
21
|
-
}): {
|
|
22
|
-
items: any;
|
|
23
|
-
pages: any;
|
|
24
|
-
};
|
|
7
|
+
_parsePage(id: string, url: string): EventsPage;
|
|
8
|
+
_parsePageLinks(response: EventsResponse): PagesList;
|
|
9
|
+
_parseEventList(response: EventsResponse): EventsList;
|
|
25
10
|
get(domain: string, query: {
|
|
26
|
-
page:
|
|
27
|
-
}):
|
|
11
|
+
page: string;
|
|
12
|
+
}): Promise<EventsList>;
|
|
28
13
|
}
|
|
29
|
-
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export interface EventsPage {
|
|
2
|
+
id: string;
|
|
3
|
+
number: string;
|
|
4
|
+
url: string;
|
|
5
|
+
}
|
|
6
|
+
export interface PagesList {
|
|
7
|
+
previous: string;
|
|
8
|
+
first: string;
|
|
9
|
+
last: string;
|
|
10
|
+
next: string;
|
|
11
|
+
}
|
|
12
|
+
export interface EventsResponse {
|
|
13
|
+
body: {
|
|
14
|
+
items: [];
|
|
15
|
+
paging: PagesList;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export interface EventsList {
|
|
19
|
+
items: [];
|
|
20
|
+
pages: PagesList;
|
|
21
|
+
}
|
|
22
|
+
export interface PagesListAccumulator {
|
|
23
|
+
[index: string]: EventsPage;
|
|
24
|
+
}
|
|
@@ -5,3 +5,15 @@ export interface IpPool {
|
|
|
5
5
|
name: string;
|
|
6
6
|
pool_id: string;
|
|
7
7
|
}
|
|
8
|
+
export interface IpPoolListResponse {
|
|
9
|
+
body: {
|
|
10
|
+
ip_pools: IpPool;
|
|
11
|
+
message: string;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export interface IpPoolUpdateData {
|
|
15
|
+
name: string;
|
|
16
|
+
description: string;
|
|
17
|
+
add_ip: string;
|
|
18
|
+
remove_ip: string;
|
|
19
|
+
}
|
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import { MailingList } from './lists';
|
|
2
|
+
export interface MailListMember {
|
|
3
|
+
address: string;
|
|
4
|
+
name: string;
|
|
5
|
+
subscribed: boolean;
|
|
6
|
+
vars: string | any;
|
|
7
|
+
}
|
|
2
8
|
export interface MailListMembersQuery {
|
|
3
9
|
subscribed?: 'yes' | 'no';
|
|
4
10
|
limit?: number;
|
|
@@ -25,12 +31,6 @@ export interface CreateUpdateMailListMembersReq {
|
|
|
25
31
|
subscribed?: 'yes' | 'no' | boolean;
|
|
26
32
|
upsert?: 'yes' | 'no';
|
|
27
33
|
}
|
|
28
|
-
export interface MailListMember {
|
|
29
|
-
address: string;
|
|
30
|
-
name: string;
|
|
31
|
-
subscribed: boolean;
|
|
32
|
-
vars: string | any;
|
|
33
|
-
}
|
|
34
34
|
export interface DeletedMember {
|
|
35
35
|
member: {
|
|
36
36
|
address: string;
|
package/dist/lib/ip-pools.d.ts
CHANGED
|
@@ -1,24 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
import { IpPool } from
|
|
1
|
+
import Request from './request';
|
|
2
|
+
import { IpPool, IpPoolUpdateData } from './interfaces/IpPools';
|
|
3
3
|
export default class IpPoolsClient {
|
|
4
|
-
request:
|
|
5
|
-
constructor(request:
|
|
6
|
-
list(query: any): IpPool[]
|
|
4
|
+
request: Request;
|
|
5
|
+
constructor(request: Request);
|
|
6
|
+
list(query: any): Promise<IpPool[]>;
|
|
7
7
|
create(data: {
|
|
8
8
|
name: string;
|
|
9
9
|
description?: string;
|
|
10
10
|
ips?: string[];
|
|
11
|
-
}):
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
remove_ip: string;
|
|
17
|
-
}): any;
|
|
11
|
+
}): Promise<{
|
|
12
|
+
message: string;
|
|
13
|
+
pool_id: string;
|
|
14
|
+
}>;
|
|
15
|
+
update(poolId: string, data: IpPoolUpdateData): Promise<any>;
|
|
18
16
|
delete(poolId: string, data: {
|
|
19
17
|
id: string;
|
|
20
18
|
pool_id: string;
|
|
21
|
-
}): any
|
|
19
|
+
}): Promise<any>;
|
|
22
20
|
private parseIpPoolsResponse;
|
|
23
21
|
}
|
|
24
|
-
export {};
|
package/dist/lib/ips.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
1
|
+
import MgRequest from './request';
|
|
2
|
+
import { IpData, IpsListResponseBody } from './interfaces/Ips';
|
|
2
3
|
export default class IpsClient {
|
|
3
|
-
request:
|
|
4
|
-
constructor(request:
|
|
5
|
-
list(query: any):
|
|
6
|
-
get(ip: string):
|
|
4
|
+
request: MgRequest;
|
|
5
|
+
constructor(request: MgRequest);
|
|
6
|
+
list(query: any): Promise<IpsListResponseBody | IpData>;
|
|
7
|
+
get(ip: string): Promise<IpsListResponseBody | IpData>;
|
|
7
8
|
private parseIpsResponse;
|
|
8
9
|
}
|
|
9
|
-
export {};
|
package/dist/lib/messages.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import Request from './request';
|
|
2
2
|
import { BounceData, ComplaintData, UnsubscribeData } from './interfaces/Supressions';
|
|
3
|
-
declare type TModel = typeof Bounce | typeof Complaint | typeof Unsubscribe;
|
|
4
3
|
declare class Bounce {
|
|
5
4
|
type: string;
|
|
6
5
|
address: string;
|
|
@@ -22,6 +21,7 @@ declare class Unsubscribe {
|
|
|
22
21
|
created_at: Date;
|
|
23
22
|
constructor(data: UnsubscribeData);
|
|
24
23
|
}
|
|
24
|
+
declare type TModel = typeof Bounce | typeof Complaint | typeof Unsubscribe;
|
|
25
25
|
export default class SuppressionClient {
|
|
26
26
|
request: any;
|
|
27
27
|
models: {
|