mailgun.js 3.6.0 → 3.7.2

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 (72) hide show
  1. package/.eslintrc +25 -12
  2. package/CHANGELOG.md +24 -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 +3 -4
  55. package/test/client.test.ts +9 -3
  56. package/test/domains.test.ts +2 -1
  57. package/test/events.test.ts +3 -3
  58. package/test/ips.test.ts +4 -2
  59. package/test/lists.test.ts +7 -8
  60. package/test/mailListMembers.test.ts +49 -44
  61. package/test/messageAttachment.test.ts +5 -5
  62. package/test/messages.test.ts +3 -2
  63. package/test/parse.test.ts +4 -3
  64. package/test/request.test.ts +6 -5
  65. package/test/routes.test.ts +3 -1
  66. package/test/stats.test.ts +3 -2
  67. package/test/suppressions.test.ts +14 -11
  68. package/test/validate.test.ts +3 -2
  69. package/test/webhooks.test.ts +3 -3
  70. package/webpack/webpack.common.config.js +1 -2
  71. package/webpack/webpack.dev.config.js +1 -2
  72. package/webpack/webpack.release.config.js +2 -3
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);
@@ -1,5 +1,6 @@
1
+ import NodeFormData from 'form-data';
1
2
  import RequestOptions from './interfaces/RequestOptions';
2
- import IFormData from './interfaces/IFormData';
3
+ import { InputFormData } from './interfaces/IFormData';
3
4
  import APIResponse from './interfaces/ApiResponse';
4
5
  declare class Request {
5
6
  private username;
@@ -8,7 +9,7 @@ declare class Request {
8
9
  private timeout;
9
10
  private headers;
10
11
  private formData;
11
- constructor(options: RequestOptions, formData: new () => IFormData);
12
+ constructor(options: RequestOptions, formData: InputFormData);
12
13
  request(method: string, url: string, inputOptions?: any): Promise<APIResponse>;
13
14
  query(method: string, url: string, query: any, options?: any): Promise<APIResponse>;
14
15
  command(method: string, url: string, data: any, options?: any): Promise<APIResponse>;
@@ -18,7 +19,7 @@ declare class Request {
18
19
  post(url: string, data: any, options?: any): Promise<APIResponse>;
19
20
  postWithFD(url: string, data: any): Promise<APIResponse>;
20
21
  putWithFD(url: string, data: any): Promise<APIResponse>;
21
- createFormData(data: any): IFormData;
22
+ createFormData(data: any): NodeFormData | FormData;
22
23
  put(url: string, data: any, options?: any): Promise<APIResponse>;
23
24
  patch(url: string, data: any, options?: any): Promise<APIResponse>;
24
25
  delete(url: string, data?: any, options?: any): Promise<APIResponse>;
@@ -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: {