mailgun.js 3.6.1 → 3.7.3

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.
Files changed (69) hide show
  1. package/.eslintrc +8 -6
  2. package/CHANGELOG.md +18 -0
  3. package/README.md +334 -0
  4. package/dist/index.d.ts +2 -2
  5. package/dist/lib/client.d.ts +2 -2
  6. package/dist/lib/events.d.ts +9 -25
  7. package/dist/lib/interfaces/APIErrorOptions.d.ts +2 -1
  8. package/dist/lib/interfaces/ApiResponse.d.ts +2 -1
  9. package/dist/lib/interfaces/Events.d.ts +24 -0
  10. package/dist/lib/interfaces/IFormData.d.ts +4 -12
  11. package/dist/lib/interfaces/IpPools.d.ts +12 -0
  12. package/dist/lib/interfaces/Options.d.ts +2 -1
  13. package/dist/lib/interfaces/RequestOptions.d.ts +2 -1
  14. package/dist/lib/interfaces/StatsOptions.d.ts +2 -1
  15. package/dist/lib/interfaces/lists.d.ts +1 -1
  16. package/dist/lib/interfaces/mailListMembers.d.ts +6 -6
  17. package/dist/lib/ip-pools.d.ts +11 -14
  18. package/dist/lib/ips.d.ts +6 -6
  19. package/dist/lib/messages.d.ts +1 -1
  20. package/dist/lib/request.d.ts +4 -3
  21. package/dist/lib/suppressions.d.ts +1 -1
  22. package/dist/mailgun.node.js +2 -2
  23. package/dist/mailgun.node.js.LICENSE.txt +1 -1
  24. package/dist/mailgun.web.js +2 -2
  25. package/dist/mailgun.web.js.LICENSE.txt +1 -1
  26. package/examples/addresses.js +1 -0
  27. package/examples/list-domains.js +1 -0
  28. package/examples/send-email.js +1 -0
  29. package/index.ts +3 -3
  30. package/lib/client.ts +4 -3
  31. package/lib/events.ts +21 -19
  32. package/lib/interfaces/APIErrorOptions.ts +3 -1
  33. package/lib/interfaces/ApiResponse.ts +3 -1
  34. package/lib/interfaces/Events.ts +25 -0
  35. package/lib/interfaces/IFormData.ts +5 -14
  36. package/lib/interfaces/IpPools.ts +16 -1
  37. package/lib/interfaces/Ips.ts +1 -0
  38. package/lib/interfaces/Options.ts +5 -2
  39. package/lib/interfaces/RequestOptions.ts +4 -2
  40. package/lib/interfaces/StatsOptions.ts +4 -2
  41. package/lib/interfaces/Supressions.ts +1 -1
  42. package/lib/interfaces/lists.ts +2 -1
  43. package/lib/interfaces/mailListMembers.ts +18 -12
  44. package/lib/interfaces/routes.ts +1 -0
  45. package/lib/ip-pools.ts +8 -7
  46. package/lib/ips.ts +3 -3
  47. package/lib/lists.ts +1 -1
  48. package/lib/messages.ts +1 -1
  49. package/lib/parse.ts +4 -3
  50. package/lib/request.ts +18 -8
  51. package/lib/stats.ts +3 -2
  52. package/lib/suppressions.ts +16 -11
  53. package/lib/validate.ts +0 -1
  54. package/package.json +6 -6
  55. package/test/client.test.ts +9 -3
  56. package/test/domains.test.ts +2 -1
  57. package/test/events.test.ts +3 -2
  58. package/test/ips.test.ts +3 -2
  59. package/test/lists.test.ts +7 -7
  60. package/test/mailListMembers.test.ts +49 -43
  61. package/test/messageAttachment.test.ts +5 -4
  62. package/test/messages.test.ts +3 -2
  63. package/test/parse.test.ts +3 -2
  64. package/test/request.test.ts +6 -5
  65. package/test/routes.test.ts +3 -1
  66. package/test/stats.test.ts +2 -1
  67. package/test/suppressions.test.ts +6 -4
  68. package/test/validate.test.ts +2 -1
  69. package/test/webhooks.test.ts +2 -1
package/.eslintrc CHANGED
@@ -9,10 +9,6 @@
9
9
  "extends": [
10
10
  "airbnb-base"
11
11
  ],
12
- "plugins": [
13
- "eslint-plugin-tsdoc",
14
- "@typescript-eslint"
15
- ],
16
12
  "parserOptions": {
17
13
  "ecmaVersion": 12
18
14
  },
@@ -34,7 +30,8 @@
34
30
  "class-methods-use-this": 0,
35
31
  "prefer-destructuring": 0,
36
32
  "import/extensions": 0,
37
- "lines-between-class-members": ["error", "always", { "exceptAfterSingleLine": true }]
33
+ "lines-between-class-members": ["error", "always", { "exceptAfterSingleLine": true }],
34
+ "import/no-extraneous-dependencies" :["error", {"devDependencies": true, "optionalDependencies": false, "peerDependencies": false}]
38
35
  },
39
36
  "overrides": [
40
37
  {
@@ -46,7 +43,12 @@
46
43
  "parser": "@typescript-eslint/parser",
47
44
  "rules": {
48
45
  "import/extensions": 0
49
- }
46
+ // "import/no-extraneous-dependencies" :["error", {"devDependencies": true, "optionalDependencies": false, "peerDependencies": false}]
47
+ },
48
+ "plugins": [
49
+ "eslint-plugin-tsdoc",
50
+ "@typescript-eslint"
51
+ ]
50
52
  }
51
53
  ]
52
54
  }
package/CHANGELOG.md CHANGED
@@ -2,6 +2,24 @@
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.3](https://github.com/mailgun/mailgun.js/compare/v3.7.2...v3.7.3) (2021-11-10)
6
+
7
+ ### [3.7.2](https://github.com/mailgun/mailgun-js/compare/v3.7.1...v3.7.2) (2021-10-28)
8
+
9
+ ### [3.7.1](https://github.com/mailgun/mailgun-js/compare/v3.7.0...v3.7.1) (2021-10-28)
10
+
11
+
12
+ ### Bug Fixes
13
+
14
+ * Fix TS2345 error ([e20b8d7](https://github.com/mailgun/mailgun-js/commits/e20b8d7fd03cc94fd49a1c82b4936d5b115024a3))
15
+
16
+ ## [3.7.0](https://github.com/mailgun/mailgun-js/compare/v3.6.1...v3.7.0) (2021-10-20)
17
+
18
+
19
+ ### Features
20
+
21
+ * Fix linter errors ([126ba03](https://github.com/mailgun/mailgun-js/commits/126ba039bccfbdb257ddde7d17a58790e4cd30a3))
22
+
5
23
  ### [3.6.1](https://github.com/mailgun/mailgun-js/compare/v3.6.0...v3.6.1) (2021-10-18)
6
24
 
7
25
 
package/README.md CHANGED
@@ -104,6 +104,19 @@ The following service methods are available to instantiated clients. The example
104
104
  - [get](#get-5)
105
105
  - [parse](#parse)
106
106
  - [get](#get-6)
107
+ - [lists](#lists)
108
+ - [list](#list-4)
109
+ - [get](#get-7)
110
+ - [create](#create-5)
111
+ - [update](#update-2)
112
+ - [destroy](#destroy-3)
113
+ - [mailListMembers](#maillistmembers)
114
+ - [listMembers](#listmember)
115
+ - [getMember](#getmember)
116
+ - [createMember](#createmember)
117
+ - [createMembers](#createmembers)
118
+ - [updateMember](#updatemember)
119
+ - [destroyMember](#destroymember)
107
120
  - [Browser Demo](#browser-demo)
108
121
  - [Development](#development)
109
122
  - [Requirements](#requirements)
@@ -1363,6 +1376,327 @@ Promise Returns: response body
1363
1376
  }
1364
1377
  ```
1365
1378
 
1379
+ ### lists
1380
+
1381
+ A client to manage mailing lists.
1382
+
1383
+ #### list
1384
+
1385
+ `mg.lists.list()`
1386
+
1387
+ Example:
1388
+
1389
+ ```js
1390
+ mg.lists.list()
1391
+ .then(data => console.log(data)) // logs response body
1392
+ .catch(err => console.log(err)); // logs any error
1393
+ ```
1394
+
1395
+ Promise Returns: response body
1396
+
1397
+ ```
1398
+ [
1399
+ {
1400
+ access_level: 'readonly',
1401
+ address: 'noreply@sample.com',
1402
+ created_at: 'Wed, 27 Oct 2021 21:59:21 -0000',
1403
+ description: '',
1404
+ members_count: 0,
1405
+ name: '',
1406
+ reply_preference: 'list'
1407
+ }
1408
+ ]
1409
+ ```
1410
+
1411
+ #### get
1412
+
1413
+ `mg.lists.get(mailListAddress)`
1414
+
1415
+ Example:
1416
+
1417
+ ```js
1418
+ mg.lists.get('noreply@sample.com')
1419
+ .then(data => console.log(data)) // logs response body
1420
+ .catch(err => console.log(err)); // logs any error
1421
+ ```
1422
+
1423
+ Promise Returns: response body
1424
+
1425
+ ```
1426
+ {
1427
+ access_level: 'readonly',
1428
+ address: 'noreply@sample.com',
1429
+ created_at: 'Thu, 28 Oct 2021 00:16:56 -0000',
1430
+ description: '',
1431
+ members_count: 0,
1432
+ name: '',
1433
+ reply_preference: 'list'
1434
+ }
1435
+ ```
1436
+
1437
+ #### create
1438
+
1439
+ `mg.lists.create(data)`
1440
+
1441
+ Example:
1442
+
1443
+ ```js
1444
+ mg.lists.create({
1445
+ address: 'reply@sample.com',
1446
+ name: 'Reply Address', // optional, modifiable on website
1447
+ description: 'Mailing lists for repliable address', // optional, modifiable on website
1448
+ access_level: 'readonly', // optional, modifiable on website
1449
+ reply_preference: 'list', // optional, modifiable on website
1450
+ })
1451
+ .then(data => console.log(data)) // logs response body
1452
+ .catch(err => console.log(err)); // logs any error
1453
+ ```
1454
+
1455
+ Promise Returns: response body
1456
+
1457
+ ```
1458
+ {
1459
+ access_level: 'readonly',
1460
+ address: 'reply@sample.com',
1461
+ created_at: 'Thu, 28 Oct 2021 03:12:17 -0000',
1462
+ description: 'Mailing lists for repliable address',
1463
+ members_count: 0,
1464
+ name: 'Reply Address',
1465
+ reply_preference: 'list'
1466
+ }
1467
+ ```
1468
+
1469
+ #### update
1470
+
1471
+ `mg.lists.update(mailListAddress)`
1472
+
1473
+ Example:
1474
+
1475
+ ```js
1476
+ mg.lists.update('reply@sample.com', {
1477
+ address: 'foo@sample.com',
1478
+ name: 'Foo', // optional, modifiable on website
1479
+ description: 'Foo bar bat', // optional, modifiable on website
1480
+ access_level: 'members', // optional, modifiable on website
1481
+ reply_preference: 'sender', // optional, modifiable on website
1482
+ })
1483
+ .then(data => console.log(data)) // logs response body
1484
+ .catch(err => console.log(err)); // logs any error
1485
+ ```
1486
+
1487
+ Promise Returns: response body
1488
+
1489
+ ```
1490
+ {
1491
+ access_level: 'members',
1492
+ address: 'foo@sample.com',
1493
+ created_at: 'Thu, 28 Oct 2021 03:21:15 -0000',
1494
+ description: 'Foo bar bat',
1495
+ members_count: 0,
1496
+ name: 'Foo',
1497
+ reply_preference: 'sender'
1498
+ }
1499
+ ```
1500
+
1501
+ #### destroy
1502
+
1503
+ `mg.lists.destroy(mailListAddress)`
1504
+
1505
+ Example:
1506
+
1507
+ ```js
1508
+ mg.lists.destroy('foo@sample.com')
1509
+ .then(data => console.log(data)) // logs response body
1510
+ .catch(err => console.log(err)); // logs any error
1511
+ ```
1512
+
1513
+ Promise Returns: response body
1514
+
1515
+ ```
1516
+ {
1517
+ address: 'foo@sample.com',
1518
+ message: 'Mailing list has been removed'
1519
+ }
1520
+ ```
1521
+
1522
+ ### mailListMembers
1523
+
1524
+ A client to manage members within a specific mailing list.
1525
+
1526
+ #### listMembers
1527
+
1528
+ `mg.lists.members.listMembers(mailListAddress)`
1529
+
1530
+ Example:
1531
+
1532
+ ```js
1533
+ mg.lists.members.listMembers('reply@sample.com')
1534
+ .then(data => console.log(data)) // logs response body
1535
+ .catch(err => console.log(err)); // logs any error
1536
+ ```
1537
+
1538
+ Promise Returns: response body
1539
+
1540
+ ```
1541
+ [
1542
+ {
1543
+ address: 'foo@bar.com',
1544
+ name: 'Jane Doe',
1545
+ subscribed: true,
1546
+ vars: { age: 50 }
1547
+ }
1548
+ ]
1549
+ ```
1550
+
1551
+ #### getMember
1552
+
1553
+ `mg.lists.members.getMember(mailListAddress, mailListMemberAddress)`
1554
+
1555
+ Example:
1556
+
1557
+ ```js
1558
+ mg.lists.members.getMember('reply@sample.com', 'foo@bar.com')
1559
+ .then(data => console.log(data)) // logs response body
1560
+ .catch(err => console.log(err)); // logs any error
1561
+ ```
1562
+
1563
+ Promise Returns: response body
1564
+
1565
+ ```
1566
+ {
1567
+ address: 'foo@bar.com',
1568
+ name: 'Jane Doe',
1569
+ subscribed: true,
1570
+ vars: { age: 50 }
1571
+ }
1572
+ ```
1573
+
1574
+ #### createMember
1575
+
1576
+ `mg.lists.members.createMember(mailListAddress, data)`
1577
+
1578
+ Example:
1579
+
1580
+ ```js
1581
+ mg.lists.members.createMember('reply@sample.com', {
1582
+ address: 'bat@bar.com',
1583
+ name: 'John Smith', // optional, modifiable on website
1584
+ vars: {hobby: "chess"}, // optional, modifiable on website
1585
+ subscribed: 'no', // optional, modifiable on website
1586
+ upsert: 'yes', // optional, choose yes to insert if not exist, or update it exist
1587
+ })
1588
+ .then(data => console.log(data)) // logs response body
1589
+ .catch(err => console.log(err)); // logs any error
1590
+ ```
1591
+
1592
+ Promise Returns: response body
1593
+
1594
+ ```
1595
+ {
1596
+ address: 'bat@bar.com',
1597
+ name: 'John Smith',
1598
+ subscribed: false,
1599
+ vars: { hobby: 'chess' }
1600
+ }
1601
+ ```
1602
+
1603
+ #### createMembers
1604
+
1605
+ `mg.lists.members.createMembers(mailListAddress, data)`
1606
+
1607
+ Example:
1608
+
1609
+ ```js
1610
+ mg.lists.members.createMembers('reply@sample.com', {
1611
+ members: [
1612
+ {
1613
+ address: "bot1@foobar.com",
1614
+ name: "Bot1 Superbot",
1615
+ vars: {location: "loc1"},
1616
+ subscribed: true,
1617
+ },
1618
+ {
1619
+ address: "bot2@foobar.com",
1620
+ name: "Bot2 Superbot",
1621
+ vars: {location: "loc2"},
1622
+ subscribed: false,
1623
+ },
1624
+ ],
1625
+ upsert: "yes",
1626
+ })
1627
+ .then(data => console.log(data)) // logs response body
1628
+ .catch(err => console.log(err)); // logs any error
1629
+ ```
1630
+
1631
+ Promise Returns: response body
1632
+
1633
+ ```
1634
+ {
1635
+ list: {
1636
+ access_level: 'readonly',
1637
+ address: 'reply@sample.com',
1638
+ created_at: 'Thu, 28 Oct 2021 03:21:15 -0000',
1639
+ description: 'For reply purpose',
1640
+ members_count: 2,
1641
+ name: 'Reply',
1642
+ reply_preference: 'list'
1643
+ },
1644
+ message: 'Mailing list has been updated',
1645
+ 'task-id': '575b943c37a211ec8a520242ac11000a'
1646
+ }
1647
+ ```
1648
+
1649
+ #### updateMember
1650
+
1651
+ `mg.lists.members.updateMember(mailListAddress, mailListMemberAddress, data)`
1652
+
1653
+ Example:
1654
+
1655
+ ```js
1656
+ mg.lists.members.updateMember('reply@sample.com', 'bot1@foobar.com', {
1657
+ address: 'bot0@barfoo.com',
1658
+ name: 'Bot0 Normalbot', // optional, modifiable on website
1659
+ vars: {location: "space"},
1660
+ subscribed: false,
1661
+ })
1662
+ .then(data => console.log(data)) // logs response body
1663
+ .catch(err => console.log(err)); // logs any error
1664
+ ```
1665
+
1666
+ Promise Returns: response body
1667
+
1668
+ ```
1669
+ {
1670
+ address: 'bot0@barfoo.com',
1671
+ name: 'Bot0 Normalbot',
1672
+ subscribed: false,
1673
+ vars: { location: 'space' }
1674
+ }
1675
+ ```
1676
+
1677
+ #### destroyMember
1678
+
1679
+ `mg.lists.members.destroyMember(mailListAddress, mailListMemberAddress)`
1680
+
1681
+ Example:
1682
+
1683
+ ```js
1684
+ mg.lists.members.destroyMember('reply@sample.com', 'bot2@foobar.com')
1685
+ .then(data => console.log(data)) // logs response body
1686
+ .catch(err => console.log(err)); // logs any error
1687
+ ```
1688
+
1689
+ Promise Returns: response body
1690
+
1691
+ ```
1692
+ {
1693
+ member: { address: 'bot2@foobar.com' },
1694
+ message: 'Mailing list member has been deleted'
1695
+ }
1696
+ ```
1697
+
1698
+
1699
+
1366
1700
  ## Browser Demo
1367
1701
 
1368
1702
  ![image](https://cloud.githubusercontent.com/assets/399776/10718632/e8fe56e4-7b34-11e5-84c8-cfcfde978711.png)
package/dist/index.d.ts CHANGED
@@ -1,9 +1,9 @@
1
1
  import Client from './lib/client';
2
+ import { InputFormData } from './lib/interfaces/IFormData';
2
3
  import Options from './lib/interfaces/Options';
3
- import IFormData from './lib/interfaces/IFormData';
4
4
  declare class Mailgun {
5
5
  private formData;
6
- constructor(FormData: new (...args: any[]) => IFormData);
6
+ constructor(FormData: InputFormData);
7
7
  client(options: Options): Client;
8
8
  }
9
9
  export = Mailgun;
@@ -12,7 +12,7 @@ import ParseClient from './parse';
12
12
  import IpsClient from './ips';
13
13
  import IpPoolsClient from './ip-pools';
14
14
  import ListsClient from './lists';
15
- import IFormData from './interfaces/IFormData';
15
+ import { InputFormData } from './interfaces/IFormData';
16
16
  export default class Client {
17
17
  private request;
18
18
  domains: DomainClient;
@@ -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: any[]) => IFormData);
31
+ constructor(options: Options, formData: InputFormData);
32
32
  }
@@ -1,29 +1,13 @@
1
- declare const MgRequest: any;
1
+ import { EventsList, EventsPage, EventsResponse, PagesList } from './interfaces/Events';
2
+ import Request from './request';
2
3
  export default class EventClient {
3
- request: typeof MgRequest;
4
- constructor(request: typeof MgRequest);
4
+ request: Request;
5
+ constructor(request: Request);
5
6
  _parsePageNumber(url: string): string;
6
- _parsePage(id: string, url: string): {
7
- id: string;
8
- number: string;
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: any;
27
- }): any;
11
+ page: string;
12
+ }): Promise<EventsList>;
28
13
  }
29
- export {};
@@ -1,4 +1,4 @@
1
- export default interface APIErrorOptions {
1
+ interface APIErrorOptions {
2
2
  headers: {
3
3
  [key: string]: any;
4
4
  };
@@ -8,3 +8,4 @@ export default interface APIErrorOptions {
8
8
  url: string;
9
9
  statusText: string;
10
10
  }
11
+ export default APIErrorOptions;
@@ -1,4 +1,5 @@
1
- export default interface APIResponse {
1
+ interface APIResponse {
2
2
  status: number;
3
3
  body: any;
4
4
  }
5
+ export default APIResponse;
@@ -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
+ }
@@ -1,15 +1,7 @@
1
- interface Headers {
1
+ import NodeFormData from 'form-data';
2
+ export interface IFormDataOptions {
2
3
  [key: string]: any;
3
4
  }
4
- interface AppendOptions {
5
- header?: string | Headers;
6
- knownLength?: number;
7
- filename?: string;
8
- filepath?: string;
9
- contentType?: string;
5
+ export interface InputFormData {
6
+ new (options?: HTMLFormElement | IFormDataOptions): NodeFormData | FormData;
10
7
  }
11
- export default abstract class IFormData {
12
- constructor();
13
- abstract append(key: string, value: any, options?: AppendOptions | string): void;
14
- }
15
- export {};
@@ -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,7 +1,8 @@
1
- export default interface Options {
1
+ interface Options {
2
2
  username: string;
3
3
  key: string;
4
4
  url?: string;
5
5
  public_key?: string;
6
6
  timeout?: number;
7
7
  }
8
+ export default Options;
@@ -1,5 +1,6 @@
1
1
  import Options from './Options';
2
- export default interface RequestOptions extends Options {
2
+ interface RequestOptions extends Options {
3
3
  headers: any;
4
4
  timeout: number;
5
5
  }
6
+ export default RequestOptions;
@@ -1,4 +1,4 @@
1
- export default interface StatsOptions {
1
+ interface StatsOptions {
2
2
  start: string | Date;
3
3
  end: string | Date;
4
4
  resolution: string;
@@ -11,3 +11,4 @@ export default interface StatsOptions {
11
11
  };
12
12
  }[];
13
13
  }
14
+ export default StatsOptions;
@@ -7,7 +7,7 @@ export interface CreateUpdateList {
7
7
  address: string;
8
8
  name?: string;
9
9
  description?: string;
10
- access_level?: 'read-only' | 'members' | 'everyone';
10
+ access_level?: 'readonly' | 'members' | 'everyone';
11
11
  reply_preference?: 'list' | 'sender';
12
12
  }
13
13
  export interface DestroyedList {
@@ -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;
@@ -1,24 +1,21 @@
1
- declare const MgRequest: any;
2
- import { IpPool } from "./interfaces/IpPools";
1
+ import Request from './request';
2
+ import { IpPool, IpPoolUpdateData } from './interfaces/IpPools';
3
3
  export default class IpPoolsClient {
4
- request: typeof MgRequest;
5
- constructor(request: typeof MgRequest);
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
- }): any;
12
- update(poolId: string, data: {
13
- name: string;
14
- description: string;
15
- add_ip: string;
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
- declare const MgRequest: any;
1
+ import MgRequest from './request';
2
+ import { IpData, IpsListResponseBody } from './interfaces/Ips';
2
3
  export default class IpsClient {
3
- request: typeof MgRequest;
4
- constructor(request: typeof MgRequest);
5
- list(query: any): any;
6
- get(ip: string): any;
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 {};
@@ -1,4 +1,4 @@
1
- import Request from "./request";
1
+ import Request from './request';
2
2
  export default class MessagesClient {
3
3
  request: Request;
4
4
  constructor(request: Request);