intercom-client
Advanced tools
Comparing version 2.8.5 to 2.8.6
@@ -24,2 +24,7 @@ 'use strict'; | ||
}, { | ||
key: 'find', | ||
value: function find(id, f) { | ||
return this.client.get('/admins/' + id, {}, f); | ||
} | ||
}, { | ||
key: 'me', | ||
@@ -26,0 +31,0 @@ value: function me(f) { |
@@ -108,2 +108,3 @@ 'use strict'; | ||
this.promises = false; | ||
this.baseUrl = 'https://api.intercom.io'; | ||
} | ||
@@ -118,2 +119,8 @@ | ||
}, { | ||
key: 'useBaseUrl', | ||
value: function useBaseUrl(baseUrl) { | ||
this.baseUrl = baseUrl; | ||
return this; | ||
} | ||
}, { | ||
key: 'promiseProxy', | ||
@@ -152,3 +159,3 @@ value: function promiseProxy(f, req) { | ||
value: function ping(f) { | ||
_unirest2.default.get('https://api.intercom.io/admins').auth(this.usernamePart, this.passwordPart).type('json').header('Accept', 'application/json').header('User-Agent', 'intercom-node-client/2.0.0').end(function (r) { | ||
_unirest2.default.get(this.baseUrl + '/admins').auth(this.usernamePart, this.passwordPart).type('json').header('Accept', 'application/json').header('User-Agent', 'intercom-node-client/2.0.0').end(function (r) { | ||
return f(r.status); | ||
@@ -160,3 +167,3 @@ }); | ||
value: function put(endpoint, data, f) { | ||
return this.promiseProxy(f, _unirest2.default.put('https://api.intercom.io' + endpoint).auth(this.usernamePart, this.passwordPart).type('json').send(data).header('Accept', 'application/json').header('User-Agent', 'intercom-node-client/2.0.0')); | ||
return this.promiseProxy(f, _unirest2.default.put('' + this.baseUrl + endpoint).auth(this.usernamePart, this.passwordPart).type('json').send(data).header('Accept', 'application/json').header('User-Agent', 'intercom-node-client/2.0.0')); | ||
} | ||
@@ -166,3 +173,3 @@ }, { | ||
value: function post(endpoint, data, f) { | ||
return this.promiseProxy(f, _unirest2.default.post('https://api.intercom.io' + endpoint).auth(this.usernamePart, this.passwordPart).type('json').send(data).header('Accept', 'application/json').header('User-Agent', 'intercom-node-client/2.0.0')); | ||
return this.promiseProxy(f, _unirest2.default.post('' + this.baseUrl + endpoint).auth(this.usernamePart, this.passwordPart).type('json').send(data).header('Accept', 'application/json').header('User-Agent', 'intercom-node-client/2.0.0')); | ||
} | ||
@@ -172,3 +179,3 @@ }, { | ||
value: function get(endpoint, data, f) { | ||
return this.promiseProxy(f, _unirest2.default.get('https://api.intercom.io' + endpoint).auth(this.usernamePart, this.passwordPart).type('json').query(data).header('Accept', 'application/json').header('User-Agent', 'intercom-node-client/2.0.0')); | ||
return this.promiseProxy(f, _unirest2.default.get('' + this.baseUrl + endpoint).auth(this.usernamePart, this.passwordPart).type('json').query(data).header('Accept', 'application/json').header('User-Agent', 'intercom-node-client/2.0.0')); | ||
} | ||
@@ -183,3 +190,3 @@ }, { | ||
value: function _delete(endpoint, data, f) { | ||
return this.promiseProxy(f, _unirest2.default.delete('https://api.intercom.io' + endpoint).auth(this.usernamePart, this.passwordPart).type('json').query(data).header('Accept', 'application/json').header('User-Agent', 'intercom-node-client/2.0.0')); | ||
return this.promiseProxy(f, _unirest2.default.delete('' + this.baseUrl + endpoint).auth(this.usernamePart, this.passwordPart).type('json').query(data).header('Accept', 'application/json').header('User-Agent', 'intercom-node-client/2.0.0')); | ||
} | ||
@@ -186,0 +193,0 @@ }, { |
{ | ||
"name": "intercom-client", | ||
"version": "2.8.5", | ||
"version": "2.8.6", | ||
"description": "Official Node bindings to the Intercom API", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/intercom/intercom-node", |
47094
789