New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

intercom-client

Package Overview
Dependencies
Maintainers
1
Versions
65
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

intercom-client - npm Package Compare versions

Comparing version 1.1.4 to 2.0.0

2

dist/admin.js

@@ -21,3 +21,3 @@ 'use strict';

value: function list(f) {
this.client.get('/admins', {}, f);
return this.client.get('/admins', {}, f);
}

@@ -24,0 +24,0 @@ }]);

@@ -39,3 +39,3 @@ 'use strict';

});
this.client.post(url, bulkParams, f);
return this.client.post(url, bulkParams, f);
}

@@ -42,0 +42,0 @@ }]);

@@ -64,8 +64,46 @@ 'use strict';

this.notes = new _note.Note(this);
this.promises = false;
}
_createClass(Client, [{
key: 'usePromises',
value: function usePromises() {
this.promises = true;
return this;
}
}, {
key: 'promiseProxy',
value: function promiseProxy(f, req) {
var _this = this;
if (this.promises) {
var _ret = (function () {
var callbackHandler = _this.callback;
return {
v: new Promise(function (resolve, reject) {
var resolver = function resolver(err, data) {
if (err) {
reject(err);
} else {
resolve(data);
}
};
req.end(function (r) {
return callbackHandler(resolver, r);
});
})
};
})();
if (typeof _ret === 'object') return _ret.v;
} else {
req.end(function (r) {
return _this.callback(f, r);
});
}
}
}, {
key: 'ping',
value: function ping(f) {
unirest.get('https://api.intercom.io/admins').auth(this.appId, this.appApiKey).type('json').header('Accept', 'application/json').header('User-Agent', 'intercom-node-client/1.0.0').end(function (r) {
unirest.get('https://api.intercom.io/admins').auth(this.appId, this.appApiKey).type('json').header('Accept', 'application/json').header('User-Agent', 'intercom-node-client/2.0.0').end(function (r) {
return f(r.status);

@@ -77,7 +115,3 @@ });

value: function put(endpoint, data, f) {
var _this = this;
unirest.put('https://api.intercom.io' + endpoint).auth(this.appId, this.appApiKey).type('json').send(data).header('Accept', 'application/json').header('User-Agent', 'intercom-node-client/1.0.0').end(function (r) {
return _this.callback(f, r);
});
return this.promiseProxy(f, unirest.put('https://api.intercom.io' + endpoint).auth(this.appId, this.appApiKey).type('json').send(data).header('Accept', 'application/json').header('User-Agent', 'intercom-node-client/2.0.0'));
}

@@ -87,7 +121,3 @@ }, {

value: function post(endpoint, data, f) {
var _this2 = this;
unirest.post('https://api.intercom.io' + endpoint).auth(this.appId, this.appApiKey).type('json').send(data).header('Accept', 'application/json').header('User-Agent', 'intercom-node-client/1.0.0').end(function (r) {
return _this2.callback(f, r);
});
return this.promiseProxy(f, unirest.post('https://api.intercom.io' + endpoint).auth(this.appId, this.appApiKey).type('json').send(data).header('Accept', 'application/json').header('User-Agent', 'intercom-node-client/2.0.0'));
}

@@ -97,7 +127,3 @@ }, {

value: function get(endpoint, data, f) {
var _this3 = this;
unirest.get('https://api.intercom.io' + endpoint).auth(this.appId, this.appApiKey).type('json').query(data).header('Accept', 'application/json').header('User-Agent', 'intercom-node-client/1.0.0').end(function (r) {
return _this3.callback(f, r);
});
return this.promiseProxy(f, unirest.get('https://api.intercom.io' + endpoint).auth(this.appId, this.appApiKey).type('json').query(data).header('Accept', 'application/json').header('User-Agent', 'intercom-node-client/2.0.0'));
}

@@ -107,7 +133,3 @@ }, {

value: function nextPage(paginationObject, f) {
var _this4 = this;
unirest.get(paginationObject.next).auth(this.appId, this.appApiKey).type('json').header('Accept', 'application/json').header('User-Agent', 'intercom-node-client/1.0.0').end(function (r) {
return _this4.callback(f, r);
});
return this.promiseProxy(f, unirest.get(paginationObject.next).auth(this.appId, this.appApiKey).type('json').header('Accept', 'application/json').header('User-Agent', 'intercom-node-client/2.0.0'));
}

@@ -117,7 +139,3 @@ }, {

value: function _delete(endpoint, data, f) {
var _this5 = this;
unirest['delete']('https://api.intercom.io' + endpoint).auth(this.appId, this.appApiKey).type('json').query(data).header('Accept', 'application/json').header('User-Agent', 'intercom-node-client/1.0.0').end(function (r) {
return _this5.callback(f, r);
});
return this.promiseProxy(f, unirest['delete']('https://api.intercom.io' + endpoint).auth(this.appId, this.appApiKey).type('json').query(data).header('Accept', 'application/json').header('User-Agent', 'intercom-node-client/2.0.0'));
}

@@ -131,3 +149,3 @@ }, {

if (f.length >= 2) {
var hasErrors = data.body && data.body.type === 'error.list';
var hasErrors = data.error || data.body && data.body.type === 'error.list';
if (hasErrors) {

@@ -134,0 +152,0 @@ f(data, null);

@@ -21,3 +21,3 @@ 'use strict';

value: function create(data, f) {
this.client.post('/companies', data, f);
return this.client.post('/companies', data, f);
}

@@ -27,3 +27,3 @@ }, {

value: function list(f) {
this.client.get('/companies', {}, f);
return this.client.get('/companies', {}, f);
}

@@ -33,3 +33,3 @@ }, {

value: function listBy(params, f) {
this.client.get('/companies', params, f);
return this.client.get('/companies', params, f);
}

@@ -39,3 +39,3 @@ }, {

value: function find(params, f) {
this.client.get('/companies/' + params.id, {}, f);
return this.client.get('/companies/' + params.id, {}, f);
}

@@ -45,3 +45,3 @@ }, {

value: function listUsers(params, f) {
this.client.get('/companies/' + params.id + '/users', {}, f);
return this.client.get('/companies/' + params.id + '/users', {}, f);
}

@@ -48,0 +48,0 @@ }]);

@@ -28,3 +28,3 @@ 'use strict';

}
this.client.post('/contacts', params, callback);
return this.client.post('/contacts', params, callback);
}

@@ -34,3 +34,3 @@ }, {

value: function update(params, f) {
this.client.post('/contacts', params, f);
return this.client.post('/contacts', params, f);
}

@@ -40,3 +40,3 @@ }, {

value: function list(f) {
this.client.get('/contacts', {}, f);
return this.client.get('/contacts', {}, f);
}

@@ -46,3 +46,3 @@ }, {

value: function listBy(params, f) {
this.client.get('/contacts', params, f);
return this.client.get('/contacts', params, f);
}

@@ -52,3 +52,3 @@ }, {

value: function find(params, f) {
this.client.get('/contacts/' + params.id, {}, f);
return this.client.get('/contacts/' + params.id, {}, f);
}

@@ -58,3 +58,3 @@ }, {

value: function _delete(params, f) {
this.client['delete']('/contacts/' + params.id, {}, f);
return this.client['delete']('/contacts/' + params.id, {}, f);
}

@@ -64,3 +64,3 @@ }, {

value: function convert(params, f) {
this.client.post('/contacts/convert', params, f);
return this.client.post('/contacts/convert', params, f);
}

@@ -67,0 +67,0 @@ }]);

