Skip to content

Commit

Permalink
update deps. remove campaigns API. add domain tracking API.
Browse files Browse the repository at this point in the history
  • Loading branch information
bojand committed Apr 19, 2018
1 parent 7200664 commit abe09bd
Show file tree
Hide file tree
Showing 8 changed files with 943 additions and 890 deletions.
4 changes: 2 additions & 2 deletions lib/mailgun.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ class Mailgun {

return tsscmp(
signature, crypto.createHmac(mailgunHashType, this.apiKey)
.update(Buffer.from(timestamp + token, 'utf-8'))
.digest(mailgunSignatureEncoding)
.update(Buffer.from(timestamp + token, 'utf-8'))
.digest(mailgunSignatureEncoding)
)
}

Expand Down
4 changes: 2 additions & 2 deletions lib/request.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const https = require('https')
const http = require('http')
const proxy = require('proxy-agent')
const ProxyAgent = require('proxy-agent')
const qs = require('querystring')
const fs = require('fs')
const Readable = require('stream').Readable
Expand Down Expand Up @@ -116,7 +116,7 @@ class Request {
}

if (this.proxy) {
opts.agent = proxy(this.proxy, true)
opts.agent = new ProxyAgent(this.proxy)
}

if (typeof this.retry === 'object' || this.retry > 1) {
Expand Down
111 changes: 52 additions & 59 deletions lib/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -535,65 +535,6 @@ module.exports = {
}
]
},
'campaign': {
'description': 'Manage campaigns. See http://documentation.mailgun.com/api-campaigns.html',
'links': [{
'description': 'Create a new campaign.',
'href': '/campaigns',
'method': 'POST',
'title': 'create',
'properties': {
'id': {
'type': 'string'
},
'name': {
'type': 'string'
}
},
'required': ['name']
},
{
'description': 'Returns a list of campaigns.',
'href': '/campaigns',
'method': 'GET',
'title': 'list',
'properties': {
'limit': {
'type': 'number'
},
'skip': {
'type': 'number'
}
}
},
{
'description': 'Get single campaign info.',
'href': '/campaigns/{id}',
'method': 'GET',
'title': 'info'
},
{
'description': 'Update campaign.',
'href': '/campaigns/{id}',
'method': 'PUT',
'title': 'update',
'properties': {
'id': {
'type': 'string'
},
'name': {
'type': 'string'
}
}
},
{
'description': 'Delete campaign.',
'href': '/campaigns/{id}',
'method': 'DELETE',
'title': 'delete'
}
]
},
'stats': {
'description': 'Various data and event statistics for you mailgun account. See http://documentation.mailgun.com/api-stats.html',
'links': [{
Expand Down Expand Up @@ -703,6 +644,58 @@ module.exports = {
}
}
}]
},
'tracking': {
'description': 'Programmatically get and modify domain tracking settings.',
'links': [{
'description': 'Returns tracking settings for a domain.',
'href': '/domains/{domain}/tracking',
'method': 'GET',
'title': 'info'
},
{
'description': 'Updates the open tracking settings for a domain.',
'href': '/domains/{domain}/tracking/open',
'method': 'PUT',
'title': 'update',
'properties': {
'active': {
'type': ['string', 'boolean']
}
},
'required': ['active']
},
{
'description': 'Updates the click tracking settings for a domain.',
'href': '/domains/{domain}/tracking/click',
'method': 'PUT',
'title': 'update',
'properties': {
'active': {
'type': ['string', 'boolean']
}
},
'required': ['active']
},
{
'description': 'Updates the unsubscribe tracking settings for a domain.',
'href': '/domains/{domain}/tracking/unsubscribe',
'method': 'PUT',
'title': 'update',
'properties': {
'active': {
'type': 'boolean'
},
'html_footer': {
'type': 'string'
},
'text_footer': {
'type': 'string'
}
},
'required': ['active']
}
]
}
}
}
Loading

0 comments on commit abe09bd

Please sign in to comment.