Skip to content

Commit 9a95111

Browse files
authored
Merge pull request #202 from bojand/dep_api_update
Dependency and API update
2 parents 7200664 + d71a35e commit 9a95111

File tree

12 files changed

+1030
-947
lines changed

12 files changed

+1030
-947
lines changed

docs/_sidebar.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@
1111
- [Message](/api/message)
1212
- [Domain](/api/domain)
1313
- [Credentials](/api/credentials)
14+
- [Tracking](/api/tracking)
1415
- [Complaints](/api/complaints)
15-
- [Campaigns](/api/campaign)
1616
- [Events](/api/events)
1717
- [Stats](/api/stats)
1818
- [Tags](/api/tags)

docs/api/campaign.md

Lines changed: 0 additions & 56 deletions
This file was deleted.

docs/api/tags.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,46 @@ Method | Path
2424
--- | ---
2525
GET | /{domain}/tags/{tag}
2626

27+
### `info`
28+
29+
Returns statistics for a given tag.
30+
31+
`mailgun.tags({tag}).stats().info({callback});`
32+
33+
Method | Path
34+
--- | ---
35+
GET | /{domain}/tags/{tag}/stats
36+
37+
### `list`
38+
39+
Returns a list of countries of origin for a given domain for different event types.
40+
41+
`mailgun.tags({tag}).stats().aggregates().countries().list({callback});`
42+
43+
Method | Path
44+
--- | ---
45+
GET | /{domain}/tags/{tag}/stats/aggregates/countries
46+
47+
### `list`
48+
49+
Returns a list of email providers for a given domain for different event types.
50+
51+
`mailgun.tags({tag}).stats().aggregates().providers().list({callback});`
52+
53+
Method | Path
54+
--- | ---
55+
GET | /{domain}/tags/{tag}/stats/aggregates/providers
56+
57+
### `list`
58+
59+
Returns a list of devices for a given domain that have triggered event types.
60+
61+
`mailgun.tags({tag}).stats().aggregates().devices().list({callback});`
62+
63+
Method | Path
64+
--- | ---
65+
GET | /{domain}/tags/{tag}/stats/aggregates/devices
66+
2767
### `delete`
2868

2969
Deletes all counters for particular tag and the tag itself.

docs/api/tracking.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
# tracking
2+
3+
Programmatically get and modify domain tracking settings.
4+
5+
## Actions
6+
7+
### `info`
8+
9+
Returns tracking settings for a domain.
10+
11+
`mailgun.domains({domain}).tracking().info({callback});`
12+
13+
Method | Path
14+
--- | ---
15+
GET | /domains/{domain}/tracking
16+
17+
### `update`
18+
19+
Updates the open tracking settings for a domain.
20+
21+
`mailgun.domains({domain}).tracking().open().update({attributes}, {callback});`
22+
23+
Method | Path
24+
--- | ---
25+
PUT | /domains/{domain}/tracking/open
26+
27+
### `update`
28+
29+
Updates the click tracking settings for a domain.
30+
31+
`mailgun.domains({domain}).tracking().click().update({attributes}, {callback});`
32+
33+
Method | Path
34+
--- | ---
35+
PUT | /domains/{domain}/tracking/click
36+
37+
### `update`
38+
39+
Updates the unsubscribe tracking settings for a domain.
40+
41+
`mailgun.domains({domain}).tracking().unsubscribe().update({attributes}, {callback});`
42+
43+
Method | Path
44+
--- | ---
45+
PUT | /domains/{domain}/tracking/unsubscribe
46+

lib/mailgun.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,8 +152,8 @@ class Mailgun {
152152

153153
return tsscmp(
154154
signature, crypto.createHmac(mailgunHashType, this.apiKey)
155-
.update(Buffer.from(timestamp + token, 'utf-8'))
156-
.digest(mailgunSignatureEncoding)
155+
.update(Buffer.from(timestamp + token, 'utf-8'))
156+
.digest(mailgunSignatureEncoding)
157157
)
158158
}
159159

