mailgun.js 4.2.1 → 5.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.
Files changed (55) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/dist/mailgun.js.d.ts +1513 -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/{index.ts → lib/index.ts} +3 -3
  11. package/lib/request.ts +1 -1
  12. package/package.json +11 -6
  13. package/webpack/webpack.common.config.js +2 -2
  14. package/dist/index.d.ts +0 -9
  15. package/dist/lib/client.d.ts +0 -28
  16. package/dist/lib/domains.d.ts +0 -53
  17. package/dist/lib/domainsCredentials.d.ts +0 -14
  18. package/dist/lib/domainsTags.d.ts +0 -34
  19. package/dist/lib/domainsTemplates.d.ts +0 -35
  20. package/dist/lib/error.d.ts +0 -7
  21. package/dist/lib/events.d.ts +0 -13
  22. package/dist/lib/interfaces/APIErrorOptions.d.ts +0 -11
  23. package/dist/lib/interfaces/ApiResponse.d.ts +0 -5
  24. package/dist/lib/interfaces/DomainCredentials.d.ts +0 -52
  25. package/dist/lib/interfaces/DomainTags.d.ts +0 -228
  26. package/dist/lib/interfaces/DomainTemplates.d.ts +0 -194
  27. package/dist/lib/interfaces/DomainTracking.d.ts +0 -48
  28. package/dist/lib/interfaces/Domains.d.ts +0 -121
  29. package/dist/lib/interfaces/Events.d.ts +0 -88
  30. package/dist/lib/interfaces/IFormData.d.ts +0 -7
  31. package/dist/lib/interfaces/IpPools.d.ts +0 -19
  32. package/dist/lib/interfaces/Ips.d.ts +0 -10
  33. package/dist/lib/interfaces/MultipleValidation.d.ts +0 -55
  34. package/dist/lib/interfaces/Options.d.ts +0 -8
  35. package/dist/lib/interfaces/RequestOptions.d.ts +0 -6
  36. package/dist/lib/interfaces/StatsOptions.d.ts +0 -21
  37. package/dist/lib/interfaces/Supressions.d.ts +0 -21
  38. package/dist/lib/interfaces/Validate.d.ts +0 -12
  39. package/dist/lib/interfaces/Webhooks.d.ts +0 -25
  40. package/dist/lib/interfaces/lists.d.ts +0 -25
  41. package/dist/lib/interfaces/mailListMembers.d.ts +0 -52
  42. package/dist/lib/interfaces/routes.d.ts +0 -25
  43. package/dist/lib/ip-pools.d.ts +0 -21
  44. package/dist/lib/ips.d.ts +0 -9
  45. package/dist/lib/lists.d.ts +0 -14
  46. package/dist/lib/mailListMembers.d.ts +0 -14
  47. package/dist/lib/messages.d.ts +0 -9
  48. package/dist/lib/multipleValidation.d.ts +0 -10
  49. package/dist/lib/parse.d.ts +0 -0
  50. package/dist/lib/request.d.ts +0 -31
  51. package/dist/lib/routes.d.ts +0 -11
  52. package/dist/lib/stats.d.ts +0 -20
  53. package/dist/lib/suppressions.d.ts +0 -67
  54. package/dist/lib/validate.d.ts +0 -9
  55. 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.0 */
7
+ /*! mailgun.js v4.2.3 */
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
 
@@ -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
package/lib/request.ts CHANGED
@@ -111,7 +111,7 @@ class Request {
111
111
  body: await response?.json(),
112
112
  status: response?.status
113
113
  };
114
- console.log('res ------------->', res);
114
+
115
115
  return res;
116
116
  }
117
117
 
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "mailgun.js",
3
- "version": "4.2.1",
3
+ "version": "5.0.0",
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
  }
