mailgun.js 5.2.1 → 6.0.1

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,44 @@
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
+ ### [6.0.1](https://github.com/mailgun/mailgun.js/compare/v6.0.0...v6.0.1) (2022-05-10)
6
+
7
+
8
+ ### Bug Fixes
9
+
10
+ * Remove file property handling as a file ([d1a8a14](https://github.com/mailgun/mailgun.js/commits/d1a8a14eb5b12ca38772f9414e068fd49a011bad))
11
+
12
+
13
+ ### Other changes
14
+
15
+ * Update tests ([52e443c](https://github.com/mailgun/mailgun.js/commits/52e443c20bd57c36e1b50aa1b8d930e160370ab6))
16
+
17
+ ## [6.0.0](https://github.com/mailgun/mailgun.js/compare/v5.2.2...v6.0.0) (2022-05-06)
18
+
19
+
20
+ ### ⚠ BREAKING CHANGES
21
+
22
+ * Update ip-pools client responses body shapes. Refactor of request.ts file
23
+
24
+ ### Breaking changes
25
+
26
+ * Update ip-pools client responses body shapes. Refactor of request.ts file ([0595d62](https://github.com/mailgun/mailgun.js/commits/0595d62eeba66caa98b19b048425385db982d2f0))
27
+
28
+
29
+ ### Other changes
30
+
31
+ * Add tests ([8590989](https://github.com/mailgun/mailgun.js/commits/859098970b21b84a1085cb8cf967db769f28ed0f))
32
+
33
+ ### [5.2.2](https://github.com/mailgun/mailgun.js/compare/v5.2.1...v5.2.2) (2022-04-22)
34
+
35
+
36
+ ### Bug Fixes
37
+
38
+ * Fix parsing of a response body with json data ([d57671f](https://github.com/mailgun/mailgun.js/commits/d57671f0b0af0c24e64684697e3f5d9001fa43cd))
39
+ * Update message type. Update readme file ([dd22ec0](https://github.com/mailgun/mailgun.js/commits/dd22ec0588b7ddcf04f2f96f6b109502446f766c))
40
+ * Update query parameter type for events get method ([1705a1f](https://github.com/mailgun/mailgun.js/commits/1705a1f34f855d53471548646dda44dbdd0d6338))
41
+ * Update response handler to support string response ([6e0f305](https://github.com/mailgun/mailgun.js/commits/6e0f3053e2ffe9dec25dd6fa8cfe19140be626ad))
42
+
5
43
  ### [5.2.1](https://github.com/mailgun/mailgun.js/compare/v5.2.0...v5.2.1) (2022-04-14)
6
44
 
7
45
 
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
  }
@@ -0,0 +1,14 @@
1
+ import * as NodeFormData from 'form-data';
2
+ import { InputFormData } from './interfaces/IFormData';
3
+ declare class FormDataBuilder {
4
+ private FormDataConstructor;
5
+ constructor(FormDataConstructor: InputFormData);
6
+ createFormData(data: any): NodeFormData | FormData;
7
+ private isNodeFormData;
8
+ private getAttachmentOptions;
9
+ private addMimeDataToFD;
10
+ private addFilesToFD;
11
+ private isStream;
12
+ private addCommonPropertyToFD;
13
+ }
14
+ export default FormDataBuilder;
@@ -1,11 +1,11 @@
1
- export interface DomainCredentialsQuery {
1
+ export declare type DomainCredentialsQuery = {
2
2
  limit: number;
3
3
  skip: number;
4
- }
5
- export interface DomainCredentials {
4
+ };
5
+ export declare type DomainCredentials = {
6
6
  login: string;
7
7
  password: string;
8
- }
8
+ };
9
9
  export interface DomainCredentialsItem {
10
10
  created_at: string;
11
11
  login: string;
@@ -41,9 +41,9 @@ export interface DeletedDomainCredentialsResponse {
41
41
  spec: string;
42
42
  };
43
43
  }
44
- export interface UpdateDomainCredentialsData {
44
+ export declare type UpdateDomainCredentialsData = {
45
45
  password: string;
46
- }
46
+ };
47
47
  export interface IDomainCredentials {
48
48
  list(domain: string, query: DomainCredentialsQuery): Promise<DomainCredentialsList>;
49
49
  create(domain: string, data: DomainCredentials): Promise<DomainCredentialsResult>;
@@ -4,16 +4,16 @@ export declare enum Resolution {
4
4
  DAY = "day",
5
5
  MONTH = "month"
6
6
  }
7
- export interface DomainTagsQuery {
7
+ export declare type DomainTagsQuery = {
8
8
  limit: number;
9
- }
10
- export interface DomainTagsStatisticQuery {
9
+ };
10
+ export declare type DomainTagsStatisticQuery = {
11
11
  event: string;
12
12
  start?: number;
13
13
  end?: number;
14
14
  resolution?: Resolution;
15
15
  duration?: string;
16
- }
16
+ };
17
17
  export interface DomainTagsItemInfo {
18
18
  tag: string;
19
19
  description: string;
@@ -9,37 +9,37 @@ export declare enum Pages {
9
9
  NEXT = "next",
10
10
  PREV = "prev"
11
11
  }
12
- export interface DomainTemplateData {
12
+ export declare type DomainTemplateData = {
13
13
  name: string;
14
14
  description: string;
15
15
  template: string;
16
16
  tag?: string;
17
17
  engine?: string;
18
18
  comment?: string;
19
- }
20
- export interface DomainTemplateVersionData {
19
+ };
20
+ export declare type DomainTemplateVersionData = {
21
21
  template: string;
22
22
  tag: string;
23
23
  engine?: string;
24
24
  comment?: string;
25
25
  active?: YesNo;
26
- }
27
- export interface DomainTemplateUpdateData {
26
+ };
27
+ export declare type DomainTemplateUpdateData = {
28
28
  description: string;
29
- }
30
- export interface DomainTemplateUpdateVersionData {
29
+ };
30
+ export declare type DomainTemplateUpdateVersionData = {
31
31
  template?: string;
32
32
  comment?: string;
33
33
  active?: YesNo;
34
- }
35
- export interface DomainTemplatesQuery {
34
+ };
35
+ export declare type DomainTemplatesQuery = {
36
36
  page: Pages;
37
37
  limit: number;
38
38
  p: string;
39
- }
40
- export interface TemplateQuery {
39
+ };
40
+ export declare type TemplateQuery = {
41
41
  active: YesNo;
42
- }
42
+ };
43
43
  export interface ShortTemplateVersion {
44
44
  tag: string;
45
45
  engine: string;
@@ -35,14 +35,14 @@ export interface UpdateDomainTrackingResponse {
35
35
  status: number;
36
36
  body: UpdatedOpenTracking;
37
37
  }
38
- export interface OpenTrackingInfo {
38
+ export declare type OpenTrackingInfo = {
39
39
  active: 'yes' | 'no' | 'true' | 'false';
40
- }
41
- export interface ClickTrackingInfo {
40
+ };
41
+ export declare type ClickTrackingInfo = {
42
42
  active: 'yes' | 'no' | 'true' | 'false' | 'htmlonly';
43
- }
44
- export interface UnsubscribeTrackingInfo {
43
+ };
44
+ export declare type UnsubscribeTrackingInfo = {
45
45
  active: 'yes' | 'no' | 'true' | 'false';
46
46
  html_footer: string;
47
47
  text_footer: string;
48
- }
48
+ };
@@ -1,9 +1,9 @@
1
- export interface DomainsQuery {
1
+ export declare type DomainsQuery = {
2
2
  authority?: string;
3
3
  state?: 'active' | 'unverified' | 'disabled';
4
4
  limit?: number;
5
5
  skip?: number;
6
- }
6
+ };
7
7
  export interface DomainInfo {
8
8
  name: string;
9
9
  smtp_password: string;
@@ -44,7 +44,7 @@ export interface DNSRecord {
44
44
  valid: string;
45
45
  value: string;
46
46
  }
47
- export interface DomainResponseData {
47
+ export declare type DomainResponseData = {
48
48
  status: number;
49
49
  body: {
50
50
  domain: DomainData;
@@ -52,7 +52,7 @@ export interface DomainResponseData {
52
52
  receiving_dns_records: DNSRecord[];
53
53
  sending_dns_records: DNSRecord[];
54
54
  };
55
- }
55
+ };
56
56
  export interface DomainListResponseData {
57
57
  status: number;
58
58
  body: {
@@ -67,10 +67,10 @@ export interface DestroyedDomainResponse {
67
67
  status: number;
68
68
  body: MessageResponse;
69
69
  }
70
- export interface ConnectionSettings {
70
+ export declare type ConnectionSettings = {
71
71
  require_tls: boolean;
72
72
  skip_verification: boolean;
73
- }
73
+ };
74
74
  export interface ConnectionSettingsResponse {
75
75
  body: {
76
76
  connection: ConnectionSettings;
@@ -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;
@@ -10,10 +10,46 @@ export interface IpPoolListResponse {
10
10
  ip_pools: IpPool;
11
11
  message: string;
12
12
  };
13
+ status: number;
13
14
  }
14
- export interface IpPoolUpdateData {
15
+ export interface IpPoolListResult {
16
+ ip_pools: IpPool;
17
+ message: string;
18
+ status: number;
19
+ }
20
+ export declare type IpPoolUpdateData = {
15
21
  name: string;
16
22
  description: string;
17
- add_ip: string;
18
- remove_ip: string;
19
- }
23
+ ips: string[];
24
+ };
25
+ export declare type IpPoolMessageResponse = {
26
+ body: {
27
+ message: string;
28
+ };
29
+ status: number;
30
+ };
31
+ export declare type IpPoolMessageResult = {
32
+ message: string;
33
+ status: number;
34
+ };
35
+ export declare type IpPoolDeleteData = {
36
+ ip?: string;
37
+ pool_id?: string;
38
+ };
39
+ export declare type IpPoolCreateData = {
40
+ name: string;
41
+ description?: string;
42
+ ips?: string[];
43
+ };
44
+ export declare type IpPoolCreateResponse = {
45
+ body: {
46
+ message: string;
47
+ pool_id: string;
48
+ };
49
+ status: number;
50
+ };
51
+ export declare type IpPoolCreateResult = {
52
+ status: number;
53
+ message: string;
54
+ pool_id: string;
55
+ };
@@ -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
  */
@@ -8,6 +8,7 @@ export interface MultipleValidationJob {
8
8
  quantity: number;
9
9
  records_processed: number;
10
10
  status: string;
11
+ responseStatusCode: number;
11
12
  summary: {
12
13
  result: {
13
14
  catch_all: number;
@@ -28,6 +29,14 @@ export interface CreatedMultipleValidationJob {
28
29
  id: string;
29
30
  message: string;
30
31
  }
32
+ export interface MultipleValidationCreationData {
33
+ file: Record<string, unknown>;
34
+ [key: string]: unknown | undefined;
35
+ }
36
+ export interface MultipleValidationCreationDataUpdated {
37
+ multipleValidationFile: Record<string, unknown>;
38
+ [key: string]: unknown | undefined;
39
+ }
31
40
  export interface PagesList {
32
41
  prev: string;
33
42
  first: string;
@@ -38,13 +47,14 @@ export interface MultipleValidationJobsListResult {
38
47
  jobs: MultipleValidationJob[];
39
48
  paging: PagesList;
40
49
  total: number;
50
+ status: number;
41
51
  }
42
52
  export interface MultipleValidationJobsListResponse {
43
53
  status: 200;
44
54
  body: MultipleValidationJobsListResult;
45
55
  }
46
56
  export interface CanceledMultipleValidationJob {
47
- body: string;
57
+ message: string;
48
58
  status: number;
49
59
  }
50
60
  export interface IMultipleValidationClient {
@@ -1,6 +1,13 @@
1
1
  import Options from './Options';
2
- interface RequestOptions extends Options {
2
+ export interface OnCallEmptyHeaders {
3
+ [key: string]: undefined;
4
+ }
5
+ export interface RequestOptions extends Options {
3
6
  headers: any;
4
7
  timeout: number;
5
8
  }
6
- export default RequestOptions;
9
+ export interface OnCallRequestOptions {
10
+ timeout?: number;
11
+ headers?: HeadersInit | OnCallEmptyHeaders;
12
+ [key: string]: unknown | undefined;
13
+ }
@@ -51,9 +51,9 @@ export declare enum SuppressionModels {
51
51
  export interface PagesListAccumulator {
52
52
  [index: string]: ParsedPage;
53
53
  }
54
- export interface SuppressionListQuery {
54
+ export declare type SuppressionListQuery = {
55
55
  limit?: number;
56
- }
56
+ };
57
57
  export interface SuppressionListResponse {
58
58
  body: {
59
59
  items: BounceData[] | ComplaintData[] | UnsubscribeData[] | WhiteListData[];
@@ -79,14 +79,14 @@ export interface SuppressionDestroyResult {
79
79
  address: string;
80
80
  status: number;
81
81
  }
82
- export interface SuppressionCreationData {
82
+ export declare type SuppressionCreationData = {
83
83
  address: string;
84
84
  code?: number;
85
85
  error?: string;
86
86
  domain?: string;
87
87
  tag?: string;
88
88
  created_at?: string;
89
- }
89
+ };
90
90
  export interface SuppressionCreationResponse {
91
91
  body: {
92
92
  message: string;
@@ -1,3 +1,6 @@
1
+ export declare type ValidationQuery = {
2
+ address: string;
3
+ };
1
4
  export interface ValidationResult {
2
5
  address: string;
3
6
  is_disposable_address: boolean;
@@ -15,10 +15,10 @@ export interface WebhookList {
15
15
  urls: string[];
16
16
  };
17
17
  }
18
- export interface WebhooksQuery {
18
+ export declare type WebhooksQuery = {
19
19
  limit?: number;
20
20
  skip?: number;
21
- }
21
+ };
22
22
  export interface ValidationResponse {
23
23
  code: number;
24
24
  message: string;
@@ -1,15 +1,15 @@
1
- export interface ListsQuery {
1
+ export declare type ListsQuery = {
2
2
  address?: string;
3
3
  limit?: number;
4
4
  skip?: number;
5
- }
6
- export interface CreateUpdateList {
5
+ };
6
+ export declare type CreateUpdateList = {
7
7
  address: string;
8
8
  name?: string;
9
9
  description?: string;
10
10
  access_level?: 'readonly' | 'members' | 'everyone';
11
11
  reply_preference?: 'list' | 'sender';
12
- }
12
+ };
13
13
  export interface DestroyedList {
14
14
  address: string;
15
15
  message: string;
@@ -5,18 +5,18 @@ export interface MailListMember {
5
5
  subscribed: boolean;
6
6
  vars: string | any;
7
7
  }
8
- export interface MailListMembersQuery {
8
+ export declare type MailListMembersQuery = {
9
9
  subscribed?: 'yes' | 'no';
10
10
  limit?: number;
11
- }
12
- export interface MultipleMembersData {
11
+ };
12
+ export declare type MultipleMembersData = {
13
13
  members: Array<MailListMember>;
14
14
  upsert: 'yes' | 'no';
15
- }
16
- export interface MultipleMembersReqData {
15
+ };
16
+ export declare type MultipleMembersReqData = {
17
17
  members: string;
18
18
  upsert: 'yes' | 'no';
19
- }
19
+ };
20
20
  export interface CreateUpdateMailListMembers {
21
21
  address: string;
22
22
  name?: string;
@@ -24,13 +24,13 @@ export interface CreateUpdateMailListMembers {
24
24
  subscribed?: 'yes' | 'no' | boolean;
25
25
  upsert?: 'yes' | 'no';
26
26
  }
27
- export interface CreateUpdateMailListMembersReq {
27
+ export declare type CreateUpdateMailListMembersReq = {
28
28
  address: string;
29
29
  name?: string;
30
30
  vars?: string;
31
31
  subscribed?: 'yes' | 'no' | boolean;
32
32
  upsert?: 'yes' | 'no';
33
- }
33
+ };
34
34
  export interface DeletedMember {
35
35
  member: {
36
36
  address: string;
@@ -13,13 +13,13 @@ export interface DestroyRouteResponse {
13
13
  id: string;
14
14
  message: string;
15
15
  }
16
- export interface CreateUpdateRouteData {
16
+ export declare type CreateUpdateRouteData = {
17
17
  priority?: number;
18
18
  description?: string;
19
19
  expression: string;
20
20
  action: string[];
21
- }
22
- export interface RoutesListQuery {
21
+ };
22
+ export declare type RoutesListQuery = {
23
23
  limit?: number;
24
24
  skip?: number;
25
- }
25
+ };
package/ip-pools.d.ts CHANGED
@@ -1,21 +1,11 @@
1
1
  import Request from './request';
2
- import { IpPool, IpPoolUpdateData } from './interfaces/IpPools';
2
+ import { IpPoolCreateData, IpPoolCreateResult, IpPoolDeleteData, IpPoolListResult, IpPoolMessageResult, IpPoolUpdateData } from './interfaces/IpPools';
3
3
  export default class IpPoolsClient {
4
4
  request: Request;
5
5
  constructor(request: Request);
6
- list(query: any): Promise<IpPool[]>;
7
- create(data: {
8
- name: string;
9
- description?: string;
10
- ips?: string[];
11
- }): Promise<{
12
- message: string;
13
- pool_id: string;
14
- }>;
15
- update(poolId: string, data: IpPoolUpdateData): Promise<any>;
16
- delete(poolId: string, data: {
17
- id: string;
18
- pool_id: string;
19
- }): Promise<any>;
6
+ list(): Promise<IpPoolListResult>;
7
+ create(data: IpPoolCreateData): Promise<IpPoolCreateResult>;
8
+ update(poolId: string, data: IpPoolUpdateData): Promise<IpPoolMessageResult>;
9
+ delete(poolId: string, data: IpPoolDeleteData): Promise<IpPoolMessageResult>;
20
10
  private parseIpPoolsResponse;
21
11
  }
package/ips.d.ts CHANGED
@@ -3,7 +3,7 @@ import { IpData, IpsListResponseBody } from './interfaces/Ips';
3
3
  export default class IpsClient {
4
4
  request: MgRequest;
5
5
  constructor(request: MgRequest);
6
- list(query: any): Promise<IpsListResponseBody | IpData>;
7
- get(ip: string): Promise<IpsListResponseBody | IpData>;
6
+ list(query: any): Promise<IpsListResponseBody>;
7
+ get(ip: string): Promise<IpData>;
8
8
  private parseIpsResponse;
9
9
  }