lib/request.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
const https = require('https')
22
const http = require('http')
3-
const proxy = require('proxy-agent')
3+
const ProxyAgent = require('proxy-agent')
44
const qs = require('querystring')
55
const fs = require('fs')
66
const Readable = require('stream').Readable
@@ -116,7 +116,7 @@ class Request {
116116
}
117117

118118
if (this.proxy) {
119-
opts.agent = proxy(this.proxy, true)
119+
opts.agent = new ProxyAgent(this.proxy)
120120
}
121121

122122
if (typeof this.retry === 'object' || this.retry > 1) {

lib/schema.js

Lines changed: 52 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -535,65 +535,6 @@ module.exports = {
535535
}
536536
]
537537
},
538-
'campaign': {
539-
'description': 'Manage campaigns. See http://documentation.mailgun.com/api-campaigns.html',
540-
'links': [{
541-
'description': 'Create a new campaign.',
542-
'href': '/campaigns',
543-
'method': 'POST',
544-
'title': 'create',
545-
'properties': {
546-
'id': {
547-
'type': 'string'
548-
},
549-
'name': {
550-
'type': 'string'
551-
}
552-
},
553-
'required': ['name']
554-
},
555-
{
556-
'description': 'Returns a list of campaigns.',
557-
'href': '/campaigns',
558-
'method': 'GET',
559-
'title': 'list',
560-
'properties': {
561-
'limit': {
562-
'type': 'number'
563-
},
564-
'skip': {
565-
'type': 'number'
566-
}
567-
}
568-
},
569-
{
570-
'description': 'Get single campaign info.',
571-
'href': '/campaigns/{id}',
572-
'method': 'GET',
573-
'title': 'info'
574-
},
575-
{
576-
'description': 'Update campaign.',
577-
'href': '/campaigns/{id}',
578-
'method': 'PUT',
579-
'title': 'update',
580-
'properties': {
581-
'id': {
582-
'type': 'string'
583-
},
584-
'name': {
585-
'type': 'string'
586-
}
587-
}
588-
},
589-
{
590-
'description': 'Delete campaign.',
591-
'href': '/campaigns/{id}',
592-
'method': 'DELETE',
593-
'title': 'delete'
594-
}
595-
]
596-
},
597538
'stats': {
598539
'description': 'Various data and event statistics for you mailgun account. See http://documentation.mailgun.com/api-stats.html',
599540
'links': [{
@@ -703,6 +644,58 @@ module.exports = {
703644
}
704645
}
705646
}]
647+
},
648+
'tracking': {
649+
'description': 'Programmatically get and modify domain tracking settings.',
650+
'links': [{
651+
'description': 'Returns tracking settings for a domain.',
652+
'href': '/domains/{domain}/tracking',
653+
'method': 'GET',
654+
'title': 'info'
655+
},
656+
{
657+
'description': 'Updates the open tracking settings for a domain.',
658+
'href': '/domains/{domain}/tracking/open',
659+
'method': 'PUT',
660+
'title': 'update',
661+
'properties': {
662+
'active': {
663+
'type': ['string', 'boolean']
664+
}
665+
},
666+
'required': ['active']
667+
},
668+
{
669+
'description': 'Updates the click tracking settings for a domain.',
670+
'href': '/domains/{domain}/tracking/click',
671+
'method': 'PUT',
672+
'title': 'update',
673+
'properties': {
674+
'active': {
675+
'type': ['string', 'boolean']
676+
}
677+
},
678+
'required': ['active']
679+
},
680+
{
681+
'description': 'Updates the unsubscribe tracking settings for a domain.',
682+
'href': '/domains/{domain}/tracking/unsubscribe',
683+
'method': 'PUT',
684+
'title': 'update',
685+
'properties': {
686+
'active': {
687+
'type': 'boolean'
688+
},
689+
'html_footer': {
690+
'type': 'string'
691+
},
692+
'text_footer': {
693+
'type': 'string'
694+
}
695+
},
696+
'required': ['active']
697+
}
698+
]
706699
}
707700
}
708701
}

0 commit comments

Comments
 (0)