@@ -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;
@@ -1,52 +0,0 @@
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
- }
@@ -1,228 +0,0 @@
1
- import { DomainTagStatistic } from '../domainsTags';
2
- export declare enum Resolution {
3
- HOUR = "hour",
4
- DAY = "day",
5
- MONTH = "month"
6
- }
7
- export interface DomainTagsQuery {
8
- limit: number;
9
- }
10
- export interface DomainTagsStatisticQuery {
11
- event: string;
12
- start?: number;
13
- end?: number;
14
- resolution?: Resolution;
15
- duration?: string;
16
- }
17
- export interface DomainTagsItemInfo {
18
- tag: string;
19
- description: string;
20
- 'first-seen': string;
21
- 'last-seen': string;
22
- }
23
- export interface DomainTagsItem {
24
- tag: string;
25
- description: string;
26
- 'first-seen': Date;
27
- 'last-seen': Date;
28
- }
29
- export interface PagesList {
30
- previous: string;
31
- first: string;
32
- last: string;
33
- next: string;
34
- }
35
- export interface ParsedPage {
36
- id: string;
37
- url: string;
38
- }
39
- export interface ParsedPagesList {
40
- previous: ParsedPage;
41
- first: ParsedPage;
42
- last: ParsedPage;
43
- next: ParsedPage;
44
- }
45
- export interface TagsPage {
46
- id: string;
47
- url: string;
48
- }
49
- export interface PagesListAccumulator {
50
- [index: string]: TagsPage;
51
- }
52
- export interface DomainTagsResponseData {
53
- status: number;
54
- body: {
55
- items: DomainTagsItemInfo[];
56
- paging: PagesList;
57
- };
58
- }
59
- export interface DomainTagsList {
60
- items: DomainTagsItem[];
61
- pages: ParsedPagesList;
62
- }
63
- export interface DomainTagsMessageRes {
64
- message: string;
65
- status?: number;
66
- }
67
- export interface DomainTagAPIResponseStatsItem {
68
- time: string;
69
- accepted?: {
70
- incoming: number;
71
- outgoing: number;
72
- total: number;
73
- };
74
- delivered?: {
75
- smtp: number;
76
- http: number;
77
- optimized: number;
78
- total: number;
79
- };
80
- opened?: {
81
- total: number;
82
- };
83
- failed?: {
84
- temporary: {
85
- espblock: number;
86
- total: number;
87
- };
88
- permanent: {
89
- 'suppress-bounce': number;
90
- 'suppress-unsubscribe': number;
91
- 'suppress-complaint': number;
92
- bounce: number;
93
- 'delayed-bounce': number;
94
- webhook: number;
95
- optimized: number;
96
- total: number;
97
- };
98
- };
99
- clicked?: {
100
- total: number;
101
- };
102
- unsubscribed?: {
103
- total: number;
104
- };
105
- complained?: {
106
- total: number;
107
- };
108
- stored?: {
109
- total: number;
110
- };
111
- }
112
- export interface DomainTagStatAPIResponse {
113
- body: {
114
- tag: string;
115
- description: string;
116
- start: string;
117
- end: string;
118
- resolution: Resolution;
119
- stats: DomainTagAPIResponseStatsItem[];
120
- };
121
- }
122
- export interface DomainTagStatisticItem extends Omit<DomainTagAPIResponseStatsItem, 'time'> {
123
- time: Date;
124
- }
125
- export interface DomainTagStatisticResult {
126
- tag: string;
127
- description: string;
128
- start: Date;
129
- end: Date;
130
- resolution: Resolution;
131
- stats: DomainTagStatisticItem[];
132
- }
133
- export interface DomainTagCountriesAPIResponse {
134
- body: {
135
- tag: string;
136
- country: {
137
- [key: string]: {
138
- clicked: number;
139
- complained: number;
140
- opened: number;
141
- unique_clicked: number;
142
- unique_opened: number;
143
- unsubscribed: number;
144
- };
145
- };
146
- };
147
- }
148
- export interface DomainTagCountriesAggregation {
149
- tag: string;
150
- country: {
151
- [key: string]: {
152
- clicked: number;
153
- complained: number;
154
- opened: number;
155
- unique_clicked: number;
156
- unique_opened: number;
157
- unsubscribed: number;
158
- };
159
- };
160
- }
161
- export interface DomainTagProvidersAPIResponse {
162
- body: {
163
- tag: string;
164
- provider: {
165
- [key: string]: {
166
- accepted: number;
167
- clicked: number;
168
- complained: number;
169
- delivered: number;
170
- opened: number;
171
- unique_clicked: number;
172
- unique_opened: number;
173
- unsubscribed: number;
174
- };
175
- };
176
- };
177
- status: number;
178
- }
179
- export interface DomainTagProvidersAggregation {
180
- tag: string;
181
- provider: {
182
- [key: string]: {
183
- accepted: number;
184
- clicked: number;
185
- complained: number;
186
- delivered: number;
187
- opened: number;
188
- unique_clicked: number;
189
- unique_opened: number;
190
- unsubscribed: number;
191
- };
192
- };
193
- }
194
- export interface DeviceStatistic {
195
- clicked: number;
196
- complained: number;
197
- opened: number;
198
- unique_clicked: number;
199
- unique_opened: number;
200
- unsubscribed: number;
201
- }
202
- export interface DevicesTypes {
203
- desktop: DeviceStatistic;
204
- mobile: DeviceStatistic;
205
- tablet: DeviceStatistic;
206
- unknown: DeviceStatistic;
207
- }
208
- export interface DomainTagDevicesAPIResponse {
209
- body: {
210
- tag: string;
211
- device: DevicesTypes;
212
- };
213
- status: number;
214
- }
215
- export interface DomainTagDevicesAggregation {
216
- tag: string;
217
- device: DevicesTypes;
218
- }
219
- export interface IDomainTagsClient {
220
- list(domain: string): Promise<DomainTagsList>;
221
- get(domain: string, tag: string): Promise<DomainTagsItem>;
222
- update(domain: string, tag: string, description: string): Promise<DomainTagsMessageRes>;
223
- destroy(domain: string, tag: string): Promise<DomainTagsMessageRes>;
224
- statistic(domain: string, tag: string, query: DomainTagsStatisticQuery): Promise<DomainTagStatistic>;
225
- countries(domain: string, tag: string): Promise<DomainTagCountriesAggregation>;
226
- providers(domain: string, tag: string): Promise<DomainTagProvidersAggregation>;
227
- devices(domain: string, tag: string): Promise<DomainTagDevicesAggregation>;
228
- }