@@ -21,3 +21,3 @@ 'use strict';

value: function list(data, f) {
this.client.get('/conversations', data, f);
return this.client.get('/conversations', data, f);
}

@@ -27,3 +27,3 @@ }, {

value: function find(params, f) {
this.client.get('/conversations/' + params.id, params, f);
return this.client.get('/conversations/' + params.id, params, f);
}

@@ -33,3 +33,3 @@ }, {

value: function reply(params, f) {
this.client.post('/conversations/' + params.id + '/reply', params, f);
return this.client.post('/conversations/' + params.id + '/reply', params, f);
}

@@ -39,3 +39,3 @@ }, {

value: function markAsRead(params, f) {
this.client.put('/conversations/' + params.id, { read: true }, f);
return this.client.put('/conversations/' + params.id, { read: true }, f);
}

@@ -42,0 +42,0 @@ }]);

@@ -21,3 +21,3 @@ 'use strict';

value: function appCounts(f) {
this.client.get('/counts', {}, f);
return this.client.get('/counts', {}, f);
}

@@ -27,3 +27,3 @@ }, {

value: function conversationCounts(f) {
this.client.get('/counts', { type: 'conversation' }, f);
return this.client.get('/counts', { type: 'conversation' }, f);
}

@@ -33,3 +33,3 @@ }, {

value: function conversationAdminCounts(f) {
this.client.get('/counts', { type: 'conversation', count: 'admin' }, f);
return this.client.get('/counts', { type: 'conversation', count: 'admin' }, f);
}

@@ -39,3 +39,3 @@ }, {

value: function userTagCounts(f) {
this.client.get('/counts', { type: 'user', count: 'tag' }, f);
return this.client.get('/counts', { type: 'user', count: 'tag' }, f);
}

@@ -45,3 +45,3 @@ }, {

value: function userSegmentCounts(f) {
this.client.get('/counts', { type: 'user', count: 'segment' }, f);
return this.client.get('/counts', { type: 'user', count: 'segment' }, f);
}

@@ -51,3 +51,3 @@ }, {

value: function companyTagCounts(f) {
this.client.get('/counts', { type: 'company', count: 'tag' }, f);
return this.client.get('/counts', { type: 'company', count: 'tag' }, f);
}

@@ -57,3 +57,3 @@ }, {

value: function companySegmentCounts(f) {
this.client.get('/counts', { type: 'company', count: 'segment' }, f);
return this.client.get('/counts', { type: 'company', count: 'segment' }, f);
}

@@ -63,3 +63,3 @@ }, {

value: function companyUserCounts(f) {
this.client.get('/counts', { type: 'company', count: 'user' }, f);
return this.client.get('/counts', { type: 'company', count: 'user' }, f);
}

@@ -66,0 +66,0 @@ }]);

