mailgun.js 9.2.0 → 9.3.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/CHANGELOG.md +24 -0
- package/Classes/Webhooks.d.ts +3 -2
- package/Classes/common/FormDataBuilder.d.ts +1 -1
- package/Interfaces/Webhooks/IWebHooksClient.d.ts +1 -1
- package/README.md +36 -10
- package/Types/Webhooks/Webhooks.d.ts +4 -0
- package/mailgun.node.js +2 -2
- package/mailgun.node.js.LICENSE.txt +1 -1
- package/mailgun.web.js +2 -2
- package/mailgun.web.js.LICENSE.txt +1 -1
- package/package.json +1 -1
- package/version.md +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,30 @@
|
|
|
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
|
+
## [9.3.0](https://github.com/mailgun/mailgun.js/compare/v9.2.1...v9.3.0) (2023-09-18)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Features
|
|
9
|
+
|
|
10
|
+
* Update webhook.update method to allow multiple URLs ([633bce9](https://github.com/mailgun/mailgun.js/commits/633bce9f2a7a704972251af16aeafdc73d5cbbde))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Other changes
|
|
14
|
+
|
|
15
|
+
* Update docs ([3a3b8d8](https://github.com/mailgun/mailgun.js/commits/3a3b8d8a9ced9f6a2d63ce42010980d20cfaf815))
|
|
16
|
+
|
|
17
|
+
### [9.2.1](https://github.com/mailgun/mailgun.js/compare/v9.2.0...v9.2.1) (2023-08-16)
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
### Bug Fixes
|
|
21
|
+
|
|
22
|
+
* Node.js native FormData issue ([f00dd57](https://github.com/mailgun/mailgun.js/commits/f00dd57137334e663b01dc833deefad2f36b23f6))
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
### Other changes
|
|
26
|
+
|
|
27
|
+
* Update readme for events ([83996c9](https://github.com/mailgun/mailgun.js/commits/83996c95fce7d8ecc3f2c5b8fcd0241500a7b1a5))
|
|
28
|
+
|
|
5
29
|
## [9.2.0](https://github.com/mailgun/mailgun.js/compare/v9.1.2...v9.2.0) (2023-07-07)
|
|
6
30
|
|
|
7
31
|
|
package/Classes/Webhooks.d.ts
CHANGED
|
@@ -5,7 +5,8 @@ import Request from './common/Request';
|
|
|
5
5
|
export declare class Webhook implements WebhookResult {
|
|
6
6
|
id: string;
|
|
7
7
|
url: string | undefined;
|
|
8
|
-
|
|
8
|
+
urls: string[];
|
|
9
|
+
constructor(id: string, url: string | undefined, urls: string[]);
|
|
9
10
|
}
|
|
10
11
|
export default class WebhooksClient implements IWebHooksClient {
|
|
11
12
|
request: Request;
|
|
@@ -16,6 +17,6 @@ export default class WebhooksClient implements IWebHooksClient {
|
|
|
16
17
|
list(domain: string, query: WebhooksQuery): Promise<WebhookList>;
|
|
17
18
|
get(domain: string, id: WebhooksIds): Promise<WebhookResult>;
|
|
18
19
|
create(domain: string, id: string, url: string, test?: boolean): Promise<WebhookResult | WebhookValidationResponse>;
|
|
19
|
-
update(domain: string, id: string,
|
|
20
|
+
update(domain: string, id: string, urlValues: string | string[]): Promise<WebhookResult>;
|
|
20
21
|
destroy(domain: string, id: string): Promise<WebhookResult>;
|
|
21
22
|
}
|
|
@@ -4,7 +4,7 @@ declare class FormDataBuilder {
|
|
|
4
4
|
private FormDataConstructor;
|
|
5
5
|
constructor(FormDataConstructor: InputFormData);
|
|
6
6
|
createFormData(data: any): NodeFormData | FormData;
|
|
7
|
-
private
|
|
7
|
+
private isFormDataPackage;
|
|
8
8
|
private getAttachmentOptions;
|
|
9
9
|
private addMimeDataToFD;
|
|
10
10
|
private addFilesToFD;
|
|
@@ -4,6 +4,6 @@ export interface IWebHooksClient {
|
|
|
4
4
|
list(domain: string, query: WebhooksQuery): Promise<WebhookList>;
|
|
5
5
|
get(domain: string, id: WebhooksIds): Promise<WebhookResult>;
|
|
6
6
|
create(domain: string, id: string, url: string, test: boolean): Promise<WebhookResult | WebhookValidationResponse>;
|
|
7
|
-
update(domain: string, id: string, url: string): Promise<WebhookResult>;
|
|
7
|
+
update(domain: string, id: string, url: string | string[]): Promise<WebhookResult>;
|
|
8
8
|
destroy(domain: string, id: string): Promise<WebhookResult>;
|
|
9
9
|
}
|
package/README.md
CHANGED
|
@@ -97,6 +97,7 @@ The following service methods are available to instantiated clients. The example
|
|
|
97
97
|
- [assignIp](#assignip)
|
|
98
98
|
- [events](#events)
|
|
99
99
|
- [get](#get-1)
|
|
100
|
+
- [Example with Date and *Filter field*](#example-with-date-and-filter-field)
|
|
100
101
|
- [stats](#stats)
|
|
101
102
|
- [getDomain](#getdomain)
|
|
102
103
|
- [getAccount](#getaccount)
|
|
@@ -898,13 +899,15 @@ Method naming conventions:
|
|
|
898
899
|
|
|
899
900
|
- #### get
|
|
900
901
|
|
|
901
|
-
`mg.events.get(domain,
|
|
902
|
+
`mg.events.get(domain, data)`
|
|
902
903
|
|
|
903
904
|
Example:
|
|
904
905
|
|
|
905
906
|
```js
|
|
906
|
-
mg.events.get('foobar.example.com', {
|
|
907
|
-
|
|
907
|
+
mg.events.get('foobar.example.com', {
|
|
908
|
+
page: 'mypageid',
|
|
909
|
+
event: 'opened'
|
|
910
|
+
}).then(data => console.log(data.items)) // logs array of event objects
|
|
908
911
|
.catch(err => console.error(err)); // logs any error
|
|
909
912
|
```
|
|
910
913
|
|
|
@@ -918,8 +921,17 @@ Method naming conventions:
|
|
|
918
921
|
| end | The end of the search time range. It can be specified as a string (see Date Format) or linux epoch seconds. Refer to Time Range for details. |
|
|
919
922
|
| ascending | Defines the direction of the search time range if the range end time is not specified. Can be either yes or no. Refer to Time Range for details. |
|
|
920
923
|
| limit | Number of entries to return. (300 max) |
|
|
921
|
-
|
|
|
922
|
-
|
|
924
|
+
| **field** | **field** is the name of the *[Filter Field](https://documentation.mailgun.com/en/latest/api-events.html#filter-field)*. The value of the parameter should be a valid Filter Expression. Several field filters can be specified in one request. If the same field is mentioned, more then once, then all its filter expressions are combined with AND operator. |
|
|
925
|
+
- #### Example with Date and *Filter field*
|
|
926
|
+
```js
|
|
927
|
+
const date = new Date(2023, 7, 2, 0, 0, 0, 0); // Wed Aug 02 2023 00:00:00 GMT+0300
|
|
928
|
+
const events = await mg.events.get('foobar.example.com', {
|
|
929
|
+
begin: date.toUTCString(), // 'Tue, 01 Aug 2023 21:00:00 GMT'
|
|
930
|
+
ascending: 'yes',
|
|
931
|
+
limit: 5,
|
|
932
|
+
event: 'delivered'
|
|
933
|
+
});
|
|
934
|
+
```
|
|
923
935
|
Promise returns: items (array of event objects), pages (paging keys grouped by id)
|
|
924
936
|
|
|
925
937
|
```JS
|
|
@@ -1323,7 +1335,7 @@ Method naming conventions:
|
|
|
1323
1335
|
|
|
1324
1336
|
```JS
|
|
1325
1337
|
{
|
|
1326
|
-
'open': { 'url': 'http://requestb.in' }
|
|
1338
|
+
'open': { 'url': 'http://requestb.in', 'urls': ['trackclick.com'] }
|
|
1327
1339
|
}
|
|
1328
1340
|
```
|
|
1329
1341
|
|
|
@@ -1343,7 +1355,7 @@ Method naming conventions:
|
|
|
1343
1355
|
|
|
1344
1356
|
```JS
|
|
1345
1357
|
{
|
|
1346
|
-
'open': { 'url': 'http://requestb.in' }
|
|
1358
|
+
'open': { 'url': 'http://requestb.in', 'urls': ['http://requestb.in'] }
|
|
1347
1359
|
}
|
|
1348
1360
|
```
|
|
1349
1361
|
|
|
@@ -1380,10 +1392,24 @@ Method naming conventions:
|
|
|
1380
1392
|
|
|
1381
1393
|
```JS
|
|
1382
1394
|
{
|
|
1383
|
-
'open': { 'url': 'http://requestb.in' }
|
|
1395
|
+
'open': { 'url': 'http://requestb.in', 'urls': ['http://requestb.in'] }
|
|
1384
1396
|
}
|
|
1385
1397
|
```
|
|
1386
1398
|
|
|
1399
|
+
```js
|
|
1400
|
+
mg.webhooks.update('foobar.example.com', 'open', ['http://requestb.in', 'http://requestb1.in' ]) // bounce, deliver, drop, spam, unsubscribe, click, open
|
|
1401
|
+
.then(msg => console.log(msg)) // logs response data
|
|
1402
|
+
.catch(err => console.error(err)); // logs any error
|
|
1403
|
+
```
|
|
1404
|
+
|
|
1405
|
+
Promise returns:
|
|
1406
|
+
```JS
|
|
1407
|
+
{
|
|
1408
|
+
'open': { 'url': 'http://requestb.in', 'urls': ['http://requestb.in', 'http://requestb1.in'] }
|
|
1409
|
+
}
|
|
1410
|
+
```
|
|
1411
|
+
|
|
1412
|
+
|
|
1387
1413
|
- #### destroy
|
|
1388
1414
|
|
|
1389
1415
|
`mg.webhooks.destroy(domain, id)`
|
|
@@ -1400,7 +1426,7 @@ Method naming conventions:
|
|
|
1400
1426
|
|
|
1401
1427
|
```JS
|
|
1402
1428
|
{
|
|
1403
|
-
'open': { 'url': 'http://requestb.in' }
|
|
1429
|
+
'open': { 'url': 'http://requestb.in', 'urls': ['http://requestb.in']}
|
|
1404
1430
|
}
|
|
1405
1431
|
```
|
|
1406
1432
|
|
|
@@ -1477,7 +1503,7 @@ Method naming conventions:
|
|
|
1477
1503
|
|
|
1478
1504
|
Promise returns: response body
|
|
1479
1505
|
|
|
1480
|
-
```
|
|
1506
|
+
```js
|
|
1481
1507
|
{
|
|
1482
1508
|
actions: [ 'forward("http://myhost.com/messages/")', 'stop()' ],
|
|
1483
1509
|
created_at: 'Mon, 26 Oct 2015 03:56:51 GMT',
|