mailgun.js 5.2.2 → 7.0.0

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,63 @@
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
+ ## [7.0.0](https://github.com/mailgun/mailgun.js/compare/v6.0.1...v7.0.0) (2022-05-19)
6
+
7
+
8
+ ### ⚠ BREAKING CHANGES
9
+
10
+ * Replaced ky with axios
11
+
12
+ ### Features
13
+
14
+ * Fix tests. Improve error handling ([063e3ee](https://github.com/mailgun/mailgun.js/commits/063e3eedcd7d55b59bd32e521aa053be0a8d3101))
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * Correct handling of options body. Add header for form-data ([e2e210d](https://github.com/mailgun/mailgun.js/commits/e2e210d919ca1a68d76ed4c4aa93cc1178f6ebba))
20
+ * Corrected test to check body and not improper status code ([d11cd39](https://github.com/mailgun/mailgun.js/commits/d11cd39a1316c34bac0bc437bb43d4f8797cd3bd))
21
+ * Refactored ky usage with axios ([df4da91](https://github.com/mailgun/mailgun.js/commits/df4da916f10a0653d1a7e3ed8243f02bd3b824e1))
22
+ * Removed console.log ([b4e21c7](https://github.com/mailgun/mailgun.js/commits/b4e21c74b218f92a8292237aa8fe8b2af91b4b81))
23
+
24
+
25
+ ### Other changes
26
+
27
+ * Update docs and readme ([1ccaeac](https://github.com/mailgun/mailgun.js/commits/1ccaeaca4ed954985b2ee9a0c0e7666c2f8f6b0f))
28
+
29
+
30
+ ### Breaking changes
31
+
32
+ * Replaced ky with axios ([142bb7a](https://github.com/mailgun/mailgun.js/commits/142bb7ada1671c31a636d89efd7ffc62afaf3671))
33
+
34
+ ### [6.0.1](https://github.com/mailgun/mailgun.js/compare/v6.0.0...v6.0.1) (2022-05-10)
35
+
36
+
37
+ ### Bug Fixes
38
+
39
+ * Remove file property handling as a file ([d1a8a14](https://github.com/mailgun/mailgun.js/commits/d1a8a14eb5b12ca38772f9414e068fd49a011bad))
40
+
41
+
42
+ ### Other changes
43
+
44
+ * Update tests ([52e443c](https://github.com/mailgun/mailgun.js/commits/52e443c20bd57c36e1b50aa1b8d930e160370ab6))
45
+
46
+ ## [6.0.0](https://github.com/mailgun/mailgun.js/compare/v5.2.2...v6.0.0) (2022-05-06)
47
+
48
+
49
+ ### ⚠ BREAKING CHANGES
50
+
51
+ * Update ip-pools client responses body shapes. Refactor of request.ts file
52
+
53
+ ### Breaking changes
54
+
55
+ * Update ip-pools client responses body shapes. Refactor of request.ts file ([0595d62](https://github.com/mailgun/mailgun.js/commits/0595d62eeba66caa98b19b048425385db982d2f0))
56
+
57
+
58
+ ### Other changes
59
+
60
+ * Add tests ([8590989](https://github.com/mailgun/mailgun.js/commits/859098970b21b84a1085cb8cf967db769f28ed0f))
61
+
5
62
  ### [5.2.2](https://github.com/mailgun/mailgun.js/compare/v5.2.1...v5.2.2) (2022-04-22)
6
63
 
7
64
 
package/README.md CHANGED
@@ -175,7 +175,7 @@ v:my-var | v: prefix followed by an arbitrary name allows to attach a c
175
175
  from: "Excited User <mailgun@sandbox-123.mailgun.org>",
176
176
  to: ["test@example.com"],
177
177
  subject: "Hello",
178
- text: "<mime encoded string here>"
178
+ message: "<mime encoded string here>"
179
179
  })
180
180
  .then(msg => console.log(msg)) // logs response data
181
181
  .catch(err => console.log(err)); // logs any error
@@ -1446,6 +1446,7 @@ Response shape:
1446
1446
  "id": "name_of_the_list",
1447
1447
  "quantity": 40,
1448
1448
  "records_processed": 40,
1449
+ "responseStatusCode": 200,
1449
1450
  "status": "uploaded",
1450
1451
  "summary": {
1451
1452
  "result": {
@@ -1875,5 +1876,5 @@ git pull
1875
1876
 
1876
1877
  Next, run ```npm run release```.
1877
1878
 
1878
- After that, run ```npm login``` and ```npm publish``` to publish changes on npm.
1879
+ After that, `cd ./dist` and then run ```npm login``` and ```npm publish``` to publish changes on npm.
1879
1880
 
@@ -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;
@@ -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,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,15 @@
1
+ import { AxiosRequestHeaders } from 'axios';
1
2
  import Options from './Options';
2
- interface RequestOptions extends Options {
3
- headers: any;
3
+ export interface OnCallEmptyHeaders {
4
+ [key: string]: undefined;
5
+ }
6
+ export interface RequestOptions extends Options {
7
+ headers: AxiosRequestHeaders;
4
8
  timeout: number;
5
9
  }
6
- export default RequestOptions;
10
+ export interface OnCallRequestOptions {
11
+ timeout?: number;
12
+ headers?: AxiosRequestHeaders;
13
+ query?: any;
14
+ [key: string]: unknown | undefined;
15
+ }
@@ -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
  }