mailgun.js 4.2.2 → 5.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.
Files changed (62) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/dist/mailgun.js.d.ts +1572 -0
  3. package/dist/mailgun.node.js +2 -2
  4. package/dist/mailgun.node.js.LICENSE.txt +1 -1
  5. package/dist/mailgun.web.js +2 -2
  6. package/dist/mailgun.web.js.LICENSE.txt +1 -1
  7. package/dts-bundle.js +8 -0
  8. package/examples/addresses.js +1 -1
  9. package/examples/list-domains.js +1 -1
  10. package/lib/domains.ts +1 -1
  11. package/lib/events.ts +4 -4
  12. package/{index.ts → lib/index.ts} +3 -3
  13. package/lib/interfaces/Supressions.ts +61 -0
  14. package/lib/interfaces/Webhooks.ts +10 -0
  15. package/lib/stats.ts +3 -3
  16. package/lib/suppressions.ts +39 -18
  17. package/lib/webhooks.ts +7 -4
  18. package/package.json +11 -6
  19. package/tsconfig.json +2 -2
  20. package/webpack/webpack.common.config.js +2 -2
  21. package/dist/index.d.ts +0 -9
  22. package/dist/lib/client.d.ts +0 -28
  23. package/dist/lib/domains.d.ts +0 -53
  24. package/dist/lib/domainsCredentials.d.ts +0 -14
  25. package/dist/lib/domainsTags.d.ts +0 -34
  26. package/dist/lib/domainsTemplates.d.ts +0 -35
  27. package/dist/lib/error.d.ts +0 -7
  28. package/dist/lib/events.d.ts +0 -13
  29. package/dist/lib/interfaces/APIErrorOptions.d.ts +0 -11
  30. package/dist/lib/interfaces/ApiResponse.d.ts +0 -5
  31. package/dist/lib/interfaces/DomainCredentials.d.ts +0 -52
  32. package/dist/lib/interfaces/DomainTags.d.ts +0 -228
  33. package/dist/lib/interfaces/DomainTemplates.d.ts +0 -194
  34. package/dist/lib/interfaces/DomainTracking.d.ts +0 -48
  35. package/dist/lib/interfaces/Domains.d.ts +0 -121
  36. package/dist/lib/interfaces/Events.d.ts +0 -88
  37. package/dist/lib/interfaces/IFormData.d.ts +0 -7
  38. package/dist/lib/interfaces/IpPools.d.ts +0 -19
  39. package/dist/lib/interfaces/Ips.d.ts +0 -10
  40. package/dist/lib/interfaces/MultipleValidation.d.ts +0 -55
  41. package/dist/lib/interfaces/Options.d.ts +0 -8
  42. package/dist/lib/interfaces/RequestOptions.d.ts +0 -6
  43. package/dist/lib/interfaces/StatsOptions.d.ts +0 -21
  44. package/dist/lib/interfaces/Supressions.d.ts +0 -21
  45. package/dist/lib/interfaces/Validate.d.ts +0 -12
  46. package/dist/lib/interfaces/Webhooks.d.ts +0 -25
  47. package/dist/lib/interfaces/lists.d.ts +0 -25
  48. package/dist/lib/interfaces/mailListMembers.d.ts +0 -52
  49. package/dist/lib/interfaces/routes.d.ts +0 -25
  50. package/dist/lib/ip-pools.d.ts +0 -21
  51. package/dist/lib/ips.d.ts +0 -9
  52. package/dist/lib/lists.d.ts +0 -14
  53. package/dist/lib/mailListMembers.d.ts +0 -14
  54. package/dist/lib/messages.d.ts +0 -9
  55. package/dist/lib/multipleValidation.d.ts +0 -10
  56. package/dist/lib/parse.d.ts +0 -0
  57. package/dist/lib/request.d.ts +0 -31
  58. package/dist/lib/routes.d.ts +0 -11
  59. package/dist/lib/stats.d.ts +0 -20
  60. package/dist/lib/suppressions.d.ts +0 -67
  61. package/dist/lib/validate.d.ts +0 -9
  62. package/dist/lib/webhooks.d.ts +0 -32