@@ -23,3 +23,3 @@ 'use strict';

value: function create(data, f) {
this.client.post('/events', data, f);
return this.client.post('/events', data, f);
}

@@ -29,3 +29,3 @@ }, {

value: function bulk(params, f) {
new _bulk.Bulk(this.client, 'event').bulk(params, f);
return new _bulk.Bulk(this.client, 'event').bulk(params, f);
}

@@ -32,0 +32,0 @@ }]);

@@ -21,3 +21,3 @@ 'use strict';

value: function create(data, f) {
this.client.post('/messages', data, f);
return this.client.post('/messages', data, f);
}

@@ -24,0 +24,0 @@ }]);

@@ -21,3 +21,3 @@ 'use strict';

value: function create(params, f) {
this.client.post('/notes', params, f);
return this.client.post('/notes', params, f);
}

@@ -27,3 +27,3 @@ }, {

value: function list(params, f) {
this.client.get('/notes', params, f);
return this.client.get('/notes', params, f);
}

@@ -33,3 +33,3 @@ }, {

value: function find(params, f) {
this.client.get('/notes/' + params.id, {}, f);
return this.client.get('/notes/' + params.id, {}, f);
}

@@ -36,0 +36,0 @@ }]);

@@ -21,3 +21,3 @@ 'use strict';

value: function list(f) {
this.client.get('/segments', {}, f);
return this.client.get('/segments', {}, f);
}

@@ -27,3 +27,3 @@ }, {

value: function find(params, f) {
this.client.get('/segments/' + params.id, {}, f);
return this.client.get('/segments/' + params.id, {}, f);
}

@@ -30,0 +30,0 @@ }]);

@@ -21,3 +21,3 @@ 'use strict';

value: function create(data, f) {
this.client.post('/tags', data, f);
return this.client.post('/tags', data, f);
}

@@ -27,3 +27,3 @@ }, {

value: function tag(data, f) {
this.client.post('/tags', data, f);
return this.client.post('/tags', data, f);
}

@@ -39,3 +39,3 @@ }, {

});
this.client.post('/tags', data, f);
return this.client.post('/tags', data, f);
}

@@ -45,3 +45,3 @@ }, {

value: function _delete(params, f) {
this.client['delete']('/tags/' + params.id, {}, f);
return this.client['delete']('/tags/' + params.id, {}, f);
}

@@ -51,3 +51,3 @@ }, {

value: function list(f) {
this.client.get('/tags', {}, f);
return this.client.get('/tags', {}, f);
}

@@ -54,0 +54,0 @@ }]);

@@ -23,3 +23,3 @@ 'use strict';

value: function create(data, f) {
this.client.post('/users', data, f);
return this.client.post('/users', data, f);
}

@@ -29,3 +29,3 @@ }, {

value: function list(f) {
this.client.get('/users', {}, f);
return this.client.get('/users', {}, f);
}

@@ -35,3 +35,3 @@ }, {

value: function listBy(params, f) {
this.client.get('/users', params, f);
return this.client.get('/users', params, f);
}

@@ -41,3 +41,3 @@ }, {

value: function find(params, f) {
this.client.get('/users/' + params.id, {}, f);
return this.client.get('/users/' + params.id, {}, f);
}

@@ -47,3 +47,3 @@ }, {

value: function _delete(params, f) {
this.client['delete']('/users/' + params.id, {}, f);
return this.client['delete']('/users/' + params.id, {}, f);
}

@@ -53,3 +53,3 @@ }, {

value: function bulk(params, f) {
new _bulk.Bulk(this.client, 'user').bulk(params, f);
return new _bulk.Bulk(this.client, 'user').bulk(params, f);
}

@@ -56,0 +56,0 @@ }]);

{
"name": "intercom-client",
"version": "1.1.4",
"version": "2.0.0",
"description": "Official Node bindings to the Intercom API",
"homepage": "https://github.com/intercom/intercom-node",
"bugs:": "https://github.com/intercom/intercom-node/issues",
"repository": "intercom/intercom-node",
"author": {
"name": "Bob Long",
"email": "bob@intercom.io",
"url": ""
"email": "bob@intercom.io"
},

@@ -39,3 +39,6 @@ "files": [

},
"engines": {
"node": ">= v0.10.0"
},
"license": "Apache-2.0"
}

@@ -69,2 +69,13 @@ # intercom-node

## Promises
This client library also supports using Promises instead of callbacks by calling `usePromises` on the client object:
```node
let client = new Client('foo', 'bar').usePromises();
client.users.create({ email: 'foo@bar.com' }).then(function (r) {
// ...
});
```
## Users

@@ -71,0 +82,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc