mailgun.js 9.2.1 → 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 CHANGED
@@ -2,6 +2,18 @@
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
+
5
17
  ### [9.2.1](https://github.com/mailgun/mailgun.js/compare/v9.2.0...v9.2.1) (2023-08-16)
6
18
 
7
19
 
@@ -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
- constructor(id: string, url: string | undefined);
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, url: string): Promise<WebhookResult>;
20
+ update(domain: string, id: string, urlValues: string | string[]): Promise<WebhookResult>;
20
21
  destroy(domain: string, id: string): Promise<WebhookResult>;
21
22
  }
@@ -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
@@ -1335,7 +1335,7 @@ Method naming conventions:
1335
1335
 
1336
1336
  ```JS
1337
1337
  {
1338
- 'open': { 'url': 'http://requestb.in' }
1338
+ 'open': { 'url': 'http://requestb.in', 'urls': ['trackclick.com'] }
1339
1339
  }
1340
1340
  ```
1341
1341
 
@@ -1355,7 +1355,7 @@ Method naming conventions:
1355
1355
 
1356
1356
  ```JS
1357
1357
  {
1358
- 'open': { 'url': 'http://requestb.in' }
1358
+ 'open': { 'url': 'http://requestb.in', 'urls': ['http://requestb.in'] }
1359
1359
  }
1360
1360
  ```
1361
1361
 
@@ -1392,10 +1392,24 @@ Method naming conventions:
1392
1392
 
1393
1393
  ```JS
1394
1394
  {
1395
- 'open': { 'url': 'http://requestb.in' }
1395
+ 'open': { 'url': 'http://requestb.in', 'urls': ['http://requestb.in'] }
1396
1396
  }
1397
1397
  ```
1398
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
+
1399
1413
  - #### destroy
1400
1414
 
1401
1415
  `mg.webhooks.destroy(domain, id)`
@@ -1412,7 +1426,7 @@ Method naming conventions:
1412
1426
 
1413
1427
  ```JS
1414
1428
  {
1415
- 'open': { 'url': 'http://requestb.in' }
1429
+ 'open': { 'url': 'http://requestb.in', 'urls': ['http://requestb.in']}
1416
1430
  }
1417
1431
  ```
1418
1432
 
@@ -25,5 +25,9 @@ export type WebhookValidationResponse = {
25
25
  };
26
26
  export type WebhookResult = {
27
27
  id: string;
28
+ /**
29
+ * @deprecated url property is deprecated. Use "urls" instead.
30
+ */
28
31
  url: string | undefined;
32
+ urls: string[];
29
33
  };