intercom-client
Advanced tools
Comparing version 2.8.8 to 2.8.9
@@ -7,4 +7,2 @@ 'use strict'; | ||
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; | ||
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }(); | ||
@@ -130,21 +128,15 @@ | ||
if (this.promises || !f) { | ||
var _ret = function () { | ||
var callbackHandler = _this.callback; | ||
return { | ||
v: new _bluebird2.default(function (resolve, reject) { | ||
var resolver = function resolver(err, data) { | ||
if (err) { | ||
reject(new Error(JSON.stringify(err))); | ||
} else { | ||
resolve(data); | ||
} | ||
}; | ||
req.end(function (r) { | ||
return callbackHandler(resolver, r); | ||
}); | ||
}) | ||
var callbackHandler = this.callback; | ||
return new _bluebird2.default(function (resolve, reject) { | ||
var resolver = function resolver(err, data) { | ||
if (err) { | ||
reject(new Error(JSON.stringify(err))); | ||
} else { | ||
resolve(data); | ||
} | ||
}; | ||
}(); | ||
if ((typeof _ret === 'undefined' ? 'undefined' : _typeof(_ret)) === "object") return _ret.v; | ||
req.end(function (r) { | ||
return callbackHandler(resolver, r); | ||
}); | ||
}); | ||
} else { | ||
@@ -151,0 +143,0 @@ req.end(function (r) { |
@@ -48,3 +48,9 @@ 'use strict'; | ||
value: function find(params, f) { | ||
return this.client.get('/companies/' + params.id, {}, f); | ||
if (params.id) { | ||
return this.client.get('/companies/' + params.id, {}, f); | ||
} else if (params.company_id) { | ||
return this.client.get('/companies', { company_id: params.company_id }, f); | ||
} else if (params.name) { | ||
return this.client.get('/companies', { name: params.name }, f); | ||
} | ||
} | ||
@@ -54,3 +60,9 @@ }, { | ||
value: function listUsers(params, f) { | ||
return this.client.get('/companies/' + params.id + '/users', {}, f); | ||
if (params.id) { | ||
return this.client.get('/companies/' + params.id + '/users', {}, f); | ||
} else if (params.company_id) { | ||
return this.client.get('/companies', { company_id: params.company_id, type: 'user' }, f); | ||
} else if (params.name) { | ||
return this.client.get('/companies', { name: params.name, type: 'user' }, f); | ||
} | ||
} | ||
@@ -57,0 +69,0 @@ }]); |
{ | ||
"name": "intercom-client", | ||
"version": "2.8.8", | ||
"version": "2.8.9", | ||
"description": "Official Node bindings to the Intercom API", | ||
@@ -5,0 +5,0 @@ "homepage": "https://github.com/intercom/intercom-node", |
@@ -293,6 +293,8 @@ # intercom-node | ||
```node | ||
// List company users | ||
// List company users by id or company_id | ||
client.companies.listUsers({ id: '1234' }, callback); | ||
client.companies.listUsers({ company_id: '1234' }, callback); | ||
``` | ||
## Events | ||
@@ -299,0 +301,0 @@ |
47484
804
552