mailgun.js 7.0.3 → 8.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +75 -0
- package/README.md +167 -1
- package/common/NavigationThruPages.d.ts +19 -0
- package/domainsTags.d.ts +4 -4
- package/domainsTemplates.d.ts +4 -3
- package/events.d.ts +4 -6
- package/interfaces/DomainTags.d.ts +3 -23
- package/interfaces/DomainTemplates.d.ts +6 -26
- package/interfaces/Events.d.ts +3 -20
- package/interfaces/Messages.d.ts +28 -13
- package/interfaces/MultipleValidation.d.ts +46 -17
- package/interfaces/NavigationThruPages.d.ts +33 -0
- package/interfaces/Suppressions/Bounce.d.ts +13 -0
- package/interfaces/Suppressions/Complaint.d.ts +9 -0
- package/interfaces/Suppressions/Suppressions.d.ts +69 -0
- package/interfaces/Suppressions/Unsubscribe.d.ts +11 -0
- package/interfaces/Suppressions/WhiteList.d.ts +12 -0
- package/interfaces/lists.d.ts +14 -1
- package/interfaces/mailListMembers.d.ts +18 -2
- package/lists.d.ts +5 -3
- package/mailListMembers.d.ts +5 -3
- package/mailgun.node.js +2 -2
- package/mailgun.node.js.LICENSE.txt +1 -1
- package/mailgun.web.js +2 -2
- package/mailgun.web.js.LICENSE.txt +1 -1
- package/multipleValidation.d.ts +33 -3
- package/package.json +2 -3
- package/suppressions.d.ts +14 -11
- package/version.md +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,81 @@
|
|
|
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
|
+
### [8.0.1](https://github.com/mailgun/mailgun.js/compare/v8.0.0...v8.0.1) (2022-08-30)
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
### Bug Fixes
|
|
9
|
+
|
|
10
|
+
* Move webpack-merge to the dev dependencies ([68304c2](https://github.com/mailgun/mailgun.js/commits/68304c20f28ad38b8202ddf008c4a5f0786f1f54))
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Other changes
|
|
14
|
+
|
|
15
|
+
* Update build ([633e539](https://github.com/mailgun/mailgun.js/commits/633e5392b5bc2843fa08e3541a63f5b67179dcf6))
|
|
16
|
+
* Update send-email example ([a5a7c5a](https://github.com/mailgun/mailgun.js/commits/a5a7c5aeaa560cf8e6d6d9936b9c0137e84ba7e9))
|
|
17
|
+
|
|
18
|
+
## [8.0.0](https://github.com/mailgun/mailgun.js/compare/v7.0.4...v8.0.0) (2022-07-28)
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
### ⚠ BREAKING CHANGES
|
|
22
|
+
|
|
23
|
+
* (MultipleValidationClient) Changed result interface for Multiple Validation.
|
|
24
|
+
* (ListsClient) property with the name 'skip' was replaced by 'page' in the ListsQuery interface.
|
|
25
|
+
* (ListsClient.list)'list' method changed the response interface to MailingListResult
|
|
26
|
+
* Unify iterating thru pages in Domain Templates
|
|
27
|
+
* (SuppressionClient) Some interfaces moved from Suppressions.d.ts to separate files
|
|
28
|
+
(SuppressionClient.list) Property with name 'address' was replaced by iteratorPosition in the response in 'pages'
|
|
29
|
+
* (EventClient.get) Number propery was replaced by iteratorPosition in pages property of response
|
|
30
|
+
* (DomainTagsClient) Page property was added to DomainTagsQuery.
|
|
31
|
+
* (DomainTagsClient) Status property was added to DomainTagsList.
|
|
32
|
+
* (DomainTagsClient) Address property replaced by iteratorPosition in ParsedPage for list method.
|
|
33
|
+
* (MailListsMembers) Updated listMembers response to be object with MailListMembersResult interface
|
|
34
|
+
|
|
35
|
+
### Features
|
|
36
|
+
|
|
37
|
+
* Add query to MultipleValidationClient ([2a7fd64](https://github.com/mailgun/mailgun.js/commits/2a7fd646af22675c75c81d144821f1d05ce87815))
|
|
38
|
+
* Unify iterating thru pages in domain tags ([2ee7bd2](https://github.com/mailgun/mailgun.js/commits/2ee7bd2afee6d397ae41357c9cf66e4c88e7feff))
|
|
39
|
+
* Unify iterating thru pages in Domain Templates ([2dcf453](https://github.com/mailgun/mailgun.js/commits/2dcf453ad9c53d2359620f890edd709f373e9aee))
|
|
40
|
+
* Unify iterating thru pages in events ([41de3bb](https://github.com/mailgun/mailgun.js/commits/41de3bb084dc3c5b90abb81cdcfe7c365b6df097))
|
|
41
|
+
* Unify iterating thru pages in Mailing lists ([40a6859](https://github.com/mailgun/mailgun.js/commits/40a685944057c308e7cb09c7f8d02b2b7177b87e))
|
|
42
|
+
* Unify iterating thru pages in Multiple Validations ([db0d1f8](https://github.com/mailgun/mailgun.js/commits/db0d1f8629dda5849ff54a95607b7b388dde57d9))
|
|
43
|
+
* Unify iterating thru pages in suppressions ([11962dc](https://github.com/mailgun/mailgun.js/commits/11962dcb7f8fe716af4f559ab97984154f3a30c6))
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
### Bug Fixes
|
|
47
|
+
|
|
48
|
+
* Fix assignment for force_dkim_authority ([ab442fe](https://github.com/mailgun/mailgun.js/commits/ab442fea88631e0e09c9399f14e1498782cc8373))
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
### Breaking changes
|
|
52
|
+
|
|
53
|
+
* Add pages navigation for mail list members ([a62ebbf](https://github.com/mailgun/mailgun.js/commits/a62ebbfc26768d56d78d1514836e97f8fdf1351f))
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
### Other changes
|
|
57
|
+
|
|
58
|
+
* Add release:test command ([6fd1e48](https://github.com/mailgun/mailgun.js/commits/6fd1e48f17bfb001f3fa337a85bbca9714025532))
|
|
59
|
+
* Increase test coverage ([93014da](https://github.com/mailgun/mailgun.js/commits/93014dafc2ff91cc9b8ef52830472e9d354cb605))
|
|
60
|
+
* Move duplicate logic to common class ([4603fd2](https://github.com/mailgun/mailgun.js/commits/4603fd2d35c0e94499aa0914b3c42168ece6d203))
|
|
61
|
+
* Regenerate docs ([665068d](https://github.com/mailgun/mailgun.js/commits/665068d210b1b36b17cb4678dab178686db0c232))
|
|
62
|
+
* Update commitlint rules ([a5a8897](https://github.com/mailgun/mailgun.js/commits/a5a8897932cb2499f62aabaf31f6f5c8650236a5))
|
|
63
|
+
* Update readme ([3c32f1b](https://github.com/mailgun/mailgun.js/commits/3c32f1b726c0f19bcd5e009bd36b12c98e23cc8d))
|
|
64
|
+
|
|
65
|
+
### [7.0.4](https://github.com/mailgun/mailgun.js/compare/v7.0.3...v7.0.4) (2022-07-07)
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
### Bug Fixes
|
|
69
|
+
|
|
70
|
+
* Message Data (one of text, html, template required) ([abd2862](https://github.com/mailgun/mailgun.js/commits/abd2862fcf36ca54d68dea14cb2b2658d33092ec))
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
### Other changes
|
|
74
|
+
|
|
75
|
+
* Add content to message data ([a878cc1](https://github.com/mailgun/mailgun.js/commits/a878cc1acb0b4ca441b100278ca0fd2b47d137e3))
|
|
76
|
+
* Add propetry for mime messages ([f701cfb](https://github.com/mailgun/mailgun.js/commits/f701cfb591f08dbb882953bb2b77131fae089bad))
|
|
77
|
+
* Fix build error ([c7fcb5e](https://github.com/mailgun/mailgun.js/commits/c7fcb5e05bd84fc6ef04589bde37846a11f9466d))
|
|
78
|
+
* Fix tests ([b4791c4](https://github.com/mailgun/mailgun.js/commits/b4791c4e746a97aec359635272c2b29cb956ab6f))
|
|
79
|
+
|
|
5
80
|
### [7.0.3](https://github.com/mailgun/mailgun.js/compare/v7.0.2...v7.0.3) (2022-06-30)
|
|
6
81
|
|
|
7
82
|
|
package/README.md
CHANGED
|
@@ -110,6 +110,7 @@ The following service methods are available to instantiated clients. The example
|
|
|
110
110
|
- [createMembers](#createmembers)
|
|
111
111
|
- [updateMember](#updatemember)
|
|
112
112
|
- [destroyMember](#destroymember)
|
|
113
|
+
- [Navigation thru lists](#navigation-thru-lists)
|
|
113
114
|
- [Browser Demo](#browser-demo)
|
|
114
115
|
- [Development](#development)
|
|
115
116
|
- [Requirements](#requirements)
|
|
@@ -1793,13 +1794,178 @@ mg.lists.members.destroyMember('reply@sample.com', 'bot2@foobar.com')
|
|
|
1793
1794
|
|
|
1794
1795
|
Promise Returns: response body
|
|
1795
1796
|
|
|
1796
|
-
```
|
|
1797
|
+
```js
|
|
1797
1798
|
{
|
|
1798
1799
|
member: { address: 'bot2@foobar.com' },
|
|
1799
1800
|
message: 'Mailing list member has been deleted'
|
|
1800
1801
|
}
|
|
1801
1802
|
```
|
|
1802
1803
|
|
|
1804
|
+
## Navigation thru lists
|
|
1805
|
+
Most of the methods that return items in a list support pagination.
|
|
1806
|
+
There are two ways to receive part of the list:
|
|
1807
|
+
1. Provide properties 'limit' and 'page' in the query.
|
|
1808
|
+
This way uses more frequently in the SDK and works for the next methods:
|
|
1809
|
+
- mg.domains.domainTags.list()
|
|
1810
|
+
- mg.domains.domainTemplates.list()
|
|
1811
|
+
- mg.domains.domainTemplates.listVersions()
|
|
1812
|
+
- mg.events.get()
|
|
1813
|
+
- mg.lists.list()
|
|
1814
|
+
- mg.lists.members.listMembers()
|
|
1815
|
+
- mg.validate.list()
|
|
1816
|
+
- mg.suppressions.list()
|
|
1817
|
+
|
|
1818
|
+
The general idea is that after you made the first call with a limit property in the query you will receive a response with a property called pages in it. This property implements the next interface:
|
|
1819
|
+
|
|
1820
|
+
```TS
|
|
1821
|
+
{
|
|
1822
|
+
previous: {
|
|
1823
|
+
id: string;
|
|
1824
|
+
page: string;
|
|
1825
|
+
iteratorPosition: string | undefined;
|
|
1826
|
+
url: string
|
|
1827
|
+
};
|
|
1828
|
+
first: {
|
|
1829
|
+
id: string;
|
|
1830
|
+
page: string;
|
|
1831
|
+
iteratorPosition: string | undefined;
|
|
1832
|
+
url: string
|
|
1833
|
+
};
|
|
1834
|
+
last: {
|
|
1835
|
+
id: string;
|
|
1836
|
+
page: string;
|
|
1837
|
+
iteratorPosition: string | undefined;
|
|
1838
|
+
url: string
|
|
1839
|
+
};
|
|
1840
|
+
next: {
|
|
1841
|
+
id: string;
|
|
1842
|
+
page: string;
|
|
1843
|
+
iteratorPosition: string | undefined;
|
|
1844
|
+
url: string
|
|
1845
|
+
};
|
|
1846
|
+
}
|
|
1847
|
+
```
|
|
1848
|
+
To receive the next page you need to add the page property to the query argument. This property should contain a string value from 'page' property in response.pages.(previous/first/last/next).
|
|
1849
|
+
|
|
1850
|
+
Example:
|
|
1851
|
+
```Js
|
|
1852
|
+
// first call
|
|
1853
|
+
const listMembers = await mg.lists.members.listMembers('your_mailing_list', { limit: 2 });
|
|
1854
|
+
|
|
1855
|
+
/* response
|
|
1856
|
+
{
|
|
1857
|
+
items: [
|
|
1858
|
+
{
|
|
1859
|
+
address: 'test-0@example.com',
|
|
1860
|
+
name: 'test name 0',
|
|
1861
|
+
subscribed: true,
|
|
1862
|
+
vars: [Object]
|
|
1863
|
+
},
|
|
1864
|
+
{
|
|
1865
|
+
address: 'test-1@example.com',
|
|
1866
|
+
name: 'test name 1',
|
|
1867
|
+
subscribed: true,
|
|
1868
|
+
vars: [Object]
|
|
1869
|
+
}
|
|
1870
|
+
],
|
|
1871
|
+
pages: {
|
|
1872
|
+
first: {
|
|
1873
|
+
id: 'first',
|
|
1874
|
+
page: '?page=first&limit=2',
|
|
1875
|
+
iteratorPosition: undefined,
|
|
1876
|
+
url: 'https://your_domain/v3/lists/your_mailing_list/members/pages?page=first&limit=2'
|
|
1877
|
+
},
|
|
1878
|
+
last: {
|
|
1879
|
+
id: 'last',
|
|
1880
|
+
page: '?page=last&limit=2',
|
|
1881
|
+
iteratorPosition: undefined,
|
|
1882
|
+
url: 'https://your_domain/v3/lists/your_mailing_list/members/pages?page=last&limit=2'
|
|
1883
|
+
},
|
|
1884
|
+
next: {
|
|
1885
|
+
id: 'next',
|
|
1886
|
+
page: '?page=next&address=test-1%40example.com&limit=2',
|
|
1887
|
+
iteratorPosition: 'test-1@example.com',
|
|
1888
|
+
url: 'https://your_domain/v3/lists/your_mailing_list/members/pages?page=next&address=test-1%40example.com&limit=2'
|
|
1889
|
+
},
|
|
1890
|
+
previous: {
|
|
1891
|
+
id: 'previous',
|
|
1892
|
+
page: '?page=prev&address=test-0%40example.com&limit=2',
|
|
1893
|
+
iteratorPosition: 'test-0@example.com',
|
|
1894
|
+
url: 'https://your_domain/v3/lists/your_mailing_list/members/pages?page=prev&address=test-0%40example.com&limit=2'
|
|
1895
|
+
}
|
|
1896
|
+
}
|
|
1897
|
+
}
|
|
1898
|
+
*/
|
|
1899
|
+
// second call
|
|
1900
|
+
const listMembers = await mg.lists.members.listMembers(
|
|
1901
|
+
'your_mailing_list',
|
|
1902
|
+
{
|
|
1903
|
+
limit: 2,
|
|
1904
|
+
page: '?page=next&address=test-1%40example.com&limit=2'
|
|
1905
|
+
}
|
|
1906
|
+
);
|
|
1907
|
+
|
|
1908
|
+
/* response
|
|
1909
|
+
{
|
|
1910
|
+
items: [
|
|
1911
|
+
{
|
|
1912
|
+
address: 'test-2@example.com',
|
|
1913
|
+
name: 'test name 2',
|
|
1914
|
+
subscribed: true,
|
|
1915
|
+
vars: [Object]
|
|
1916
|
+
},
|
|
1917
|
+
{
|
|
1918
|
+
address: 'test-3@example.com',
|
|
1919
|
+
name: 'test name 3',
|
|
1920
|
+
subscribed: true,
|
|
1921
|
+
vars: [Object]
|
|
1922
|
+
}
|
|
1923
|
+
],
|
|
1924
|
+
pages: {
|
|
1925
|
+
first: {
|
|
1926
|
+
id: 'first',
|
|
1927
|
+
page: '?page=first&limit=2',
|
|
1928
|
+
iteratorPosition: undefined,
|
|
1929
|
+
url: 'https://your_domain/v3/lists/your_mailing_list/members/pages?page=first&limit=2'
|
|
1930
|
+
},
|
|
1931
|
+
last: {
|
|
1932
|
+
id: 'last',
|
|
1933
|
+
page: '?page=last&limit=2',
|
|
1934
|
+
iteratorPosition: undefined,
|
|
1935
|
+
url: 'https://your_domain/v3/lists/your_mailing_list/members/pages?page=last&limit=2'
|
|
1936
|
+
},
|
|
1937
|
+
next: {
|
|
1938
|
+
id: 'next',
|
|
1939
|
+
page: '?page=next&address=test-3%40example.com&limit=2',
|
|
1940
|
+
iteratorPosition: 'test-3@example.com',
|
|
1941
|
+
url: 'https://your_domain/v3/lists/your_mailing_list/members/pages?page=next&address=test-3%40example.com&limit=2'
|
|
1942
|
+
},
|
|
1943
|
+
previous: {
|
|
1944
|
+
id: 'previous',
|
|
1945
|
+
page: '?page=prev&address=test-2%40example.com&limit=2',
|
|
1946
|
+
iteratorPosition: 'test-2@example.com',
|
|
1947
|
+
url: 'https://your_domain/v3/lists/your_mailing_list/members/pages?page=prev&address=test-2%40example.com&limit=2'
|
|
1948
|
+
}
|
|
1949
|
+
}
|
|
1950
|
+
}
|
|
1951
|
+
*/
|
|
1952
|
+
```
|
|
1953
|
+
2. The second option of navigation is to provide properties 'limit' and 'skip' in the query. This way uses only in a few places for now:
|
|
1954
|
+
- mg.domains.list()
|
|
1955
|
+
- mg.domains.domainCredentials.list()
|
|
1956
|
+
- mg.routes.list()
|
|
1957
|
+
- mg.webhooks.list()
|
|
1958
|
+
The main idea here is quite simple you just need to provide how many records from the start of a list you want to skip and how many to receive. You can do it using the query parameter in each method.
|
|
1959
|
+
Example:
|
|
1960
|
+
```js
|
|
1961
|
+
const listDomainCredentials = await client.domains.domainCredentials.list(
|
|
1962
|
+
'your_domain_name',
|
|
1963
|
+
{
|
|
1964
|
+
skip: 10,
|
|
1965
|
+
limit: 1
|
|
1966
|
+
}
|
|
1967
|
+
);
|
|
1968
|
+
```
|
|
1803
1969
|
|
|
1804
1970
|
|
|
1805
1971
|
## Browser Demo
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { ParsedPage, ParsedPagesList, QueryWithPage, ResponseWithPaging } from '../interfaces/NavigationThruPages';
|
|
2
|
+
import { BounceData, IBounce } from '../interfaces/Suppressions/Bounce';
|
|
3
|
+
import { ComplaintData, IComplaint } from '../interfaces/Suppressions/Complaint';
|
|
4
|
+
import { IUnsubscribe, UnsubscribeData } from '../interfaces/Suppressions/Unsubscribe';
|
|
5
|
+
import { IWhiteList, WhiteListData } from '../interfaces/Suppressions/WhiteList';
|
|
6
|
+
import Request from '../request';
|
|
7
|
+
export default abstract class NavigationThruPages<T> {
|
|
8
|
+
request?: Request;
|
|
9
|
+
constructor(request?: Request);
|
|
10
|
+
protected parsePage(id: string, pageUrl: string, urlSeparator: string, iteratorName: string | undefined): ParsedPage;
|
|
11
|
+
protected parsePageLinks(response: ResponseWithPaging, urlSeparator: string, iteratorName?: string): ParsedPagesList;
|
|
12
|
+
private updateUrlAndQuery;
|
|
13
|
+
protected requestListWithPages(clientUrl: string, query?: QueryWithPage, Model?: {
|
|
14
|
+
new (data: BounceData | ComplaintData | UnsubscribeData | WhiteListData): IBounce | IComplaint | IUnsubscribe | IWhiteList;
|
|
15
|
+
}): Promise<T>;
|
|
16
|
+
protected abstract parseList(response: ResponseWithPaging, Model?: {
|
|
17
|
+
new (data: BounceData | ComplaintData | UnsubscribeData | WhiteListData): IBounce | IComplaint | IUnsubscribe | IWhiteList;
|
|
18
|
+
}): T;
|
|
19
|
+
}
|
package/domainsTags.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import Request from './request';
|
|
2
|
-
import { DomainTagCountriesAggregation, DomainTagDevicesAggregation, DomainTagProvidersAggregation, DomainTagsItem, DomainTagsItemInfo, DomainTagsList, DomainTagsMessageRes, DomainTagsQuery, DomainTagsStatisticQuery, DomainTagStatAPIResponse, DomainTagStatisticItem, DomainTagStatisticResult, IDomainTagsClient, Resolution } from './interfaces/DomainTags';
|
|
2
|
+
import { DomainTagCountriesAggregation, DomainTagDevicesAggregation, DomainTagProvidersAggregation, DomainTagsItem, DomainTagsItemInfo, DomainTagsList, DomainTagsMessageRes, DomainTagsQuery, DomainTagsResponseData, DomainTagsStatisticQuery, DomainTagStatAPIResponse, DomainTagStatisticItem, DomainTagStatisticResult, IDomainTagsClient, Resolution } from './interfaces/DomainTags';
|
|
3
|
+
import NavigationThruPages from './common/NavigationThruPages';
|
|
3
4
|
export declare class DomainTag implements DomainTagsItem {
|
|
4
5
|
tag: string;
|
|
5
6
|
description: string;
|
|
@@ -16,12 +17,11 @@ export declare class DomainTagStatistic implements DomainTagStatisticResult {
|
|
|
16
17
|
stats: DomainTagStatisticItem[];
|
|
17
18
|
constructor(tagStatisticInfo: DomainTagStatAPIResponse);
|
|
18
19
|
}
|
|
19
|
-
export default class DomainTagsClient implements IDomainTagsClient {
|
|
20
|
+
export default class DomainTagsClient extends NavigationThruPages<DomainTagsList> implements IDomainTagsClient {
|
|
20
21
|
baseRoute: string;
|
|
21
22
|
request: Request;
|
|
22
23
|
constructor(request: Request);
|
|
23
|
-
|
|
24
|
-
private _parseDomainTagsList;
|
|
24
|
+
protected parseList(response: DomainTagsResponseData): DomainTagsList;
|
|
25
25
|
private _parseTagStatistic;
|
|
26
26
|
list(domain: string, query?: DomainTagsQuery): Promise<DomainTagsList>;
|
|
27
27
|
get(domain: string, tag: string): Promise<DomainTagsItem>;
|
package/domainsTemplates.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
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';
|
|
2
|
+
import { CreateDomainTemplateVersionResult, DomainTemplate, DomainTemplateData, DomainTemplatesQuery, DomainTemplateUpdateData, DomainTemplateUpdateVersionData, DomainTemplateVersionData, IDomainTemplatesClient, ListDomainTemplatesAPIResponse, ListDomainTemplatesResult, ListDomainTemplateVersionsResult, MutateDomainTemplateVersionResult, NotificationResult, ShortTemplateVersion, TemplateQuery, TemplateVersion, UpdateOrDeleteDomainTemplateResult } from './interfaces/DomainTemplates';
|
|
3
|
+
import NavigationThruPages from './common/NavigationThruPages';
|
|
3
4
|
export declare class DomainTemplateItem implements DomainTemplate {
|
|
4
5
|
name: string;
|
|
5
6
|
description: string;
|
|
@@ -10,7 +11,7 @@ export declare class DomainTemplateItem implements DomainTemplate {
|
|
|
10
11
|
versions?: ShortTemplateVersion[];
|
|
11
12
|
constructor(domainTemplateFromAPI: DomainTemplate);
|
|
12
13
|
}
|
|
13
|
-
export default class DomainTemplatesClient implements IDomainTemplatesClient {
|
|
14
|
+
export default class DomainTemplatesClient extends NavigationThruPages<ListDomainTemplatesResult> implements IDomainTemplatesClient {
|
|
14
15
|
baseRoute: string;
|
|
15
16
|
request: Request;
|
|
16
17
|
constructor(request: Request);
|
|
@@ -19,7 +20,7 @@ export default class DomainTemplatesClient implements IDomainTemplatesClient {
|
|
|
19
20
|
private parseMutationResponse;
|
|
20
21
|
private parseNotificationResponse;
|
|
21
22
|
private parseMutateTemplateVersionResponse;
|
|
22
|
-
|
|
23
|
+
protected parseList(response: ListDomainTemplatesAPIResponse): ListDomainTemplatesResult;
|
|
23
24
|
private parseListTemplateVersions;
|
|
24
25
|
list(domain: string, query?: DomainTemplatesQuery): Promise<ListDomainTemplatesResult>;
|
|
25
26
|
get(domain: string, templateName: string, query?: TemplateQuery): Promise<DomainTemplateItem>;
|
package/events.d.ts
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import NavigationThruPages from './common/NavigationThruPages';
|
|
2
|
+
import { EventsList, EventsQuery, EventsResponse } from './interfaces/Events';
|
|
2
3
|
import Request from './request';
|
|
3
|
-
export default class EventClient {
|
|
4
|
+
export default class EventClient extends NavigationThruPages<EventsList> {
|
|
4
5
|
request: Request;
|
|
5
6
|
constructor(request: Request);
|
|
6
|
-
|
|
7
|
-
_parsePage(id: string, url: string): EventsPage;
|
|
8
|
-
_parsePageLinks(response: EventsResponse): ParsedPagesList;
|
|
9
|
-
_parseEventList(response: EventsResponse): EventsList;
|
|
7
|
+
protected parseList(response: EventsResponse): EventsList;
|
|
10
8
|
get(domain: string, query?: EventsQuery): Promise<EventsList>;
|
|
11
9
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DomainTagStatistic } from '../domainsTags';
|
|
2
|
+
import { PagesList, ParsedPagesList } from './NavigationThruPages';
|
|
2
3
|
export declare enum Resolution {
|
|
3
4
|
HOUR = "hour",
|
|
4
5
|
DAY = "day",
|
|
@@ -6,6 +7,7 @@ export declare enum Resolution {
|
|
|
6
7
|
}
|
|
7
8
|
export declare type DomainTagsQuery = {
|
|
8
9
|
limit: number;
|
|
10
|
+
page?: string;
|
|
9
11
|
};
|
|
10
12
|
export declare type DomainTagsStatisticQuery = {
|
|
11
13
|
event: string;
|
|
@@ -26,29 +28,6 @@ export interface DomainTagsItem {
|
|
|
26
28
|
'first-seen': Date;
|
|
27
29
|
'last-seen': Date;
|
|
28
30
|
}
|
|
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
31
|
export interface DomainTagsResponseData {
|
|
53
32
|
status: number;
|
|
54
33
|
body: {
|
|
@@ -57,6 +36,7 @@ export interface DomainTagsResponseData {
|
|
|
57
36
|
};
|
|
58
37
|
}
|
|
59
38
|
export interface DomainTagsList {
|
|
39
|
+
status: number;
|
|
60
40
|
items: DomainTagsItem[];
|
|
61
41
|
pages: ParsedPagesList;
|
|
62
42
|
}
|
|
@@ -1,14 +1,9 @@
|
|
|
1
1
|
import { DomainTemplateItem } from '../domainsTemplates';
|
|
2
|
+
import { PagesList, ParsedPagesList } from './NavigationThruPages';
|
|
2
3
|
export declare enum YesNo {
|
|
3
4
|
YES = "yes",
|
|
4
5
|
NO = "no"
|
|
5
6
|
}
|
|
6
|
-
export declare enum Pages {
|
|
7
|
-
FIRST = "first",
|
|
8
|
-
LAST = "last",
|
|
9
|
-
NEXT = "next",
|
|
10
|
-
PREV = "prev"
|
|
11
|
-
}
|
|
12
7
|
export declare type DomainTemplateData = {
|
|
13
8
|
name: string;
|
|
14
9
|
description: string;
|
|
@@ -33,9 +28,8 @@ export declare type DomainTemplateUpdateVersionData = {
|
|
|
33
28
|
active?: YesNo;
|
|
34
29
|
};
|
|
35
30
|
export declare type DomainTemplatesQuery = {
|
|
36
|
-
page:
|
|
31
|
+
page: 'string';
|
|
37
32
|
limit: number;
|
|
38
|
-
p: string;
|
|
39
33
|
};
|
|
40
34
|
export declare type TemplateQuery = {
|
|
41
35
|
active: YesNo;
|
|
@@ -82,12 +76,8 @@ export interface ListDomainTemplatesAPIResponse {
|
|
|
82
76
|
}
|
|
83
77
|
export interface ListDomainTemplatesResult {
|
|
84
78
|
items: DomainTemplate[];
|
|
85
|
-
pages:
|
|
86
|
-
|
|
87
|
-
last: string;
|
|
88
|
-
next: string;
|
|
89
|
-
previous: string;
|
|
90
|
-
};
|
|
79
|
+
pages: ParsedPagesList;
|
|
80
|
+
status: number;
|
|
91
81
|
}
|
|
92
82
|
export interface GetDomainTemplateAPIResponse {
|
|
93
83
|
status: number;
|
|
@@ -162,22 +152,12 @@ export interface ListDomainTemplateVersionsAPIResponse {
|
|
|
162
152
|
id: string;
|
|
163
153
|
versions: ShortTemplateVersion[];
|
|
164
154
|
};
|
|
165
|
-
paging:
|
|
166
|
-
first: string;
|
|
167
|
-
last: string;
|
|
168
|
-
next: string;
|
|
169
|
-
previous: string;
|
|
170
|
-
};
|
|
155
|
+
paging: PagesList;
|
|
171
156
|
};
|
|
172
157
|
}
|
|
173
158
|
export interface ListDomainTemplateVersionsResult {
|
|
174
159
|
template: DomainTemplateItem;
|
|
175
|
-
pages:
|
|
176
|
-
first: string;
|
|
177
|
-
last: string;
|
|
178
|
-
next: string;
|
|
179
|
-
previous: string;
|
|
180
|
-
};
|
|
160
|
+
pages: ParsedPagesList;
|
|
181
161
|
}
|
|
182
162
|
export interface IDomainTemplatesClient {
|
|
183
163
|
list(domain: string, query?: DomainTemplatesQuery): Promise<ListDomainTemplatesResult>;
|
package/interfaces/Events.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { PagesList, ParsedPagesList } from './NavigationThruPages';
|
|
1
2
|
export interface EventsPage {
|
|
2
3
|
id: string;
|
|
3
4
|
number: string;
|
|
@@ -24,17 +25,12 @@ export interface EventsQuery extends FilterField {
|
|
|
24
25
|
ascending?: 'yes' | 'no';
|
|
25
26
|
limit?: number;
|
|
26
27
|
}
|
|
27
|
-
export interface PagesList {
|
|
28
|
-
previous: string;
|
|
29
|
-
first: string;
|
|
30
|
-
last: string;
|
|
31
|
-
next: string;
|
|
32
|
-
}
|
|
33
28
|
export interface EventsResponse {
|
|
34
29
|
body: {
|
|
35
30
|
items: [];
|
|
36
31
|
paging: PagesList;
|
|
37
32
|
};
|
|
33
|
+
status: number;
|
|
38
34
|
}
|
|
39
35
|
export interface DomainEvent {
|
|
40
36
|
severity: string;
|
|
@@ -89,21 +85,8 @@ export interface DomainEvent {
|
|
|
89
85
|
recipient: string;
|
|
90
86
|
event: string;
|
|
91
87
|
}
|
|
92
|
-
export interface ParsedPage {
|
|
93
|
-
id: string;
|
|
94
|
-
number: string;
|
|
95
|
-
url: string;
|
|
96
|
-
}
|
|
97
|
-
export interface ParsedPagesList {
|
|
98
|
-
previous: ParsedPage;
|
|
99
|
-
first: ParsedPage;
|
|
100
|
-
last: ParsedPage;
|
|
101
|
-
next: ParsedPage;
|
|
102
|
-
}
|
|
103
88
|
export interface EventsList {
|
|
104
89
|
items: DomainEvent[];
|
|
105
90
|
pages: ParsedPagesList;
|
|
106
|
-
|
|
107
|
-
export interface PagesListAccumulator {
|
|
108
|
-
[index: string]: EventsPage;
|
|
91
|
+
status: number;
|
|
109
92
|
}
|
package/interfaces/Messages.d.ts
CHANGED
|
@@ -1,4 +1,31 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
/**
|
|
3
|
+
* Ensures the object has least one key present and not undefined
|
|
4
|
+
*
|
|
5
|
+
* @see {@link https://stackoverflow.com/a/49725198}
|
|
6
|
+
*/
|
|
7
|
+
export declare type AtLeastOneKeyPresent<Object_, Keys extends keyof Object_ = keyof Object_> = Pick<Object_, Exclude<keyof Object_, Keys>> & {
|
|
8
|
+
[K in Keys]-?: Required<Pick<Object_, K>> & Partial<Pick<Object_, Exclude<Keys, K>>>;
|
|
9
|
+
}[Keys];
|
|
10
|
+
export declare type MailgunMessageContent = AtLeastOneKeyPresent<{
|
|
11
|
+
/**
|
|
12
|
+
* Body of the message. (text version)
|
|
13
|
+
*/
|
|
14
|
+
text?: string;
|
|
15
|
+
/**
|
|
16
|
+
* Body of the message. (HTML version)
|
|
17
|
+
*/
|
|
18
|
+
html?: string;
|
|
19
|
+
/**
|
|
20
|
+
* Body of the message. (MIME version)
|
|
21
|
+
*/
|
|
22
|
+
message?: string | Buffer | Blob;
|
|
23
|
+
/**
|
|
24
|
+
* Name of a template stored via [template API](https://documentation.mailgun.com/en/latest/api-templates.html#api-templates). See [Templates](https://documentation.mailgun.com/en/latest/user_manual.html#templating) for more information
|
|
25
|
+
*/
|
|
26
|
+
template?: string;
|
|
27
|
+
}>;
|
|
28
|
+
export declare type MailgunMessageData = MailgunMessageContent & {
|
|
2
29
|
/**
|
|
3
30
|
* Email address for `From` header
|
|
4
31
|
*/
|
|
@@ -21,14 +48,6 @@ export declare type MailgunMessageData = {
|
|
|
21
48
|
* Message subject
|
|
22
49
|
*/
|
|
23
50
|
subject?: string;
|
|
24
|
-
/**
|
|
25
|
-
* Body of the message. (text version)
|
|
26
|
-
*/
|
|
27
|
-
text?: string;
|
|
28
|
-
/**
|
|
29
|
-
* Body of the message. (HTML version)
|
|
30
|
-
*/
|
|
31
|
-
html?: string;
|
|
32
51
|
/**
|
|
33
52
|
* [AMP](https://developers.google.com/gmail/ampemail/) part of the message. Please follow google guidelines to compose and send AMP emails.
|
|
34
53
|
*/
|
|
@@ -45,10 +64,6 @@ export declare type MailgunMessageData = {
|
|
|
45
64
|
* You can post multiple `inline` values.
|
|
46
65
|
*/
|
|
47
66
|
inline?: any;
|
|
48
|
-
/**
|
|
49
|
-
* Name of a template stored via [template API](https://documentation.mailgun.com/en/latest/api-templates.html#api-templates). See [Templates](https://documentation.mailgun.com/en/latest/user_manual.html#templating) for more information
|
|
50
|
-
*/
|
|
51
|
-
template?: string;
|
|
52
67
|
/**
|
|
53
68
|
* Use this parameter to send a message to specific version of a template
|
|
54
69
|
*/
|
|
@@ -1,19 +1,46 @@
|
|
|
1
|
-
|
|
1
|
+
import { PagesList, ParsedPagesList } from './NavigationThruPages';
|
|
2
|
+
export interface MultipleValidationJobData {
|
|
2
3
|
created_at: number;
|
|
3
|
-
|
|
4
|
+
id: string;
|
|
5
|
+
quantity: number;
|
|
6
|
+
records_processed: number | null;
|
|
7
|
+
status: string;
|
|
8
|
+
download_url?: {
|
|
4
9
|
csv: string;
|
|
5
10
|
json: string;
|
|
6
11
|
};
|
|
12
|
+
summary?: {
|
|
13
|
+
result: {
|
|
14
|
+
catch_all: number;
|
|
15
|
+
deliverable: number;
|
|
16
|
+
do_not_send: number;
|
|
17
|
+
undeliverable: number;
|
|
18
|
+
unknown: number;
|
|
19
|
+
};
|
|
20
|
+
risk: {
|
|
21
|
+
high: number;
|
|
22
|
+
low: number;
|
|
23
|
+
medium: number;
|
|
24
|
+
unknown: number;
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export interface MultipleValidationJobResult {
|
|
29
|
+
createdAt: Date;
|
|
7
30
|
id: string;
|
|
8
31
|
quantity: number;
|
|
9
|
-
|
|
32
|
+
recordsProcessed: number | null;
|
|
10
33
|
status: string;
|
|
11
34
|
responseStatusCode: number;
|
|
12
|
-
|
|
35
|
+
downloadUrl?: {
|
|
36
|
+
csv: string;
|
|
37
|
+
json: string;
|
|
38
|
+
};
|
|
39
|
+
summary?: {
|
|
13
40
|
result: {
|
|
14
|
-
|
|
41
|
+
catchAll: number;
|
|
15
42
|
deliverable: number;
|
|
16
|
-
|
|
43
|
+
doNotSend: number;
|
|
17
44
|
undeliverable: number;
|
|
18
45
|
unknown: number;
|
|
19
46
|
};
|
|
@@ -37,21 +64,23 @@ export interface MultipleValidationCreationDataUpdated {
|
|
|
37
64
|
multipleValidationFile: Record<string, unknown>;
|
|
38
65
|
[key: string]: unknown | undefined;
|
|
39
66
|
}
|
|
40
|
-
export interface PagesList {
|
|
41
|
-
prev: string;
|
|
42
|
-
first: string;
|
|
43
|
-
last: string;
|
|
44
|
-
next: string;
|
|
45
|
-
}
|
|
46
67
|
export interface MultipleValidationJobsListResult {
|
|
47
|
-
jobs:
|
|
48
|
-
|
|
68
|
+
jobs: MultipleValidationJobResult[];
|
|
69
|
+
pages: ParsedPagesList;
|
|
49
70
|
total: number;
|
|
50
71
|
status: number;
|
|
51
72
|
}
|
|
73
|
+
export interface MultipleValidationJobsListQuery {
|
|
74
|
+
limit: number;
|
|
75
|
+
page: string;
|
|
76
|
+
}
|
|
52
77
|
export interface MultipleValidationJobsListResponse {
|
|
53
|
-
status:
|
|
54
|
-
body:
|
|
78
|
+
status: number;
|
|
79
|
+
body: {
|
|
80
|
+
paging: PagesList;
|
|
81
|
+
jobs: MultipleValidationJobData[];
|
|
82
|
+
total: number;
|
|
83
|
+
};
|
|
55
84
|
}
|
|
56
85
|
export interface CanceledMultipleValidationJob {
|
|
57
86
|
message: string;
|
|
@@ -59,7 +88,7 @@ export interface CanceledMultipleValidationJob {
|
|
|
59
88
|
}
|
|
60
89
|
export interface IMultipleValidationClient {
|
|
61
90
|
list(): Promise<MultipleValidationJobsListResult>;
|
|
62
|
-
get(listId: string): Promise<
|
|
91
|
+
get(listId: string): Promise<MultipleValidationJobResult>;
|
|
63
92
|
create(listId: string, file: any): Promise<CreatedMultipleValidationJob>;
|
|
64
93
|
destroy(listId: string): Promise<CanceledMultipleValidationJob>;
|
|
65
94
|
}
|