mailgun.js 3.7.3 → 4.1.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 +41 -0
- package/README.md +2 -2
- package/dist/lib/client.d.ts +0 -4
- package/dist/lib/domains.d.ts +19 -13
- package/dist/lib/domainsCredentials.d.ts +14 -0
- package/dist/lib/events.d.ts +3 -3
- package/dist/lib/interfaces/DomainCredentials.d.ts +52 -0
- package/dist/lib/interfaces/DomainTracking.d.ts +4 -4
- package/dist/lib/interfaces/Domains.d.ts +53 -3
- package/dist/lib/interfaces/Events.d.ts +66 -2
- package/dist/lib/interfaces/MultipleValidation.d.ts +55 -0
- package/dist/lib/interfaces/Supressions.d.ts +6 -0
- package/dist/lib/interfaces/Validate.d.ts +12 -0
- package/dist/lib/interfaces/Webhooks.d.ts +5 -1
- package/dist/lib/multipleValidation.d.ts +10 -0
- package/dist/lib/parse.d.ts +0 -6
- package/dist/lib/request.d.ts +5 -1
- package/dist/lib/suppressions.d.ts +12 -3
- package/dist/lib/validate.d.ts +5 -2
- package/dist/lib/webhooks.d.ts +3 -3
- package/dist/mailgun.node.js +2 -2
- package/dist/mailgun.node.js.LICENSE.txt +1 -1
- package/dist/mailgun.web.js +2 -2
- package/dist/mailgun.web.js.LICENSE.txt +1 -1
- package/lib/client.ts +6 -12
- package/lib/domains.ts +82 -26
- package/lib/domainsCredentials.ts +88 -0
- package/lib/events.ts +6 -6
- package/lib/interfaces/DomainCredentials.ts +68 -0
- package/lib/interfaces/DomainTracking.ts +4 -4
- package/lib/interfaces/Domains.ts +65 -4
- package/lib/interfaces/Events.ts +66 -2
- package/lib/interfaces/MultipleValidation.ts +62 -0
- package/lib/interfaces/Supressions.ts +7 -0
- package/lib/interfaces/Validate.ts +15 -0
- package/lib/interfaces/Webhooks.ts +6 -1
- package/lib/ip-pools.ts +2 -2
- package/lib/multipleValidation.ts +37 -0
- package/lib/request.ts +86 -34
- package/lib/suppressions.ts +36 -5
- package/lib/validate.ts +10 -4
- package/lib/webhooks.ts +19 -10
- package/package.json +1 -1
- package/test/client.test.ts +21 -5
- package/test/data/emailsValidation1.csv +3 -0
- package/test/domains.test.ts +118 -15
- package/test/domainsCredentials.test.ts +97 -0
- package/test/events.test.ts +15 -24
- package/test/multipleValidation.test.ts +159 -0
- package/test/validate.test.ts +7 -4
- package/test/webhooks.test.ts +6 -6
- package/webpack/webpack.dev.config.js +10 -0
- package/lib/parse.ts +0 -27
- package/test/parse.test.ts +0 -75
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,47 @@
|
|
|
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.1](https://github.com/mailgun/mailgun.js/compare/v4.1.0...v4.1.1) (2021-12-13)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* 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))
|
|
11
|
+
|
|
12
|
+
## [4.1.0](https://github.com/mailgun/mailgun.js/compare/v4.0.1...v4.1.0) (2021-11-30)
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
### Features
|
|
16
|
+
|
|
17
|
+
* 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))
|
|
18
|
+
|
|
19
|
+
### [4.0.1](https://github.com/mailgun/mailgun.js/compare/v4.0.0...v4.0.1) (2021-11-25)
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
### Bug Fixes
|
|
23
|
+
|
|
24
|
+
* Fixes handling of mime messages ([#213](https://github.com/mailgun/mailgun.js/issues/213)) ([ad43490](https://github.com/mailgun/mailgun.js/commits/ad43490a562b95cb77e38cb66f71ef13a4da8331))
|
|
25
|
+
|
|
26
|
+
## [4.0.0](https://github.com/mailgun/mailgun.js/compare/v3.7.3...v4.0.0) (2021-11-18)
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
### ⚠ BREAKING CHANGES
|
|
30
|
+
|
|
31
|
+
* updated signature of unlinkIpPoll method
|
|
32
|
+
|
|
33
|
+
* feature: Update events client to use v3 of API
|
|
34
|
+
|
|
35
|
+
* feature: Update webhooks to use v3 of API
|
|
36
|
+
|
|
37
|
+
* breaking: Update validation to use v4 of API
|
|
38
|
+
* removed parse client functionality.
|
|
39
|
+
Changed mg.validate.get response
|
|
40
|
+
Added multiple email addresses validation
|
|
41
|
+
|
|
42
|
+
* other: Update domain credentials responses to add status code
|
|
43
|
+
|
|
44
|
+
* Update endpoints for service methods (#209) ([59f812d](https://github.com/mailgun/mailgun.js/commits/59f812dcf771a5d7ed812424bb5dfaef0f52ff62)), closes [#209](https://github.com/mailgun/mailgun.js/issues/209)
|
|
45
|
+
|
|
5
46
|
### [3.7.3](https://github.com/mailgun/mailgun.js/compare/v3.7.2...v3.7.3) (2021-11-10)
|
|
6
47
|
|
|
7
48
|
### [3.7.2](https://github.com/mailgun/mailgun-js/compare/v3.7.1...v3.7.2) (2021-10-28)
|
package/README.md
CHANGED
|
@@ -1581,7 +1581,7 @@ Example:
|
|
|
1581
1581
|
mg.lists.members.createMember('reply@sample.com', {
|
|
1582
1582
|
address: 'bat@bar.com',
|
|
1583
1583
|
name: 'John Smith', // optional, modifiable on website
|
|
1584
|
-
vars: {hobby: "chess"}, // optional, modifiable on website
|
|
1584
|
+
vars: {hobby: "chess"}, // optional, modifiable on website
|
|
1585
1585
|
subscribed: 'no', // optional, modifiable on website
|
|
1586
1586
|
upsert: 'yes', // optional, choose yes to insert if not exist, or update it exist
|
|
1587
1587
|
})
|
|
@@ -1758,7 +1758,7 @@ git pull
|
|
|
1758
1758
|
|
|
1759
1759
|
Next, run ```npm run release```.
|
|
1760
1760
|
|
|
1761
|
-
After that,
|
|
1761
|
+
After that, run ```npm login``` and ```npm publish``` to publish changes on npm.
|
|
1762
1762
|
|
|
1763
1763
|
## TODO
|
|
1764
1764
|
- add browser demo to heroku
|
package/dist/lib/client.d.ts
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import Request from './request';
|
|
2
1
|
import Options from './interfaces/Options';
|
|
3
2
|
import DomainClient from './domains';
|
|
4
3
|
import EventClient from './events';
|
|
@@ -8,7 +7,6 @@ import WebhookClient from './webhooks';
|
|
|
8
7
|
import MessagesClient from './messages';
|
|
9
8
|
import RoutesClient from './routes';
|
|
10
9
|
import ValidateClient from './validate';
|
|
11
|
-
import ParseClient from './parse';
|
|
12
10
|
import IpsClient from './ips';
|
|
13
11
|
import IpPoolsClient from './ip-pools';
|
|
14
12
|
import ListsClient from './lists';
|
|
@@ -22,9 +20,7 @@ export default class Client {
|
|
|
22
20
|
suppressions: SuppressionClient;
|
|
23
21
|
messages: MessagesClient;
|
|
24
22
|
routes: RoutesClient;
|
|
25
|
-
public_request: Request;
|
|
26
23
|
validate: ValidateClient;
|
|
27
|
-
parse: ParseClient;
|
|
28
24
|
ips: IpsClient;
|
|
29
25
|
ip_pools: IpPoolsClient;
|
|
30
26
|
lists: ListsClient;
|
package/dist/lib/domains.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DomainsQuery, DomainInfo, DomainShortData, DNSRecord, ConnectionSettings, UpdatedConnectionSettings, DKIMAuthorityInfo, UpdatedDKIMAuthority, DKIMSelectorInfo, UpdatedDKIMSelectorResponse, WebPrefixInfo, UpdatedWebPrefixResponse, ReplacementForPool, MessageResponse } from './interfaces/Domains';
|
|
2
2
|
import APIResponse from './interfaces/ApiResponse';
|
|
3
3
|
import Request from './request';
|
|
4
|
-
import {
|
|
5
|
-
|
|
4
|
+
import { DomainTrackingData, OpenTrackingInfo, ClickTrackingInfo, UnsubscribeTrackingInfo, UpdatedOpenTracking } from './interfaces/DomainTracking';
|
|
5
|
+
import DomainCredentialsClient from './domainsCredentials';
|
|
6
|
+
export declare class Domain {
|
|
6
7
|
name: string;
|
|
7
8
|
require_tls: boolean;
|
|
8
9
|
skip_verification: boolean;
|
|
@@ -19,22 +20,27 @@ declare class Domain {
|
|
|
19
20
|
}
|
|
20
21
|
export default class DomainClient {
|
|
21
22
|
request: Request;
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
23
|
+
domainCredentials: DomainCredentialsClient;
|
|
24
|
+
constructor(request: Request, domainCredentialsClient: DomainCredentialsClient);
|
|
25
|
+
private _parseMessage;
|
|
26
|
+
private _parseDomainList;
|
|
27
|
+
private _parseDomain;
|
|
28
|
+
private _parseTrackingSettings;
|
|
29
|
+
private _parseTrackingUpdate;
|
|
30
|
+
list(query?: DomainsQuery): Promise<Domain[]>;
|
|
29
31
|
get(domain: string): Promise<Domain>;
|
|
30
32
|
create(data: DomainInfo): Promise<Domain>;
|
|
31
|
-
destroy(domain: string): Promise<
|
|
33
|
+
destroy(domain: string): Promise<MessageResponse>;
|
|
34
|
+
getConnection(domain: string): Promise<ConnectionSettings>;
|
|
35
|
+
updateConnection(domain: string, data: ConnectionSettings): Promise<UpdatedConnectionSettings>;
|
|
32
36
|
getTracking(domain: string): Promise<DomainTrackingData>;
|
|
33
37
|
updateTracking(domain: string, type: string, data: OpenTrackingInfo | ClickTrackingInfo | UnsubscribeTrackingInfo): Promise<UpdatedOpenTracking>;
|
|
34
38
|
getIps(domain: string): Promise<string[]>;
|
|
35
39
|
assignIp(domain: string, ip: string): Promise<APIResponse>;
|
|
36
40
|
deleteIp(domain: string, ip: string): Promise<APIResponse>;
|
|
37
41
|
linkIpPool(domain: string, pool_id: string): Promise<APIResponse>;
|
|
38
|
-
unlinkIpPoll(domain: string,
|
|
42
|
+
unlinkIpPoll(domain: string, replacement: ReplacementForPool): Promise<APIResponse>;
|
|
43
|
+
updateDKIMAuthority(domain: string, data: DKIMAuthorityInfo): Promise<UpdatedDKIMAuthority>;
|
|
44
|
+
updateDKIMSelector(domain: string, data: DKIMSelectorInfo): Promise<UpdatedDKIMSelectorResponse>;
|
|
45
|
+
updateWebPrefix(domain: string, data: WebPrefixInfo): Promise<UpdatedWebPrefixResponse>;
|
|
39
46
|
}
|
|
40
|
-
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import Request from './request';
|
|
2
|
+
import { DomainCredentials, DomainCredentialsList, DomainCredentialsQuery, DomainCredentialsResult, IDomainCredentials, UpdateDomainCredentialsData } from './interfaces/DomainCredentials';
|
|
3
|
+
export default class DomainCredentialsClient implements IDomainCredentials {
|
|
4
|
+
baseRoute: string;
|
|
5
|
+
request: Request;
|
|
6
|
+
constructor(request: Request);
|
|
7
|
+
private _parseDomainCredentialsList;
|
|
8
|
+
private _parseMessageResponse;
|
|
9
|
+
private _parseDeletedResponse;
|
|
10
|
+
list(domain: string, query?: DomainCredentialsQuery): Promise<DomainCredentialsList>;
|
|
11
|
+
create(domain: string, data: DomainCredentials): Promise<DomainCredentialsResult>;
|
|
12
|
+
update(domain: string, credentialsLogin: string, data: UpdateDomainCredentialsData): Promise<DomainCredentialsResult>;
|
|
13
|
+
destroy(domain: string, credentialsLogin: string): Promise<DomainCredentialsResult>;
|
|
14
|
+
}
|
package/dist/lib/events.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { EventsList, EventsPage, EventsResponse,
|
|
1
|
+
import { EventsList, EventsPage, EventsResponse, ParsedPagesList } from './interfaces/Events';
|
|
2
2
|
import Request from './request';
|
|
3
3
|
export default class EventClient {
|
|
4
4
|
request: Request;
|
|
5
5
|
constructor(request: Request);
|
|
6
6
|
_parsePageNumber(url: string): string;
|
|
7
7
|
_parsePage(id: string, url: string): EventsPage;
|
|
8
|
-
_parsePageLinks(response: EventsResponse):
|
|
8
|
+
_parsePageLinks(response: EventsResponse): ParsedPagesList;
|
|
9
9
|
_parseEventList(response: EventsResponse): EventsList;
|
|
10
|
-
get(domain: string, query
|
|
10
|
+
get(domain: string, query?: {
|
|
11
11
|
page: string;
|
|
12
12
|
}): Promise<EventsList>;
|
|
13
13
|
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export interface DomainCredentialsQuery {
|
|
2
|
+
limit: number;
|
|
3
|
+
skip: number;
|
|
4
|
+
}
|
|
5
|
+
export interface DomainCredentials {
|
|
6
|
+
login: string;
|
|
7
|
+
password: string;
|
|
8
|
+
}
|
|
9
|
+
export interface DomainCredentialsItem {
|
|
10
|
+
created_at: string;
|
|
11
|
+
login: string;
|
|
12
|
+
mailbox: string;
|
|
13
|
+
size_bytes: number | null;
|
|
14
|
+
}
|
|
15
|
+
export interface DomainCredentialsResponseData {
|
|
16
|
+
status: number;
|
|
17
|
+
body: {
|
|
18
|
+
items: DomainCredentialsItem[];
|
|
19
|
+
total_count: number;
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export interface DomainCredentialsList {
|
|
23
|
+
items: DomainCredentialsItem[];
|
|
24
|
+
totalCount: number;
|
|
25
|
+
}
|
|
26
|
+
export interface DomainCredentialsResult {
|
|
27
|
+
status: number;
|
|
28
|
+
message: string;
|
|
29
|
+
spec?: string;
|
|
30
|
+
}
|
|
31
|
+
export interface CreatedUpdatedDomainCredentialsResponse {
|
|
32
|
+
status: number;
|
|
33
|
+
body: {
|
|
34
|
+
message: string;
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
export interface DeletedDomainCredentialsResponse {
|
|
38
|
+
status: number;
|
|
39
|
+
body: {
|
|
40
|
+
message: string;
|
|
41
|
+
spec: string;
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
export interface UpdateDomainCredentialsData {
|
|
45
|
+
password: string;
|
|
46
|
+
}
|
|
47
|
+
export interface IDomainCredentials {
|
|
48
|
+
list(domain: string, query: DomainCredentialsQuery): Promise<DomainCredentialsList>;
|
|
49
|
+
create(domain: string, data: DomainCredentials): Promise<DomainCredentialsResult>;
|
|
50
|
+
update(domain: string, credentialsLogin: string, data: UpdateDomainCredentialsData): Promise<DomainCredentialsResult>;
|
|
51
|
+
destroy(domain: string, credentialsLogin: string): Promise<DomainCredentialsResult>;
|
|
52
|
+
}
|
|
@@ -18,7 +18,7 @@ export interface DomainTrackingResponse {
|
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
20
|
export interface UpdatedOpenTracking {
|
|
21
|
-
message:
|
|
21
|
+
message: string;
|
|
22
22
|
open?: {
|
|
23
23
|
active: boolean;
|
|
24
24
|
};
|
|
@@ -36,13 +36,13 @@ export interface UpdateDomainTrackingResponse {
|
|
|
36
36
|
body: UpdatedOpenTracking;
|
|
37
37
|
}
|
|
38
38
|
export interface OpenTrackingInfo {
|
|
39
|
-
active: 'yes' | 'no';
|
|
39
|
+
active: 'yes' | 'no' | 'true' | 'false';
|
|
40
40
|
}
|
|
41
41
|
export interface ClickTrackingInfo {
|
|
42
|
-
active: 'yes' | 'no' | 'htmlonly';
|
|
42
|
+
active: 'yes' | 'no' | 'true' | 'false' | 'htmlonly';
|
|
43
43
|
}
|
|
44
44
|
export interface UnsubscribeTrackingInfo {
|
|
45
|
-
active:
|
|
45
|
+
active: 'yes' | 'no' | 'true' | 'false';
|
|
46
46
|
html_footer: string;
|
|
47
47
|
text_footer: string;
|
|
48
48
|
}
|
|
@@ -9,7 +9,7 @@ export interface DomainInfo {
|
|
|
9
9
|
smtp_password: string;
|
|
10
10
|
spam_action?: 'disabled' | 'block' | 'tag';
|
|
11
11
|
wildcard?: boolean;
|
|
12
|
-
force_dkim_authority?: true;
|
|
12
|
+
force_dkim_authority?: boolean | 'true' | 'false';
|
|
13
13
|
dkim_key_size?: 1024 | 2048;
|
|
14
14
|
ips?: '';
|
|
15
15
|
pool_id?: '';
|
|
@@ -60,12 +60,62 @@ export interface DomainListResponseData {
|
|
|
60
60
|
total_count: number;
|
|
61
61
|
};
|
|
62
62
|
}
|
|
63
|
-
export interface
|
|
63
|
+
export interface MessageResponse {
|
|
64
64
|
message: string;
|
|
65
65
|
}
|
|
66
66
|
export interface DestroyedDomainResponse {
|
|
67
67
|
status: number;
|
|
68
|
+
body: MessageResponse;
|
|
69
|
+
}
|
|
70
|
+
export interface ConnectionSettings {
|
|
71
|
+
require_tls: boolean;
|
|
72
|
+
skip_verification: boolean;
|
|
73
|
+
}
|
|
74
|
+
export interface ConnectionSettingsResponse {
|
|
68
75
|
body: {
|
|
69
|
-
|
|
76
|
+
connection: ConnectionSettings;
|
|
70
77
|
};
|
|
78
|
+
status: number;
|
|
79
|
+
}
|
|
80
|
+
export interface UpdatedConnectionSettings {
|
|
81
|
+
message: string;
|
|
82
|
+
require_tls: boolean;
|
|
83
|
+
skip_verification: boolean;
|
|
84
|
+
}
|
|
85
|
+
export interface UpdatedConnectionSettingsRes {
|
|
86
|
+
body: UpdatedConnectionSettings;
|
|
87
|
+
status: number;
|
|
88
|
+
}
|
|
89
|
+
export interface DKIMAuthorityInfo {
|
|
90
|
+
self: boolean | 'yes' | 'no' | 'true' | 'false';
|
|
91
|
+
}
|
|
92
|
+
export interface UpdatedDKIMAuthority {
|
|
93
|
+
changed: boolean;
|
|
94
|
+
message: string;
|
|
95
|
+
sending_dns_records: DNSRecord[];
|
|
96
|
+
}
|
|
97
|
+
export interface UpdatedDKIMAuthorityResponse {
|
|
98
|
+
body: UpdatedDKIMAuthority;
|
|
99
|
+
status: 200;
|
|
100
|
+
}
|
|
101
|
+
export interface DKIMSelectorInfo {
|
|
102
|
+
dkimSelector: string;
|
|
103
|
+
}
|
|
104
|
+
export interface UpdatedDKIMSelectorResponse {
|
|
105
|
+
body: MessageResponse;
|
|
106
|
+
status: number;
|
|
107
|
+
}
|
|
108
|
+
export interface WebPrefixInfo {
|
|
109
|
+
webPrefix: string;
|
|
110
|
+
}
|
|
111
|
+
export interface UpdatedWebPrefix {
|
|
112
|
+
message: string;
|
|
113
|
+
}
|
|
114
|
+
export interface UpdatedWebPrefixResponse {
|
|
115
|
+
body: MessageResponse;
|
|
116
|
+
status: number;
|
|
117
|
+
}
|
|
118
|
+
export interface ReplacementForPool {
|
|
119
|
+
pool_id?: string;
|
|
120
|
+
ip?: string;
|
|
71
121
|
}
|
|
@@ -15,9 +15,73 @@ export interface EventsResponse {
|
|
|
15
15
|
paging: PagesList;
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
|
+
export interface DomainEvent {
|
|
19
|
+
severity: string;
|
|
20
|
+
tags: string[];
|
|
21
|
+
storage: {
|
|
22
|
+
url: string;
|
|
23
|
+
key: string;
|
|
24
|
+
};
|
|
25
|
+
'delivery-status': {
|
|
26
|
+
tls: boolean;
|
|
27
|
+
'mx-host': string;
|
|
28
|
+
code: number;
|
|
29
|
+
description: string;
|
|
30
|
+
'session-seconds': number;
|
|
31
|
+
utf8: boolean;
|
|
32
|
+
'attempt-no': number;
|
|
33
|
+
message: string;
|
|
34
|
+
'certificate-verified': boolean;
|
|
35
|
+
};
|
|
36
|
+
'recipient-domain': string;
|
|
37
|
+
id: string;
|
|
38
|
+
campaigns: [];
|
|
39
|
+
reason: string;
|
|
40
|
+
'user-variables': {
|
|
41
|
+
[key: string]: any;
|
|
42
|
+
};
|
|
43
|
+
flags: {
|
|
44
|
+
'is-routed': boolean;
|
|
45
|
+
'is-authenticated': boolean;
|
|
46
|
+
'is-system-test': boolean;
|
|
47
|
+
'is-test-mode': boolean;
|
|
48
|
+
};
|
|
49
|
+
'log-level': string;
|
|
50
|
+
template?: any;
|
|
51
|
+
timestamp: number;
|
|
52
|
+
envelope: {
|
|
53
|
+
transport: string;
|
|
54
|
+
sender: string;
|
|
55
|
+
'sending-ip': string;
|
|
56
|
+
targets: string;
|
|
57
|
+
};
|
|
58
|
+
message: {
|
|
59
|
+
headers: {
|
|
60
|
+
to: string;
|
|
61
|
+
'message-id': string;
|
|
62
|
+
from: string;
|
|
63
|
+
subject: string;
|
|
64
|
+
};
|
|
65
|
+
attachments: [];
|
|
66
|
+
size: 308;
|
|
67
|
+
};
|
|
68
|
+
recipient: string;
|
|
69
|
+
event: string;
|
|
70
|
+
}
|
|
71
|
+
export interface ParsedPage {
|
|
72
|
+
id: string;
|
|
73
|
+
number: string;
|
|
74
|
+
url: string;
|
|
75
|
+
}
|
|
76
|
+
export interface ParsedPagesList {
|
|
77
|
+
previous: ParsedPage;
|
|
78
|
+
first: ParsedPage;
|
|
79
|
+
last: ParsedPage;
|
|
80
|
+
next: ParsedPage;
|
|
81
|
+
}
|
|
18
82
|
export interface EventsList {
|
|
19
|
-
items: [];
|
|
20
|
-
pages:
|
|
83
|
+
items: DomainEvent[];
|
|
84
|
+
pages: ParsedPagesList;
|
|
21
85
|
}
|
|
22
86
|
export interface PagesListAccumulator {
|
|
23
87
|
[index: string]: EventsPage;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
export interface MultipleValidationJob {
|
|
2
|
+
created_at: number;
|
|
3
|
+
download_url: {
|
|
4
|
+
csv: string;
|
|
5
|
+
json: string;
|
|
6
|
+
};
|
|
7
|
+
id: string;
|
|
8
|
+
quantity: number;
|
|
9
|
+
records_processed: number;
|
|
10
|
+
status: string;
|
|
11
|
+
summary: {
|
|
12
|
+
result: {
|
|
13
|
+
catch_all: number;
|
|
14
|
+
deliverable: number;
|
|
15
|
+
do_not_send: number;
|
|
16
|
+
undeliverable: number;
|
|
17
|
+
unknown: number;
|
|
18
|
+
};
|
|
19
|
+
risk: {
|
|
20
|
+
high: number;
|
|
21
|
+
low: number;
|
|
22
|
+
medium: number;
|
|
23
|
+
unknown: number;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export interface CreatedMultipleValidationJob {
|
|
28
|
+
id: string;
|
|
29
|
+
message: string;
|
|
30
|
+
}
|
|
31
|
+
export interface PagesList {
|
|
32
|
+
prev: string;
|
|
33
|
+
first: string;
|
|
34
|
+
last: string;
|
|
35
|
+
next: string;
|
|
36
|
+
}
|
|
37
|
+
export interface MultipleValidationJobsListResult {
|
|
38
|
+
jobs: MultipleValidationJob[];
|
|
39
|
+
paging: PagesList;
|
|
40
|
+
total: number;
|
|
41
|
+
}
|
|
42
|
+
export interface MultipleValidationJobsListResponse {
|
|
43
|
+
status: 200;
|
|
44
|
+
body: MultipleValidationJobsListResult;
|
|
45
|
+
}
|
|
46
|
+
export interface CanceledMultipleValidationJob {
|
|
47
|
+
body: string;
|
|
48
|
+
status: number;
|
|
49
|
+
}
|
|
50
|
+
export interface IMultipleValidationClient {
|
|
51
|
+
list(): Promise<MultipleValidationJobsListResult>;
|
|
52
|
+
get(listId: string): Promise<MultipleValidationJob>;
|
|
53
|
+
create(listId: string, file: any): Promise<CreatedMultipleValidationJob>;
|
|
54
|
+
destroy(listId: string): Promise<CanceledMultipleValidationJob>;
|
|
55
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export interface ValidationResult {
|
|
2
|
+
address: string;
|
|
3
|
+
is_disposable_address: boolean;
|
|
4
|
+
is_role_address: boolean;
|
|
5
|
+
reason: string[];
|
|
6
|
+
result: string;
|
|
7
|
+
risk: string;
|
|
8
|
+
}
|
|
9
|
+
export interface ValidationResponse {
|
|
10
|
+
status: number;
|
|
11
|
+
body: ValidationResult;
|
|
12
|
+
}
|
|
@@ -7,7 +7,7 @@ export interface WebhookResponseBody {
|
|
|
7
7
|
webhook: APIWebhook;
|
|
8
8
|
}
|
|
9
9
|
export interface WebhookResponse {
|
|
10
|
-
status:
|
|
10
|
+
status: number;
|
|
11
11
|
body: WebhookResponseBody;
|
|
12
12
|
}
|
|
13
13
|
export interface WebhookList {
|
|
@@ -19,3 +19,7 @@ export interface WebhooksQuery {
|
|
|
19
19
|
limit?: number;
|
|
20
20
|
skip?: number;
|
|
21
21
|
}
|
|
22
|
+
export interface ValidationResponse {
|
|
23
|
+
code: number;
|
|
24
|
+
message: string;
|
|
25
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CanceledMultipleValidationJob, CreatedMultipleValidationJob, IMultipleValidationClient, MultipleValidationJob, MultipleValidationJobsListResult } from './interfaces/MultipleValidation';
|
|
2
|
+
import Request from './request';
|
|
3
|
+
export default class MultipleValidationClient implements IMultipleValidationClient {
|
|
4
|
+
request: Request;
|
|
5
|
+
constructor(request: Request);
|
|
6
|
+
list(): Promise<MultipleValidationJobsListResult>;
|
|
7
|
+
get(listId: string): Promise<MultipleValidationJob>;
|
|
8
|
+
create(listId: string, file: any): Promise<CreatedMultipleValidationJob>;
|
|
9
|
+
destroy(listId: string): Promise<CanceledMultipleValidationJob>;
|
|
10
|
+
}
|
package/dist/lib/parse.d.ts
CHANGED
package/dist/lib/request.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ declare class Request {
|
|
|
8
8
|
private url;
|
|
9
9
|
private timeout;
|
|
10
10
|
private headers;
|
|
11
|
-
private
|
|
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,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
|
|
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;
|
package/dist/lib/validate.d.ts
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
|
+
import { IMultipleValidationClient } from './interfaces/MultipleValidation';
|
|
2
|
+
import { ValidationResult } from './interfaces/Validate';
|
|
1
3
|
import Request from './request';
|
|
2
4
|
export default class ValidateClient {
|
|
5
|
+
multipleValidation: IMultipleValidationClient;
|
|
3
6
|
request: Request;
|
|
4
|
-
constructor(request: Request);
|
|
5
|
-
get(address: string): Promise<
|
|
7
|
+
constructor(request: Request, multipleValidationClient: IMultipleValidationClient);
|
|
8
|
+
get(address: string): Promise<ValidationResult>;
|
|
6
9
|
}
|
package/dist/lib/webhooks.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WebhookList, WebhookResponse, WebhooksQuery } from './interfaces/Webhooks';
|
|
1
|
+
import { ValidationResponse, WebhookList, WebhookResponse, WebhooksQuery } from './interfaces/Webhooks';
|
|
2
2
|
import Request from './request';
|
|
3
3
|
declare class Webhook {
|
|
4
4
|
id: string;
|
|
@@ -6,7 +6,7 @@ declare class Webhook {
|
|
|
6
6
|
constructor(id: string, url: string);
|
|
7
7
|
}
|
|
8
8
|
export default class WebhookClient {
|
|
9
|
-
request:
|
|
9
|
+
request: Request;
|
|
10
10
|
constructor(request: Request);
|
|
11
11
|
_parseWebhookList(response: {
|
|
12
12
|
body: {
|
|
@@ -25,7 +25,7 @@ export default class WebhookClient {
|
|
|
25
25
|
};
|
|
26
26
|
list(domain: string, query: WebhooksQuery): Promise<WebhookList>;
|
|
27
27
|
get(domain: string, id: string): Promise<Webhook>;
|
|
28
|
-
create(domain: string, id: string, url: string, test?: boolean): Promise<Webhook>;
|
|
28
|
+
create(domain: string, id: string, url: string, test?: boolean): Promise<Webhook | ValidationResponse>;
|
|
29
29
|
update(domain: string, id: string, url: string): Promise<Webhook>;
|
|
30
30
|
destroy(domain: string, id: string): Promise<Webhook>;
|
|
31
31
|
}
|