mailgun.js 7.0.1 → 7.0.4

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/CHANGELOG.md CHANGED
@@ -2,6 +2,43 @@
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
+ ### [7.0.4](https://github.com/mailgun/mailgun.js/compare/v7.0.3...v7.0.4) (2022-07-07)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * Message Data (one of text, html, template required) ([abd2862](https://github.com/mailgun/mailgun.js/commits/abd2862fcf36ca54d68dea14cb2b2658d33092ec))
11
+
12
+
13
+ ### Other changes
14
+
15
+ * Add content to message data ([a878cc1](https://github.com/mailgun/mailgun.js/commits/a878cc1acb0b4ca441b100278ca0fd2b47d137e3))
16
+ * Add propetry for mime messages ([f701cfb](https://github.com/mailgun/mailgun.js/commits/f701cfb591f08dbb882953bb2b77131fae089bad))
17
+ * Fix build error ([c7fcb5e](https://github.com/mailgun/mailgun.js/commits/c7fcb5e05bd84fc6ef04589bde37846a11f9466d))
18
+ * Fix tests ([b4791c4](https://github.com/mailgun/mailgun.js/commits/b4791c4e746a97aec359635272c2b29cb956ab6f))
19
+
20
+ ### [7.0.3](https://github.com/mailgun/mailgun.js/compare/v7.0.2...v7.0.3) (2022-06-30)
21
+
22
+
23
+ ### Bug Fixes
24
+
25
+ * Update handler of mime messages to support strings ([8d88163](https://github.com/mailgun/mailgun.js/commits/8d881636e7de54275d2cccb9652198c9af8cf0a1))
26
+
27
+
28
+ ### Other changes
29
+
30
+ * Add missed subject property in readme ([7f4d128](https://github.com/mailgun/mailgun.js/commits/7f4d1286642d4009b25224514d75a0fb51af9bef))
31
+ * Fix link to doc for domains ([944a189](https://github.com/mailgun/mailgun.js/commits/944a1898b03ea020534a7e1be64b1b993ba86439))
32
+ * Regenerate docs ([7f6d318](https://github.com/mailgun/mailgun.js/commits/7f6d3184523c2f9a851093f2b733c5c8fc6806a4))
33
+ * Replace console.log by console.error for logging errors in the readme ([fd9a31f](https://github.com/mailgun/mailgun.js/commits/fd9a31fe90908c9e2e40b2df34cf94a39a716687))
34
+
35
+ ### [7.0.2](https://github.com/mailgun/mailgun.js/compare/v7.0.1...v7.0.2) (2022-06-14)
36
+
37
+
38
+ ### Bug Fixes
39
+
40
+ * Add boolean values handling in message create ([ff91208](https://github.com/mailgun/mailgun.js/commits/ff91208aac087913df51563928b76583ba1eac05))
41
+
5
42
  ### [7.0.1](https://github.com/mailgun/mailgun.js/compare/v7.0.0...v7.0.1) (2022-06-10)
6
43
 
7
44
 
package/README.md CHANGED
@@ -138,6 +138,7 @@ Parameter | Description
138
138
  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"]).
139
139
  cc | Same as `To` but for `carbon copy`
140
140
  bcc | Same as `To` but for `blind carbon copy`
141
+ subject | Subject of the message.
141
142
  html | HTML version of the message.
142
143
  text | Text version of the message.
143
144
  message | MIME string of the message. Make sure to use multipart/form-data to send this as a file upload.
@@ -165,7 +166,7 @@ v:my-var | v: prefix followed by an arbitrary name allows to attach a c
165
166
  html: "<h1>Testing some Mailgun awesomness!</h1>"
166
167
  })
167
168
  .then(msg => console.log(msg)) // logs response data
168
- .catch(err => console.log(err)); // logs any error
169
+ .catch(err => console.error(err)); // logs any error
169
170
  ```
170
171
 
171
172
  - MIME Example:
@@ -178,7 +179,7 @@ v:my-var | v: prefix followed by an arbitrary name allows to attach a c
178
179
  message: "<mime encoded string here>"
179
180
  })
180
181
  .then(msg => console.log(msg)) // logs response data
181
- .catch(err => console.log(err)); // logs any error
182
+ .catch(err => console.error(err)); // logs any error
182
183
  ```
183
184
 
184
185
  Messages with attachments:
@@ -399,14 +400,14 @@ Recipient Variables are custom variables that you define, which you can then ref
399
400
 
400
401
  #### list
401
402
 
402
- `mg.domains.list(query)` - [api docs](https://documentation.mailgun.com/api-domains.html)
403
+ `mg.domains.list(query)` - [api docs](https://documentation.mailgun.com/en/latest/api-domains.html)
403
404
 
404
405
  Example:
405
406
 
406
407
  ```js
407
408
  mg.domains.list()
408
409
  .then(domains => console.log(domains)) // logs array of domains
409
- .catch(err => console.log(err)); // logs any error
410
+ .catch(err => console.error(err)); // logs any error
410
411
  ```
411
412
 
412
413
  Promise Returns: array of Domain instances
@@ -444,7 +445,7 @@ Example:
444
445
  ```js
445
446
  mg.domains.get()
446
447
  .then(domains => console.log(domains)) // logs array of domains
447
- .catch(err => console.log(err)); // logs any error
448
+ .catch(err => console.error(err)); // logs any error
448
449
  ```
449
450
 
450
451
  Promise Returns: Domain instance
@@ -503,7 +504,7 @@ Example:
503
504
  ```js
504
505
  mg.domains.create({name: 'foobar.example.com'})
505
506
  .then(msg => console.log(msg)) // logs response data
506
- .catch(err => console.log(err)); // logs any error
507
+ .catch(err => console.error(err)); // logs any error
507
508
  ```
508
509
 
509
510
  Options:
@@ -570,7 +571,7 @@ Example:
570
571
  ```js
571
572
  mg.domains.destroy('foobar.example.com')
572
573
  .then(msg => console.log(msg)) // logs response data
573
- .catch(err => console.log(err)); // logs any error
574
+ .catch(err => console.error(err)); // logs any error
574
575
  ```
575
576
 
576
577
  Promise Returns:
@@ -590,7 +591,7 @@ Example:
590
591
  ```js
591
592
  mg.domains.getTracking('foobar.example.com')
592
593
  .then(msg => console.log(msg)) // logs response data
593
- .catch(err => console.log(err)); // logs any error
594
+ .catch(err => console.error(err)); // logs any error
594
595
  ```
595
596
 
596
597
  Promise Returns:
@@ -620,7 +621,7 @@ Open Tracking Example:
620
621
  ```js
621
622
  mg.domains.updateTracking('foobar.example.com', 'open', {active: true})
622
623
  .then(msg => console.log(msg)) // logs response data
623
- .catch(err => console.log(err)); // logs any error
624
+ .catch(err => console.error(err)); // logs any error
624
625
  ```
625
626
 
626
627
  Open Tracking Options
@@ -645,7 +646,7 @@ Click Tracking Example:
645
646
  ```js
646
647
  mg.domains.updateTracking('foobar.example.com', 'click', {active: true})
647
648
  .then(msg => console.log(msg)) // logs response data
648
- .catch(err => console.log(err)); // logs any error
649
+ .catch(err => console.error(err)); // logs any error
649
650
  ```
650
651
 
651
652
  Click Tracking Options
@@ -674,7 +675,7 @@ mg.domains.updateTracking('foobar.example.com', 'unsubscribe', {
674
675
  text_footer: "\n\nTo unsubscribe click: <%unsubscribe_url%>\n\n"
675
676
  })
676
677
  .then(msg => console.log(msg)) // logs response data
677
- .catch(err => console.log(err)); // logs any error
678
+ .catch(err => console.error(err)); // logs any error
678
679
  ```
679
680
 
680
681
  Unsubscribe Tracking Options
@@ -706,7 +707,7 @@ Example:
706
707
  ```js
707
708
  mg.domains.getIps('foobar.example.com')
708
709
  .then(msg => console.log(msg)) // logs response data
709
- .catch(err => console.log(err)); // logs any error
710
+ .catch(err => console.error(err)); // logs any error
710
711
  ```
711
712
 
712
713
  Promise Returns:
@@ -724,7 +725,7 @@ Example:
724
725
  ```js
725
726
  mg.domains.assignIp('foobar.example.com', "192.168.0.3")
726
727
  .then(msg => console.log(msg)) // logs response data
727
- .catch(err => console.log(err)); // logs any error
728
+ .catch(err => console.error(err)); // logs any error
728
729
  ```
729
730
 
730
731
 
@@ -743,7 +744,7 @@ Example:
743
744
  ```js
744
745
  mg.domains.deleteIp('foobar.example.com', "192.168.0.3")
745
746
  .then(msg => console.log(msg)) // logs response data
746
- .catch(err => console.log(err)); // logs any error
747
+ .catch(err => console.error(err)); // logs any error
747
748
  ```
748
749
 
749
750
 
@@ -765,7 +766,7 @@ Example:
765
766
  ```js
766
767
  mg.events.get('foobar.example.com', { page: 'mypageid' })
767
768
  .then(data => console.log(data.items)) // logs array of event objects
768
- .catch(err => console.log(err)); // logs any error
769
+ .catch(err => console.error(err)); // logs any error
769
770
  ```
770
771
 
771
772
  Options:
@@ -845,7 +846,7 @@ Example:
845
846
  ```js
846
847
  mg.stats.getDomain('foobar.example.com', {event: ['delivered', 'accepted', 'failed', 'complained']})
847
848
  .then(msg => console.log(msg)) // logs response data
848
- .catch(err => console.log(err)); // logs any error
849
+ .catch(err => console.error(err)); // logs any error
849
850
  ```
850
851
 
851
852
  Promise Returns:
@@ -871,7 +872,7 @@ Example:
871
872
  ```js
872
873
  mg.stats.getDomain('foobar.example.com', {event: ['delivered', 'accepted', 'failed', 'complained']})
873
874
  .then(msg => console.log(msg)) // logs response data
874
- .catch(err => console.log(err)); // logs any error
875
+ .catch(err => console.error(err)); // logs any error
875
876
  ```
876
877
 
877
878
  Promise Returns:
@@ -899,7 +900,7 @@ Bounces Example:
899
900
  ```js
900
901
  mg.suppressions.list('foobar.example.com', 'bounces')
901
902
  .then(msg => console.log(msg)) // logs response data
902
- .catch(err => console.log(err)); // logs any error
903
+ .catch(err => console.error(err)); // logs any error
903
904
  ```
904
905
 
905
906
  Unsubscribes Example:
@@ -907,7 +908,7 @@ Unsubscribes Example:
907
908
  ```js
908
909
  mg.suppressions.list('foobar.example.com', 'unsubscribes')
909
910
  .then(msg => console.log(msg)) // logs response data
910
- .catch(err => console.log(err)); // logs any error
911
+ .catch(err => console.error(err)); // logs any error
911
912
  ```
912
913
 
913
914
  Complaints Example:
@@ -915,7 +916,7 @@ Complaints Example:
915
916
  ```js
916
917
  mg.suppressions.list('foobar.example.com', 'complaints')
917
918
  .then(msg => console.log(msg)) // logs response data
918
- .catch(err => console.log(err)); // logs any error
919
+ .catch(err => console.error(err)); // logs any error
919
920
  ```
920
921
 
921
922
  Promise Returns:
@@ -949,7 +950,7 @@ Bounces Example:
949
950
  ```js
950
951
  mg.suppressions.get('foobar.example.com', 'bounces', 'address@example.com')
951
952
  .then(msg => console.log(msg)) // logs response data
952
- .catch(err => console.log(err)); // logs any error
953
+ .catch(err => console.error(err)); // logs any error
953
954
  ```
954
955
 
955
956
  Unsubscribes Example:
@@ -957,7 +958,7 @@ Unsubscribes Example:
957
958
  ```js
958
959
  mg.suppressions.get('foobar.example.com', 'unsubscribes', 'address@example.com')
959
960
  .then(msg => console.log(msg)) // logs response data
960
- .catch(err => console.log(err)); // logs any error
961
+ .catch(err => console.error(err)); // logs any error
961
962
  ```
962
963
 
963
964
  Complaints Example:
@@ -965,7 +966,7 @@ Complaints Example:
965
966
  ```js
966
967
  mg.suppressions.get('foobar.example.com', 'complaints', 'address@example.com')
967
968
  .then(msg => console.log(msg)) // logs response data
968
- .catch(err => console.log(err)); // logs any error
969
+ .catch(err => console.error(err)); // logs any error
969
970
  ```
970
971
 
971
972
  Options:
@@ -990,7 +991,7 @@ Bounces Example:
990
991
  ```js
991
992
  mg.suppressions.create('foobar.example.com', 'bounces', [{address: 'bob@example.com'}])
992
993
  .then(msg => console.log(msg)) // logs response data
993
- .catch(err => console.log(err)); // logs any error
994
+ .catch(err => console.error(err)); // logs any error
994
995
  ```
995
996
 
996
997
  Bounces Options: Contains an array with the following object properties
@@ -1015,7 +1016,7 @@ Unsubscribes Example:
1015
1016
  ```js
1016
1017
  mg.suppressions.create('foobar.example.com', 'unsubscribes', [{address: 'bob@example.com'}])
1017
1018
  .then(msg => console.log(msg)) // logs response data
1018
- .catch(err => console.log(err)); // logs any error
1019
+ .catch(err => console.error(err)); // logs any error
1019
1020
  ```
1020
1021
 
1021
1022
  Unsubscribes Options: Contains an array with the following object properties
@@ -1039,7 +1040,7 @@ Complaints Example:
1039
1040
  ```js
1040
1041
  mg.suppressions.create('foobar.example.com', 'complaints', [{address: 'bob@example.com'}])
1041
1042
  .then(msg => console.log(msg)) // logs response data
1042
- .catch(err => console.log(err)); // logs any error
1043
+ .catch(err => console.error(err)); // logs any error
1043
1044
  ```
1044
1045
 
1045
1046
  Complaints Options: Contains an array with the following object properties
@@ -1068,7 +1069,7 @@ Example:
1068
1069
  ```js
1069
1070
  mg.webhooks.list('foobar.example.com')
1070
1071
  .then(msg => console.log(msg)) // logs response data
1071
- .catch(err => console.log(err)); // logs any error
1072
+ .catch(err => console.error(err)); // logs any error
1072
1073
  ```
1073
1074
 
1074
1075
  Promise Returns:
@@ -1096,7 +1097,7 @@ Example:
1096
1097
  ```js
1097
1098
  mg.webhooks.get('foobar.example.com', 'open') // bounce, deliver, drop, spam, unsubscribe, click, open
1098
1099
  .then(msg => console.log(msg)) // logs response data
1099
- .catch(err => console.log(err)); // logs any error
1100
+ .catch(err => console.error(err)); // logs any error
1100
1101
  ```
1101
1102
 
1102
1103
  Promise Returns:
@@ -1116,7 +1117,7 @@ Example:
1116
1117
  ```js
1117
1118
  mg.webhooks.create('foobar.example.com', 'open', 'http://requestb.in') // bounce, deliver, drop, spam, unsubscribe, click, open
1118
1119
  .then(msg => console.log(msg)) // logs response data
1119
- .catch(err => console.log(err)); // logs any error
1120
+ .catch(err => console.error(err)); // logs any error
1120
1121
  ```
1121
1122
 
1122
1123
  Promise Returns:
@@ -1132,7 +1133,7 @@ Test Webhook Example:
1132
1133
  ```js
1133
1134
  mg.webhooks.get('foobar.example.com', 'open', 'http://requestb.in', true) // bounce, deliver, drop, spam, unsubscribe, click, open
1134
1135
  .then(msg => console.log(msg)) // logs response data
1135
- .catch(err => console.log(err)); // logs any error
1136
+ .catch(err => console.error(err)); // logs any error
1136
1137
  ```
1137
1138
 
1138
1139
  Promise Returns:
@@ -1153,7 +1154,7 @@ Example:
1153
1154
  ```js
1154
1155
  mg.webhooks.update('foobar.example.com', 'open', 'http://requestb.in') // bounce, deliver, drop, spam, unsubscribe, click, open
1155
1156
  .then(msg => console.log(msg)) // logs response data
1156
- .catch(err => console.log(err)); // logs any error
1157
+ .catch(err => console.error(err)); // logs any error
1157
1158
  ```
1158
1159
 
1159
1160
  Promise Returns:
@@ -1173,7 +1174,7 @@ Example:
1173
1174
  ```js
1174
1175
  mg.webhooks.update('foobar.example.com', 'open') // bounce, deliver, drop, spam, unsubscribe, click, open
1175
1176
  .then(msg => console.log(msg)) // logs response data
1176
- .catch(err => console.log(err)); // logs any error
1177
+ .catch(err => console.error(err)); // logs any error
1177
1178
  ```
1178
1179
 
1179
1180
  Promise Returns:
@@ -1195,7 +1196,7 @@ Example:
1195
1196
  ```js
1196
1197
  mg.routes.list()
1197
1198
  .then(data => console.log(data)) // logs response body
1198
- .catch(err => console.log(err)); // logs any error
1199
+ .catch(err => console.error(err)); // logs any error
1199
1200
  ```
1200
1201
 
1201
1202
  Promise Returns: response body
@@ -1222,7 +1223,7 @@ Example:
1222
1223
  ```js
1223
1224
  mg.routes.get('562da483125730608a7d1719')
1224
1225
  .then(data => console.log(data)) // logs response body
1225
- .catch(err => console.log(err)); // logs any error
1226
+ .catch(err => console.error(err)); // logs any error
1226
1227
  ```
1227
1228
 
1228
1229
  Promise Returns: response body
@@ -1252,7 +1253,7 @@ mg.routes.create({
1252
1253
  action: ['forward("http://myhost.com/messages/")', 'stop()']
1253
1254
  })
1254
1255
  .then(data => console.log(data)) // logs response body
1255
- .catch(err => console.log(err)); // logs any error
1256
+ .catch(err => console.error(err)); // logs any error
1256
1257
  ```
1257
1258
 
1258
1259
  Promise Returns: response body
@@ -1282,7 +1283,7 @@ mg.routes.update('562da483125730608a7d1719', {
1282
1283
  action: ['forward("http://myhost.com/messages/")', 'stop()']
1283
1284
  })
1284
1285
  .then(data => console.log(data)) // logs response body
1285
- .catch(err => console.log(err)); // logs any error
1286
+ .catch(err => console.error(err)); // logs any error
1286
1287
  ```
1287
1288
 
1288
1289
  Promise Returns: response body
@@ -1308,7 +1309,7 @@ Example:
1308
1309
  ```js
1309
1310
  mg.routes.destroy('562da483125730608a7d1719')
1310
1311
  .then(data => console.log(data)) // logs response body
1311
- .catch(err => console.log(err)); // logs any error
1312
+ .catch(err => console.error(err)); // logs any error
1312
1313
  ```
1313
1314
 
1314
1315
  Promise Returns: response body
@@ -1331,7 +1332,7 @@ Example:
1331
1332
  ```js
1332
1333
  mg.validate.get('foo@mailgun.net')
1333
1334
  .then(data => console.log(data)) // logs response body
1334
- .catch(err => console.log(err)); // logs any error
1335
+ .catch(err => console.error(err)); // logs any error
1335
1336
  ```
1336
1337
 
1337
1338
  Promise Returns: response body
@@ -1386,7 +1387,7 @@ Response shape:
1386
1387
  ```js
1387
1388
  mg.validate.multipleValidation.list()
1388
1389
  .then(data => console.log(data)) // logs response body
1389
- .catch(err => console.log(err)); // logs any error
1390
+ .catch(err => console.error(err)); // logs any error
1390
1391
  ```
1391
1392
 
1392
1393
  Response shape:
@@ -1432,7 +1433,7 @@ Response shape:
1432
1433
  ```js
1433
1434
  mg.validate.multipleValidation.get('name_of_the_list')
1434
1435
  .then(data => console.log(data)) // logs response body
1435
- .catch(err => console.log(err)); // logs any error
1436
+ .catch(err => console.error(err)); // logs any error
1436
1437
  ```
1437
1438
 
1438
1439
  Response shape:
@@ -1469,7 +1470,7 @@ cancels bulk validation job
1469
1470
  ```js
1470
1471
  mg.validate.multipleValidation.destroy('name_of_the_list');
1471
1472
  .then(data => console.log(data)) // logs response body
1472
- .catch(err => console.log(err)); // logs any error
1473
+ .catch(err => console.error(err)); // logs any error
1473
1474
  ```
1474
1475
 
1475
1476
  Response shape:
@@ -1493,7 +1494,7 @@ Example:
1493
1494
  ```js
1494
1495
  mg.lists.list()
1495
1496
  .then(data => console.log(data)) // logs response body
1496
- .catch(err => console.log(err)); // logs any error
1497
+ .catch(err => console.error(err)); // logs any error
1497
1498
  ```
1498
1499
 
1499
1500
  Promise Returns: response body
@@ -1521,7 +1522,7 @@ Example:
1521
1522
  ```js
1522
1523
  mg.lists.get('noreply@sample.com')
1523
1524
  .then(data => console.log(data)) // logs response body
1524
- .catch(err => console.log(err)); // logs any error
1525
+ .catch(err => console.error(err)); // logs any error
1525
1526
  ```
1526
1527
 
1527
1528
  Promise Returns: response body
@@ -1553,7 +1554,7 @@ mg.lists.create({
1553
1554
  reply_preference: 'list', // optional, modifiable on website
1554
1555
  })
1555
1556
  .then(data => console.log(data)) // logs response body
1556
- .catch(err => console.log(err)); // logs any error
1557
+ .catch(err => console.error(err)); // logs any error
1557
1558
  ```
1558
1559
 
1559
1560
  Promise Returns: response body
@@ -1585,7 +1586,7 @@ mg.lists.update('reply@sample.com', {
1585
1586
  reply_preference: 'sender', // optional, modifiable on website
1586
1587
  })
1587
1588
  .then(data => console.log(data)) // logs response body
1588
- .catch(err => console.log(err)); // logs any error
1589
+ .catch(err => console.error(err)); // logs any error
1589
1590
  ```
1590
1591
 
1591
1592
  Promise Returns: response body
@@ -1611,7 +1612,7 @@ Example:
1611
1612
  ```js
1612
1613
  mg.lists.destroy('foo@sample.com')
1613
1614
  .then(data => console.log(data)) // logs response body
1614
- .catch(err => console.log(err)); // logs any error
1615
+ .catch(err => console.error(err)); // logs any error
1615
1616
  ```
1616
1617
 
1617
1618
  Promise Returns: response body
@@ -1636,7 +1637,7 @@ Example:
1636
1637
  ```js
1637
1638
  mg.lists.members.listMembers('reply@sample.com')
1638
1639
  .then(data => console.log(data)) // logs response body
1639
- .catch(err => console.log(err)); // logs any error
1640
+ .catch(err => console.error(err)); // logs any error
1640
1641
  ```
1641
1642
 
1642
1643
  Promise Returns: response body
@@ -1661,7 +1662,7 @@ Example:
1661
1662
  ```js
1662
1663
  mg.lists.members.getMember('reply@sample.com', 'foo@bar.com')
1663
1664
  .then(data => console.log(data)) // logs response body
1664
- .catch(err => console.log(err)); // logs any error
1665
+ .catch(err => console.error(err)); // logs any error
1665
1666
  ```
1666
1667
 
1667
1668
  Promise Returns: response body
@@ -1690,7 +1691,7 @@ mg.lists.members.createMember('reply@sample.com', {
1690
1691
  upsert: 'yes', // optional, choose yes to insert if not exist, or update it exist
1691
1692
  })
1692
1693
  .then(data => console.log(data)) // logs response body
1693
- .catch(err => console.log(err)); // logs any error
1694
+ .catch(err => console.error(err)); // logs any error
1694
1695
  ```
1695
1696
 
1696
1697
  Promise Returns: response body
@@ -1729,7 +1730,7 @@ mg.lists.members.createMembers('reply@sample.com', {
1729
1730
  upsert: "yes",
1730
1731
  })
1731
1732
  .then(data => console.log(data)) // logs response body
1732
- .catch(err => console.log(err)); // logs any error
1733
+ .catch(err => console.error(err)); // logs any error
1733
1734
  ```
1734
1735
 
1735
1736
  Promise Returns: response body
@@ -1764,7 +1765,7 @@ mg.lists.members.updateMember('reply@sample.com', 'bot1@foobar.com', {
1764
1765
  subscribed: false,
1765
1766
  })
1766
1767
  .then(data => console.log(data)) // logs response body
1767
- .catch(err => console.log(err)); // logs any error
1768
+ .catch(err => console.error(err)); // logs any error
1768
1769
  ```
1769
1770
 
1770
1771
  Promise Returns: response body
@@ -1787,7 +1788,7 @@ Example:
1787
1788
  ```js
1788
1789
  mg.lists.members.destroyMember('reply@sample.com', 'bot2@foobar.com')
1789
1790
  .then(data => console.log(data)) // logs response body
1790
- .catch(err => console.log(err)); // logs any error
1791
+ .catch(err => console.error(err)); // logs any error
1791
1792
  ```
1792
1793
 
1793
1794
  Promise Returns: response body
@@ -1,4 +1,31 @@
1
- export declare type MailgunMessageData = {
1
+ /// <reference types="node" />
2
+ /**
3
+ * Ensures the object has least one key present and not undefined
4
+ *
5
+ * @see {@link https://stackoverflow.com/a/49725198}
6
+ */
7
+ export declare type AtLeastOneKeyPresent<Object_, Keys extends keyof Object_ = keyof Object_> = Pick<Object_, Exclude<keyof Object_, Keys>> & {
8
+ [K in Keys]-?: Required<Pick<Object_, K>> & Partial<Pick<Object_, Exclude<Keys, K>>>;
9
+ }[Keys];
10
+ export declare type MailgunMessageContent = AtLeastOneKeyPresent<{
11
+ /**
12
+ * Body of the message. (text version)
13
+ */
14
+ text?: string;
15
+ /**
16
+ * Body of the message. (HTML version)
17
+ */
18
+ html?: string;
19
+ /**
20
+ * Body of the message. (MIME version)
21
+ */
22
+ message?: string | Buffer | Blob;
23
+ /**
24
+ * Name of a template stored via [template API](https://documentation.mailgun.com/en/latest/api-templates.html#api-templates). See [Templates](https://documentation.mailgun.com/en/latest/user_manual.html#templating) for more information
25
+ */
26
+ template?: string;
27
+ }>;
28
+ export declare type MailgunMessageData = MailgunMessageContent & {
2
29
  /**
3
30
  * Email address for `From` header
4
31
  */
@@ -21,14 +48,6 @@ export declare type MailgunMessageData = {
21
48
  * Message subject
22
49
  */
23
50
  subject?: string;
24
- /**
25
- * Body of the message. (text version)
26
- */
27
- text?: string;
28
- /**
29
- * Body of the message. (HTML version)
30
- */
31
- html?: string;
32
51
  /**
33
52
  * [AMP](https://developers.google.com/gmail/ampemail/) part of the message. Please follow google guidelines to compose and send AMP emails.
34
53
  */
@@ -45,10 +64,6 @@ export declare type MailgunMessageData = {
45
64
  * You can post multiple `inline` values.
46
65
  */
47
66
  inline?: any;
48
- /**
49
- * Name of a template stored via [template API](https://documentation.mailgun.com/en/latest/api-templates.html#api-templates). See [Templates](https://documentation.mailgun.com/en/latest/user_manual.html#templating) for more information
50
- */
51
- template?: string;
52
67
  /**
53
68
  * Use this parameter to send a message to specific version of a template
54
69
  */