@@ -4,4 +4,4 @@
4
4
 
5
5
  /*! https://mths.be/punycode v1.3.2 by @mathias */
6
6
 
7
- /*! mailgun.js v4.2.1 */
7
+ /*! mailgun.js v5.0.0 */
package/dts-bundle.js ADDED
@@ -0,0 +1,8 @@
1
+ const dts = require('dts-bundle');
2
+
3
+ dts.bundle({
4
+ name: 'mailgun.js',
5
+ main: 'dist/lib/index.d.ts',
6
+ out: '../mailgun.js.d.ts',
7
+ removeSource: true
8
+ });
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable no-console */
2
- const mailgun = require('../index');
2
+ const mailgun = require('../lib/index');
3
3
 
4
4
  const mg = mailgun.client({
5
5
  username: 'api',
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable no-console */
2
- const mailgun = require('../index');
2
+ const mailgun = require('../lib/index');
3
3
 
4
4
  const mg = mailgun.client({ username: 'api', key: process.env.MAILGUN_API_KEY || '' });
5
5
 
package/lib/domains.ts CHANGED
@@ -208,7 +208,7 @@ export default class DomainClient {
208
208
 
209
209
  updateDKIMAuthority(domain: string, data: DKIMAuthorityInfo): Promise<UpdatedDKIMAuthority> {
210
210
  return this.request.put(`/v3/domains/${domain}/dkim_authority`, {}, { query: `self=${data.self}` })
211
- .then((res : APIResponse) => res)
211
+ .then((res : APIResponse) => res as UpdatedDKIMAuthorityResponse)
212
212
  .then((res : UpdatedDKIMAuthorityResponse) => res.body as UpdatedDKIMAuthority);
213
213
  }
214
214
 
package/lib/events.ts CHANGED
@@ -13,7 +13,7 @@ export default class EventClient {
13
13
  }
14
14
 
15
15
  _parsePageNumber(url: string) : string {
16
- return url.split('/').pop();
16
+ return url.split('/').pop() || '';
17
17
  }
18
18
 
19
19
  _parsePage(id: string, url: string) : EventsPage {
@@ -23,9 +23,9 @@ export default class EventClient {
23
23
  _parsePageLinks(response: EventsResponse) : ParsedPagesList {
24
24
  const pages = Object.entries(response.body.paging as PagesList);
25
25
  return pages.reduce(
26
- (acc: PagesListAccumulator, entrie: [url: string, id: string]) => {
27
- const id = entrie[0];
28
- const url = entrie[1];
26
+ (acc: PagesListAccumulator, pair: [url: string, id: string]) => {
27
+ const id = pair[0];
28
+ const url = pair[1];
29
29
  acc[id] = this._parsePage(id, url);
30
30
  return acc;
31
31
  }, {}
@@ -1,6 +1,6 @@
1
- import Client from './lib/client';
2
- import { InputFormData } from './lib/interfaces/IFormData';
3
- import Options from './lib/interfaces/Options';
1
+ import Client from './client';
2
+ import { InputFormData } from './interfaces/IFormData';
3
+ import Options from './interfaces/Options';
4
4
 
5
5
  class Mailgun {
6
6
  private formData: InputFormData
@@ -23,3 +23,64 @@ export interface WhiteListData {
23
23
  reason: string;
24
24
  createdAt: string | Date;
25
25
  }
26
+
27
+ export interface IBounce {
28
+ type: string;
29
+ address: string;
30
+ code: number;
31
+ error: string;
32
+ created_at: Date;
33
+ }
34
+ export interface IComplaint {
35
+ type: string;
36
+ address: any;
37
+ created_at: Date;
38
+ }
39
+ export interface IUnsubscribe {
40
+ type: string;
41
+ address: string;
42
+ tags: any;
43
+ created_at: Date;
44
+ }
45
+ export interface IWhiteList {
46
+ type: string;
47
+ value: string;
48
+ reason: string;
49
+ createdAt: Date;
50
+ }
51
+
52
+ export interface ParsedPage {
53
+ id: string;
54
+ page: string | undefined;
55
+ address: string | undefined;
56
+ url: string
57
+ }
58
+ export interface ParsedPagesList {
59
+ previous: ParsedPage;
60
+ first: ParsedPage;
61
+ last: ParsedPage;
62
+ next: ParsedPage;
63
+ }
64
+
65
+ export interface SuppressionList {
66
+ items: IBounce[] | IComplaint[] | IUnsubscribe[] | IWhiteList[];
67
+ pages: ParsedPagesList;
68
+ }
69
+
70
+ export interface PagesList {
71
+ previous: string;
72
+ first: string;
73
+ last: string;
74
+ next: string;
75
+ }
76
+
77
+ export enum SuppressionModels {
78
+ BOUNCES = 'bounces',
79
+ COMPLAINTS = 'complaints',
80
+ UNSUBSCRIBES = 'unsubscribes',
81
+ WHITELISTS = 'whitelists'
82
+ }
83
+
84
+ export interface PagesListAccumulator {
85
+ [index: string]: ParsedPage;
86
+ }
@@ -28,3 +28,13 @@ export interface ValidationResponse {
28
28
  code: number;
29
29
  message: string;
30
30
  }
31
+
32
+ export enum WebhooksIds {
33
+ CLICKED = 'clicked',
34
+ COMPLAINED = 'complained',
35
+ DELIVERED = 'delivered',
36
+ OPENED = 'opened',
37
+ PERMANENT_FAIL = 'permanent_fail',
38
+ TEMPORARY_FAIL = 'temporary_fail',
39
+ UNSUBSCRIBED = 'unsubscribe',
40
+ }
package/lib/stats.ts CHANGED
@@ -27,8 +27,8 @@ export default class StatsClient {
27
27
  this.request = request;
28
28
  }
29
29
 
30
- private prepareSearchParams(query: StatsQuery): Array<Array<string>> {
31
- let searchParams = [];
30
+ private prepareSearchParams(query: StatsQuery | undefined): Array<Array<string>> {
31
+ let searchParams = [] as Array<Array<string>>;
32
32
  if (typeof query === 'object' && Object.keys(query).length) {
33
33
  searchParams = Object.entries(query).reduce((arrayWithPairs, currentPair) => {
34
34
  const [key, value] = currentPair;
@@ -38,7 +38,7 @@ export default class StatsClient {
38
38
  }
39
39
  arrayWithPairs.push([key, value]);
40
40
  return arrayWithPairs;
41
- }, []);
41
+ }, [] as Array<Array<string>>);
42
42
  }
43
43
 
44
44
  return searchParams;
@@ -6,6 +6,16 @@ import Request from './request';
6
6
  import {
7
7
  BounceData,
8
8
  ComplaintData,
9
+ IBounce,
10
+ IComplaint,
11
+ IUnsubscribe,
12
+ IWhiteList,
13
+ PagesList,
14
+ PagesListAccumulator,
15
+ ParsedPage,
16
+ ParsedPagesList,
17
+ SuppressionList,
18
+ SuppressionModels,
9
19
  UnsubscribeData,
10
20
  WhiteListData
11
21
  } from './interfaces/Supressions';
@@ -14,7 +24,7 @@ const createOptions = {
14
24
  headers: { 'Content-Type': 'application/json' }
15
25
  };
16
26
 
17
- class Bounce {
27
+ class Bounce implements IBounce {
18
28
  type: string;
19
29
  address: string;
20
30
  code: number;
@@ -30,7 +40,7 @@ class Bounce {
30
40
  }
31
41
  }
32
42
 
33
- class Complaint {
43
+ class Complaint implements IComplaint {
34
44
  type: string;
35
45
  address: any;
36
46
  created_at: Date;
@@ -42,7 +52,7 @@ class Complaint {
42
52
  }
43
53
  }
44
54
 
45
- class Unsubscribe {
55
+ class Unsubscribe implements IUnsubscribe {
46
56
  type: string;
47
57
  address: string;
48
58
  tags: any;
@@ -56,7 +66,7 @@ class Unsubscribe {
56
66
  }
57
67
  }
58
68
 
59
- class WhiteList {
69
+ class WhiteList implements IWhiteList {
60
70
  type: string;
61
71
  value: string;
62
72
  reason: string;
@@ -91,30 +101,34 @@ export default class SuppressionClient {
91
101
  };
92
102
  }
93
103
 
94
- _parsePage(id: string, pageUrl: string) {
104
+ _parsePage(id: string, pageUrl: string) : ParsedPage {
95
105
  const parsedUrl = url.parse(pageUrl, true);
96
106
  const { query } = parsedUrl;
97
107
 
98
108
  return {
99
109
  id,
100
- page: query.page,
101
- address: query.address,
110
+ page: query.page as string,
111
+ address: query.address as string,
102
112
  url: pageUrl
103
113
  };
104
114
  }
105
115
 
106
- _parsePageLinks(response: { body: { paging: any } }) {
107
- const pages = Object.entries(response.body.paging);
116
+ _parsePageLinks(response: { body: { paging: any } }): ParsedPagesList {
117
+ const pages = Object.entries(response.body.paging as PagesList);
108
118
  return pages.reduce(
109
- (acc: any, [id, pageUrl]: [pageUrl: string, id: string]) => {
119
+ (acc: PagesListAccumulator, pair: [pageUrl: string, id: string]) => {
120
+ const id = pair[0];
121
+ const pageUrl = pair[1];
110
122
  acc[id] = this._parsePage(id, pageUrl);
111
123
  return acc;
112
124
  }, {}
113
- );
125
+ ) as unknown as ParsedPagesList;
114
126
  }
115
127
 
116
- _parseList(response: { body: { items: any, paging: any } }, Model: TModel) {
117
- const data = {} as any;
128
+ _parseList(
129
+ response: { body: { items: any, paging: any } }, Model: TModel
130
+ ): SuppressionList {
131
+ const data = {} as SuppressionList;
118
132
 
119
133
  data.items = response.body.items.map((d: any) => new Model(d));
120
134
 
@@ -123,7 +137,10 @@ export default class SuppressionClient {
123
137
  return data;
124
138
  }
125
139
 
126
- _parseItem(response: { body: any }, Model: TModel) {
140
+ _parseItem(
141
+ response: { body: any },
142
+ Model: TModel
143
+ ): IBounce | IComplaint | IUnsubscribe | IWhiteList {
127
144
  return new Model(response.body);
128
145
  }
129
146
 
@@ -133,16 +150,20 @@ export default class SuppressionClient {
133
150
  .then((response: { body: any }) => response.body);
134
151
  }
135
152
 
136
- list(domain: string, type: string, query: any) {
137
- const model = (this.models as any)[type];
153
+ list(domain: string, type: SuppressionModels, query: any) : Promise<SuppressionList> {
154
+ const model = (this.models)[type];
138
155
 
139
156
  return this.request
140
157
  .get(urljoin('v3', domain, type), query)
141
158
  .then((response: { body: { items: any, paging: any } }) => this._parseList(response, model));
142
159
  }
143
160
 
144
- get(domain: string, type: string, address: string) {
145
- const model = (this.models as any)[type];
161
+ get(
162
+ domain: string,
163
+ type: SuppressionModels,
164
+ address: string
165
+ ): Promise<IBounce | IComplaint | IUnsubscribe | IWhiteList> {
166
+ const model = (this.models)[type];
146
167
 
147
168
  return this.request
148
169
  .get(urljoin('v3', domain, type, encodeURIComponent(address)))
package/lib/webhooks.ts CHANGED
@@ -4,15 +4,16 @@ import {
4
4
  ValidationResponse,
5
5
  WebhookList,
6
6
  WebhookResponse,
7
+ WebhooksIds,
7
8
  WebhooksQuery
8
9
  } from './interfaces/Webhooks';
9
10
  import Request from './request';
10
11
 
11
12
  class Webhook {
12
13
  id: string;
13
- url: string;
14
+ url: string | undefined;
14
15
 
15
- constructor(id: string, url: string) {
16
+ constructor(id: string, url: string | undefined) {
16
17
  this.id = id;
17
18
  this.url = url;
18
19
  }
@@ -34,7 +35,9 @@ export default class WebhookClient {
34
35
  const webhookResponse = response?.body?.webhook;
35
36
  let url = webhookResponse?.url;
36
37
  if (!url) {
37
- url = webhookResponse?.urls && webhookResponse.urls.length ? webhookResponse.urls[0] : null;
38
+ url = webhookResponse?.urls && webhookResponse.urls.length
39
+ ? webhookResponse.urls[0]
40
+ : undefined;
38
41
  }
39
42
  return new Webhook(id, url);
40
43
  };
@@ -50,7 +53,7 @@ export default class WebhookClient {
50
53
  .then(this._parseWebhookList);
51
54
  }
52
55
 
53
- get(domain: string, id: string): Promise<Webhook> {
56
+ get(domain: string, id: WebhooksIds): Promise<Webhook> {
54
57
  return this.request.get(urljoin('/v3/domains', domain, 'webhooks', id))
55
58
  .then(this._parseWebhookWithID(id));
56
59
  }
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "mailgun.js",
3
- "version": "4.2.2",
3
+ "version": "5.0.1",
4
4
  "main": "dist/mailgun.node.js",
5
5
  "browser": "dist/mailgun.web.js",
6
- "types": "dist/index.d.ts",
6
+ "types": "dist/mailgun.js.d.ts",
7
7
  "author": "Mailgun",
8
8
  "license": "MIT",
9
9
  "keywords": [
@@ -19,15 +19,19 @@
19
19
  },
20
20
  "homepage": "https://github.com/mailgun/mailgun.js#readme",
21
21
  "scripts": {
22
- "build": "webpack --config ./webpack/webpack.dev.config.js --progress --color",
23
- "build:release": "webpack --config ./webpack/webpack.release.config.js --progress --color",
22
+ "build": "webpack --config ./webpack/webpack.dev.config.js --progress --color && npm run build-dts",
23
+ "build:release": "webpack --config ./webpack/webpack.release.config.js --progress --color && npm run build-dts",
24
24
  "start": "webpack --watch --config ./webpack/webpack.dev.config.js --progress --color",
25
25
  "release": "standard-version -a",
26
26
  "test": "multi='dot=- xunit=./results.xml' nyc mocha -t 10000 -R mocha-multi -r ts-node/register test/*.test.ts",
27
27
  "test-watch": "mocha -r ts-node/register -w -R dot test/*.test.ts",
28
28
  "docs": "typedoc --tsconfig ./tsconfig.json",
29
29
  "lint": "eslint . && eslint . --ext .ts",
30
- "prepare": "husky install"
30
+ "prepare": "husky install",
31
+ "build-dts": "node dts-bundle && rm -rf dist/lib"
32
+ },
33
+ "typescript": {
34
+ "definition": "dist/mailgun.js.d.ts"
31
35
  },
32
36
  "dependencies": {
33
37
  "base-64": "^1.0.0",
@@ -52,6 +56,7 @@
52
56
  "@typescript-eslint/parser": "^4.26.0",
53
57
  "babel-loader": "^8.1.0",
54
58
  "chai": "^4.2.0",
59
+ "dts-bundle": "^0.7.3",
55
60
  "eslint": "^7.32.0",
56
61
  "eslint-config-airbnb-base": "^14.2.0",
57
62
  "eslint-import-resolver-webpack": "^0.13.1",
@@ -106,7 +111,7 @@
106
111
  "commitUrlFormat": "https://github.com/mailgun/mailgun.js/commits/{{hash}}",
107
112
  "compareUrlFormat": "https://github.com/mailgun/mailgun.js/compare/{{previousTag}}...{{currentTag}}",
108
113
  "scripts": {
109
- "prerelease": "npm test && webpack --config ./webpack/webpack.release.config.js --progress --color && git add -A dist",
114
+ "prerelease": "npm test && npm run build:release && git add -A dist",
110
115
  "posttag": "git push && git push --tags && rm -rf build"
111
116
  }
112
117
  }
package/tsconfig.json CHANGED
@@ -10,8 +10,8 @@
10
10
 
11
11
  "allowSyntheticDefaultImports": true,
12
12
  "incremental": true,
13
- "skipLibCheck": true
14
- // "strict": true,
13
+ "skipLibCheck": true,
14
+ "strict": true
15
15
  },
16
16
  "typedocOptions": {
17
17
  "out": "docs",
@@ -9,8 +9,8 @@ const commonConfig = {
9
9
  mode: 'development',
10
10
  context: SRC_DIR,
11
11
  entry: {
12
- mailgun: path.join(SRC_DIR, 'index.ts'),
13
- 'mailgun.min': path.join(SRC_DIR, 'index.ts')
12
+ mailgun: path.join(SRC_DIR, 'lib/index.ts'),
13
+ 'mailgun.min': path.join(SRC_DIR, 'lib/index.ts')
14
14
  },
15
15
  output: {
16
16
  path: path.join(SRC_DIR, outputDir),
package/dist/index.d.ts DELETED
@@ -1,9 +0,0 @@
1
- import Client from './lib/client';
2
- import { InputFormData } from './lib/interfaces/IFormData';
3
- import Options from './lib/interfaces/Options';
4
- declare class Mailgun {
5
- private formData;
6
- constructor(FormData: InputFormData);
7
- client(options: Options): Client;
8
- }
9
- export = Mailgun;
@@ -1,28 +0,0 @@
1
- import Options from './interfaces/Options';
2
- import DomainClient from './domains';
3
- import EventClient from './events';
4
- import StatsClient from './stats';
5
- import SuppressionClient from './suppressions';
6
- import WebhookClient from './webhooks';
7
- import MessagesClient from './messages';
8
- import RoutesClient from './routes';
9
- import ValidateClient from './validate';
10
- import IpsClient from './ips';
11
- import IpPoolsClient from './ip-pools';
12
- import ListsClient from './lists';
13
- import { InputFormData } from './interfaces/IFormData';
14
- export default class Client {
15
- private request;
16
- domains: DomainClient;
17
- webhooks: WebhookClient;
18
- events: EventClient;
19
- stats: StatsClient;
20
- suppressions: SuppressionClient;
21
- messages: MessagesClient;
22
- routes: RoutesClient;
23
- validate: ValidateClient;
24
- ips: IpsClient;
25
- ip_pools: IpPoolsClient;
26
- lists: ListsClient;
27
- constructor(options: Options, formData: InputFormData);
28
- }
@@ -1,53 +0,0 @@
1
- import { DomainsQuery, DomainInfo, DomainShortData, DNSRecord, ConnectionSettings, UpdatedConnectionSettings, DKIMAuthorityInfo, UpdatedDKIMAuthority, DKIMSelectorInfo, UpdatedDKIMSelectorResponse, WebPrefixInfo, UpdatedWebPrefixResponse, ReplacementForPool, MessageResponse } from './interfaces/Domains';
2
- import APIResponse from './interfaces/ApiResponse';
3
- import Request from './request';
4
- import { DomainTrackingData, OpenTrackingInfo, ClickTrackingInfo, UnsubscribeTrackingInfo, UpdatedOpenTracking } from './interfaces/DomainTracking';
5
- import { IDomainCredentials } from './interfaces/DomainCredentials';
6
- import { IDomainTemplatesClient } from './interfaces/DomainTemplates';
7
- import DomainCredentialsClient from './domainsCredentials';
8
- import DomainTemplatesClient from './domainsTemplates';
9
- import { IDomainTagsClient } from './interfaces/DomainTags';
10
- import DomainTagsClient from './domainsTags';
11
- export declare class Domain {
12
- name: string;
13
- require_tls: boolean;
14
- skip_verification: boolean;
15
- state: string;
16
- wildcard: boolean;
17
- spam_action: string;
18
- created_at: string;
19
- smtp_password: string;
20
- smtp_login: string;
21
- type: string;
22
- receiving_dns_records: DNSRecord[] | null;
23
- sending_dns_records: DNSRecord[] | null;
24
- constructor(data: DomainShortData, receiving?: DNSRecord[] | null, sending?: DNSRecord[] | null);
25
- }
26
- export default class DomainClient {
27
- request: Request;
28
- domainCredentials: IDomainCredentials;
29
- domainTemplates: IDomainTemplatesClient;
30
- domainTags: IDomainTagsClient;
31
- constructor(request: Request, domainCredentialsClient: DomainCredentialsClient, domainTemplatesClient: DomainTemplatesClient, domainTagsClient: DomainTagsClient);
32
- private _parseMessage;
33
- private _parseDomainList;
34
- private _parseDomain;
35
- private _parseTrackingSettings;
36
- private _parseTrackingUpdate;
37
- list(query?: DomainsQuery): Promise<Domain[]>;
38
- get(domain: string): Promise<Domain>;
39
- create(data: DomainInfo): Promise<Domain>;
40
- destroy(domain: string): Promise<MessageResponse>;
41
- getConnection(domain: string): Promise<ConnectionSettings>;
42
- updateConnection(domain: string, data: ConnectionSettings): Promise<UpdatedConnectionSettings>;
43
- getTracking(domain: string): Promise<DomainTrackingData>;
44
- updateTracking(domain: string, type: string, data: OpenTrackingInfo | ClickTrackingInfo | UnsubscribeTrackingInfo): Promise<UpdatedOpenTracking>;
45
- getIps(domain: string): Promise<string[]>;
46
- assignIp(domain: string, ip: string): Promise<APIResponse>;
47
- deleteIp(domain: string, ip: string): Promise<APIResponse>;
48
- linkIpPool(domain: string, pool_id: string): Promise<APIResponse>;
49
- unlinkIpPoll(domain: string, replacement: ReplacementForPool): Promise<APIResponse>;
50
- updateDKIMAuthority(domain: string, data: DKIMAuthorityInfo): Promise<UpdatedDKIMAuthority>;
51
- updateDKIMSelector(domain: string, data: DKIMSelectorInfo): Promise<UpdatedDKIMSelectorResponse>;
52
- updateWebPrefix(domain: string, data: WebPrefixInfo): Promise<UpdatedWebPrefixResponse>;
53
- }
@@ -1,14 +0,0 @@
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
- }
@@ -1,34 +0,0 @@
1
- import Request from './request';
2
- import { DomainTagCountriesAggregation, DomainTagDevicesAggregation, DomainTagProvidersAggregation, DomainTagsItem, DomainTagsItemInfo, DomainTagsList, DomainTagsMessageRes, DomainTagsQuery, DomainTagsStatisticQuery, DomainTagStatAPIResponse, DomainTagStatisticItem, DomainTagStatisticResult, IDomainTagsClient, Resolution } from './interfaces/DomainTags';
3
- export declare class DomainTag implements DomainTagsItem {
4
- tag: string;
5
- description: string;
6
- 'first-seen': Date;
7
- 'last-seen': Date;
8
- constructor(tagInfo: DomainTagsItemInfo);
9
- }
10
- export declare class DomainTagStatistic implements DomainTagStatisticResult {
11
- tag: string;
12
- description: string;
13
- start: Date;
14
- end: Date;
15
- resolution: Resolution;
16
- stats: DomainTagStatisticItem[];
17
- constructor(tagStatisticInfo: DomainTagStatAPIResponse);
18
- }
19
- export default class DomainTagsClient implements IDomainTagsClient {
20
- baseRoute: string;
21
- request: Request;
22
- constructor(request: Request);
23
- private _parsePageLinks;
24
- private _parseDomainTagsList;
25
- private _parseTagStatistic;
26
- list(domain: string, query?: DomainTagsQuery): Promise<DomainTagsList>;
27
- get(domain: string, tag: string): Promise<DomainTagsItem>;
28
- update(domain: string, tag: string, description: string): Promise<DomainTagsMessageRes>;
29
- destroy(domain: string, tag: string): Promise<DomainTagsMessageRes>;
30
- statistic(domain: string, tag: string, query: DomainTagsStatisticQuery): Promise<DomainTagStatistic>;
31
- countries(domain: string, tag: string): Promise<DomainTagCountriesAggregation>;
32
- providers(domain: string, tag: string): Promise<DomainTagProvidersAggregation>;
33
- devices(domain: string, tag: string): Promise<DomainTagDevicesAggregation>;
34
- }
@@ -1,35 +0,0 @@
1
- import Request from './request';
2
- import { CreateDomainTemplateVersionResult, DomainTemplate, DomainTemplateData, DomainTemplatesQuery, DomainTemplateUpdateData, DomainTemplateUpdateVersionData, DomainTemplateVersionData, IDomainTemplatesClient, ListDomainTemplatesResult, ListDomainTemplateVersionsResult, MutateDomainTemplateVersionResult, NotificationResult, ShortTemplateVersion, TemplateQuery, TemplateVersion, UpdateOrDeleteDomainTemplateResult } from './interfaces/DomainTemplates';
3
- export declare class DomainTemplateItem implements DomainTemplate {
4
- name: string;
5
- description: string;
6
- createdAt: Date | '';
7
- createdBy: string;
8
- id: string;
9
- version?: TemplateVersion;
10
- versions?: ShortTemplateVersion[];
11
- constructor(domainTemplateFromAPI: DomainTemplate);
12
- }
13
- export default class DomainTemplatesClient implements IDomainTemplatesClient {
14
- baseRoute: string;
15
- request: Request;
16
- constructor(request: Request);
17
- private parseCreationResponse;
18
- private parseCreationVersionResponse;
19
- private parseMutationResponse;
20
- private parseNotificationResponse;
21
- private parseMutateTemplateVersionResponse;
22
- private parseList;
23
- private parseListTemplateVersions;
24
- list(domain: string, query?: DomainTemplatesQuery): Promise<ListDomainTemplatesResult>;
25
- get(domain: string, templateName: string, query?: TemplateQuery): Promise<DomainTemplateItem>;
26
- create(domain: string, data: DomainTemplateData): Promise<DomainTemplateItem>;
27
- update(domain: string, templateName: string, data: DomainTemplateUpdateData): Promise<UpdateOrDeleteDomainTemplateResult>;
28
- destroy(domain: string, templateName: string): Promise<UpdateOrDeleteDomainTemplateResult>;
29
- destroyAll(domain: string): Promise<NotificationResult>;
30
- createVersion(domain: string, templateName: string, data: DomainTemplateVersionData): Promise<CreateDomainTemplateVersionResult>;
31
- getVersion(domain: string, templateName: string, tag: string): Promise<DomainTemplateItem>;
32
- updateVersion(domain: string, templateName: string, tag: string, data: DomainTemplateUpdateVersionData): Promise<MutateDomainTemplateVersionResult>;
33
- destroyVersion(domain: string, templateName: string, tag: string): Promise<MutateDomainTemplateVersionResult>;
34
- listVersions(domain: string, templateName: string, query?: DomainTemplatesQuery): Promise<ListDomainTemplateVersionsResult>;
35
- }
@@ -1,7 +0,0 @@
1
- import APIErrorOptions from './interfaces/APIErrorOptions';
2
- export default class APIError extends Error {
3
- status: number | string;
4
- stack: string;
5
- details: string;
6
- constructor({ status, statusText, message, body }: APIErrorOptions);
7
- }
@@ -1,13 +0,0 @@
1
- import { EventsList, EventsPage, EventsResponse, ParsedPagesList } from './interfaces/Events';
2
- import Request from './request';
3
- export default class EventClient {
4
- request: Request;
5
- constructor(request: Request);
6
- _parsePageNumber(url: string): string;
7
- _parsePage(id: string, url: string): EventsPage;
8
- _parsePageLinks(response: EventsResponse): ParsedPagesList;
9
- _parseEventList(response: EventsResponse): EventsList;
10
- get(domain: string, query?: {
11
- page: string;
12
- }): Promise<EventsList>;
13
- }
@@ -1,11 +0,0 @@
1
- interface APIErrorOptions {
2
- headers: {
3
- [key: string]: any;
4
- };
5
- status: number | string;
6
- message: string;
7
- body: any;
8
- url: string;
9
- statusText: string;
10
- }
11
- export default APIErrorOptions;
@@ -1,5 +0,0 @@
1
- interface APIResponse {
2
- status: number;
3
- body: any;
4
- }
5
- export default APIResponse;