mailgun.js 4.0.0 → 4.1.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.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,34 @@
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
+ ### [4.1.2](https://github.com/mailgun/mailgun.js/compare/v4.1.1...v4.1.2) (2021-12-14)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * Update stats methods to allow an array of events ([#216](https://github.com/mailgun/mailgun.js/issues/216)) ([3b0fc41](https://github.com/mailgun/mailgun.js/commits/3b0fc411a4fa34a27cfd255a914adb17499f3af6))
11
+
12
+ ### [4.1.1](https://github.com/mailgun/mailgun.js/compare/v4.1.0...v4.1.1) (2021-12-13)
13
+
14
+
15
+ ### Bug Fixes
16
+
17
+ * Ip_pools create and update methods fix ([#215](https://github.com/mailgun/mailgun.js/issues/215)) ([eb1830d](https://github.com/mailgun/mailgun.js/commits/eb1830de472737c0b3dc6a4cb8856f73b52d20c2))
18
+
19
+ ## [4.1.0](https://github.com/mailgun/mailgun.js/compare/v4.0.1...v4.1.0) (2021-11-30)
20
+
21
+
22
+ ### Features
23
+
24
+ * Add support of whitelists into suppressions client ([#214](https://github.com/mailgun/mailgun.js/issues/214)) ([1e4fb84](https://github.com/mailgun/mailgun.js/commits/1e4fb84d2528751a9c2dddd1599d2bc0e12b1fdd))
25
+
26
+ ### [4.0.1](https://github.com/mailgun/mailgun.js/compare/v4.0.0...v4.0.1) (2021-11-25)
27
+
28
+
29
+ ### Bug Fixes
30
+
31
+ * Fixes handling of mime messages ([#213](https://github.com/mailgun/mailgun.js/issues/213)) ([ad43490](https://github.com/mailgun/mailgun.js/commits/ad43490a562b95cb77e38cb66f71ef13a4da8331))
32
+
5
33
  ## [4.0.0](https://github.com/mailgun/mailgun.js/compare/v3.7.3...v4.0.0) (2021-11-18)
6
34
 
7
35
 
@@ -1,14 +1,21 @@
1
- interface StatsOptions {
1
+ export interface Stat {
2
+ time: string | Date;
3
+ delivered: {
4
+ smtp: number;
5
+ http: number;
6
+ total: number;
7
+ };
8
+ }
9
+ export interface StatsOptions {
2
10
  start: string | Date;
3
11
  end: string | Date;
4
12
  resolution: string;
5
- stats: {
6
- time: string | Date;
7
- delivered: {
8
- smtp: number;
9
- http: number;
10
- total: number;
11
- };
12
- }[];
13
+ stats: Stat[];
14
+ }
15
+ export interface StatsQuery {
16
+ event: string | string[];
17
+ start: string | Date;
18
+ end: string | Date;
19
+ resolution: 'hour' | 'day' | 'month';
20
+ duration: string;
13
21
  }
14
- export default StatsOptions;
@@ -13,3 +13,9 @@ export interface UnsubscribeData {
13
13
  tags: any;
14
14
  created_at: string | Date;
15
15
  }
16
+ export interface WhiteListData {
17
+ type: string;
18
+ value: string;
19
+ reason: string;
20
+ createdAt: string | Date;
21
+ }
@@ -8,7 +8,7 @@ declare class Request {
8
8
  private url;
9
9
  private timeout;
10
10
  private headers;
11
- private formData;
11
+ private FormDataConstructor;
12
12
  constructor(options: RequestOptions, formData: InputFormData);
13
13
  request(method: string, url: string, inputOptions?: any): Promise<APIResponse>;
14
14
  query(method: string, url: string, query: any, options?: any): Promise<APIResponse>;
@@ -19,7 +19,11 @@ declare class Request {
19
19
  post(url: string, data: any, options?: any): Promise<APIResponse>;
20
20
  postWithFD(url: string, data: any): Promise<APIResponse>;
21
21
  putWithFD(url: string, data: any): Promise<APIResponse>;
22
+ patchWithFD(url: string, data: any): Promise<APIResponse>;
22
23
  createFormData(data: any): NodeFormData | FormData;
24
+ private addMimeDataToFD;
25
+ private addFilesToFD;
26
+ private addCommonPropertyToFD;
23
27
  put(url: string, data: any, options?: any): Promise<APIResponse>;
24
28
  patch(url: string, data: any, options?: any): Promise<APIResponse>;
25
29
  delete(url: string, data?: any, options?: any): Promise<APIResponse>;
@@ -1,19 +1,20 @@
1
1
  import Request from './request';
2
- import StatsOptions from './interfaces/StatsOptions';
2
+ import { StatsQuery, StatsOptions, Stat } from './interfaces/StatsOptions';
3
3
  declare class Stats {
4
4
  start: Date;
5
5
  end: Date;
6
6
  resolution: string;
7
- stats: any;
7
+ stats: Stat[];
8
8
  constructor(data: StatsOptions);
9
9
  }
10
10
  export default class StatsClient {
11
11
  request: Request;
12
12
  constructor(request: Request);
13
+ private prepareSearchParams;
13
14
  _parseStats(response: {
14
15
  body: StatsOptions;
15
16
  }): Stats;
16
- getDomain(domain: string, query: any): Promise<Stats>;
17
- getAccount(query: any): Promise<Stats>;
17
+ getDomain(domain: string, query?: StatsQuery): Promise<Stats>;
18
+ getAccount(query?: StatsQuery): Promise<Stats>;
18
19
  }
19
20
  export {};
@@ -1,5 +1,5 @@
1
1
  import Request from './request';
2
- import { BounceData, ComplaintData, UnsubscribeData } from './interfaces/Supressions';
2
+ import { BounceData, ComplaintData, UnsubscribeData, WhiteListData } from './interfaces/Supressions';
3
3
  declare class Bounce {
4
4
  type: string;
5
5
  address: string;
@@ -21,13 +21,21 @@ declare class Unsubscribe {
21
21
  created_at: Date;
22
22
  constructor(data: UnsubscribeData);
23
23
  }
24
- declare type TModel = typeof Bounce | typeof Complaint | typeof Unsubscribe;
24
+ declare class WhiteList {
25
+ type: string;
26
+ value: string;
27
+ reason: string;
28
+ createdAt: Date;
29
+ constructor(data: WhiteListData);
30
+ }
31
+ declare type TModel = typeof Bounce | typeof Complaint | typeof Unsubscribe | typeof WhiteList;
25
32
  export default class SuppressionClient {
26
33
  request: any;
27
34
  models: {
28
35
  bounces: typeof Bounce;
29
36
  complaints: typeof Complaint;
30
37
  unsubscribes: typeof Unsubscribe;
38
+ whitelists: typeof WhiteList;
31
39
  };
32
40
  constructor(request: Request);
33
41
  _parsePage(id: string, pageUrl: string): {
@@ -49,7 +57,8 @@ export default class SuppressionClient {
49
57
  }, Model: TModel): any;
50
58
  _parseItem(response: {
51
59
  body: any;
52
- }, Model: TModel): Bounce | Complaint | Unsubscribe;
60
+ }, Model: TModel): Bounce | Complaint | Unsubscribe | WhiteList;
61
+ private createWhiteList;
53
62
  list(domain: string, type: string, query: any): any;
54
63
  get(domain: string, type: string, address: string): any;
55
64
  create(domain: string, type: string, data: any): any;