mailgun.js 5.1.0 → 5.2.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,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
+ ### [5.2.2](https://github.com/mailgun/mailgun.js/compare/v5.2.1...v5.2.2) (2022-04-22)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * Fix parsing of a response body with json data ([d57671f](https://github.com/mailgun/mailgun.js/commits/d57671f0b0af0c24e64684697e3f5d9001fa43cd))
11
+ * Update message type. Update readme file ([dd22ec0](https://github.com/mailgun/mailgun.js/commits/dd22ec0588b7ddcf04f2f96f6b109502446f766c))
12
+ * Update query parameter type for events get method ([1705a1f](https://github.com/mailgun/mailgun.js/commits/1705a1f34f855d53471548646dda44dbdd0d6338))
13
+ * Update response handler to support string response ([6e0f305](https://github.com/mailgun/mailgun.js/commits/6e0f3053e2ffe9dec25dd6fa8cfe19140be626ad))
14
+
15
+ ### [5.2.1](https://github.com/mailgun/mailgun.js/compare/v5.2.0...v5.2.1) (2022-04-14)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+ * Remove invalid StatsEvent types ([61ac971](https://github.com/mailgun/mailgun.js/commits/61ac97132c384d493f84784a5daae91831bccf75))
21
+
22
+ ## [5.2.0](https://github.com/mailgun/mailgun.js/compare/v5.1.0...v5.2.0) (2022-04-11)
23
+
24
+
25
+ ### Features
26
+
27
+ * Add validation methods to mailing list client ([224790c](https://github.com/mailgun/mailgun.js/commits/224790c4c20466a2203856d703b51e7d4a03a195))
28
+
5
29
  ## [5.1.0](https://github.com/mailgun/mailgun.js/compare/v5.0.5...v5.1.0) (2022-04-08)
6
30
 
7
31
 
package/README.md CHANGED
@@ -135,7 +135,9 @@ Options:
135
135
 
136
136
  Parameter | Description
137
137
  :---------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
138
- to | Email address of the recipient(s). Example: "Bob <bob@host.com>". You can use commas to separate multiple recipients (e.g.: "test@example.com,test@example.com" or ["test@example.com", "test@example.com"]). Make sure to include all To, Cc and Bcc recipients of the message.
138
+ to | Email address of the recipient(s). Example: "Bob <bob@host.com>". You can use commas to separate multiple recipients (e.g.: "test@example.com,test@example.com" or ["test@example.com", "test@example.com"]).
139
+ cc | Same as `To` but for `carbon copy`
140
+ bcc | Same as `To` but for `blind carbon copy`
139
141
  html | HTML version of the message.
140
142
  text | Text version of the message.
141
143
  message | MIME string of the message. Make sure to use multipart/form-data to send this as a file upload.
package/events.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { EventsList, EventsPage, EventsResponse, ParsedPagesList } from './interfaces/Events';
1
+ import { EventsList, EventsPage, EventsQuery, EventsResponse, ParsedPagesList } from './interfaces/Events';
2
2
  import Request from './request';
3
3
  export default class EventClient {
4
4
  request: Request;
@@ -7,7 +7,5 @@ export default class EventClient {
7
7
  _parsePage(id: string, url: string): EventsPage;
8
8
  _parsePageLinks(response: EventsResponse): ParsedPagesList;
9
9
  _parseEventList(response: EventsResponse): EventsList;
10
- get(domain: string, query?: {
11
- page: string;
12
- }): Promise<EventsList>;
10
+ get(domain: string, query?: EventsQuery): Promise<EventsList>;
13
11
  }
@@ -3,6 +3,27 @@ export interface EventsPage {
3
3
  number: string;
4
4
  url: string;
5
5
  }
6
+ export interface FilterField {
7
+ event?: string;
8
+ list?: string;
9
+ attachment?: string;
10
+ from?: string;
11
+ 'message-id'?: string;
12
+ subject?: string;
13
+ to?: string;
14
+ size?: string;
15
+ recipient?: string;
16
+ recipients?: string;
17
+ tags?: string;
18
+ severity?: string;
19
+ }
20
+ export interface EventsQuery extends FilterField {
21
+ page?: string;
22
+ begin?: string;
23
+ end?: string;
24
+ ascending?: 'yes' | 'no';
25
+ limit?: number;
26
+ }
6
27
  export interface PagesList {
7
28
  previous: string;
8
29
  first: string;
@@ -8,7 +8,7 @@ export declare type MailgunMessageData = {
8
8
  *
9
9
  * @example `Bob <bob@host.com>`. You can use commas to separate multiple recipients.
10
10
  */
11
- to?: string;
11
+ to?: string | string[];
12
12
  /**
13
13
  * Same as `To` but for `carbon copy`
14
14
  */
@@ -12,7 +12,7 @@ export interface StatsOptions {
12
12
  resolution: string;
13
13
  stats: Stat[];
14
14
  }
15
- export declare type StatsEvent = 'accepted' | 'delivered' | 'opened' | 'clicked' | 'unsubscribed' | 'stored' | 'rejected' | 'complained' | 'failed-temporary' | 'failed-permanent';
15
+ export declare type StatsEvent = 'accepted' | 'delivered' | 'opened' | 'clicked' | 'unsubscribed' | 'stored' | 'complained' | 'failed';
16
16
  export interface StatsQuery {
17
17
  event: StatsEvent | StatsEvent[];
18
18
  start?: string | Date;
@@ -14,6 +14,50 @@ export interface DestroyedList {
14
14
  address: string;
15
15
  message: string;
16
16
  }
17
+ export interface StartValidationResult {
18
+ status: number;
19
+ id: string;
20
+ message: string;
21
+ }
22
+ export interface ValidationResponse {
23
+ status: string;
24
+ download_url: {
25
+ csv: string;
26
+ json: string;
27
+ };
28
+ id: string;
29
+ quantity: number;
30
+ records_processed: number;
31
+ summary: {
32
+ result: {
33
+ catch_all: number;
34
+ deliverable: number;
35
+ do_not_send: number;
36
+ undeliverable: number;
37
+ unknown: number;
38
+ };
39
+ risk: {
40
+ high: number;
41
+ low: number;
42
+ medium: number;
43
+ unknown: number;
44
+ };
45
+ };
46
+ }
47
+ export interface ValidationApiResponse extends ValidationResponse {
48
+ created_at: number;
49
+ }
50
+ export interface ValidationResultData extends ValidationResponse {
51
+ created_at: Date;
52
+ }
53
+ export interface ValidationResult {
54
+ status: number;
55
+ validationResult: ValidationResultData;
56
+ }
57
+ export interface CancelValidationResult {
58
+ status: number;
59
+ message: string;
60
+ }
17
61
  export interface MailingList {
18
62
  access_level: string;
19
63
  address: string;
package/lists.d.ts CHANGED
@@ -1,14 +1,18 @@
1
1
  import Request from './request';
2
- import { ListsQuery, CreateUpdateList, DestroyedList, MailingList } from './interfaces/lists';
2
+ import { ListsQuery, CreateUpdateList, DestroyedList, MailingList, StartValidationResult, ValidationResult, CancelValidationResult } from './interfaces/lists';
3
3
  import { IMailListsMembers } from './interfaces/mailListMembers';
4
4
  export default class ListsClient {
5
5
  baseRoute: string;
6
6
  request: Request;
7
7
  members: IMailListsMembers;
8
8
  constructor(request: Request, members: IMailListsMembers);
9
+ private parseValidationResult;
9
10
  list(query?: ListsQuery): Promise<MailingList[]>;
10
11
  get(mailListAddress: string): Promise<MailingList>;
11
12
  create(data: CreateUpdateList): Promise<MailingList>;
12
13
  update(mailListAddress: string, data: CreateUpdateList): Promise<MailingList>;
13
14
  destroy(mailListAddress: string): Promise<DestroyedList>;
15
+ validate(mailListAddress: string): Promise<StartValidationResult>;
16
+ validationResult(mailListAddress: string): Promise<ValidationResult>;
17
+ cancelValidation(mailListAddress: string): Promise<CancelValidationResult>;
14
18
  }