Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optionally allow a user ID to be passed into users.identity for WTA #432

Merged
merged 2 commits into from Dec 20, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
24 changes: 22 additions & 2 deletions lib/clients/web/facets/users.js
@@ -1,3 +1,5 @@
var isFunction = require('lodash').isFunction;

/**
* API Facet to make calls to methods in the users namespace.
*
Expand Down Expand Up @@ -38,10 +40,28 @@ UsersFacet.prototype.getPresence = function getPresence(user, optCb) {
* Get a user's identity.
* @see {@link https://api.slack.com/methods/users.identity|users.identity}
*
* @param {Object=} options
* @param {?} opts.user - When calling this method with a workspace token, set this to
* the user ID of the user to retrieve the identity of
* @param {function=} optCb Optional callback, if not using promises.
*/
UsersFacet.prototype.identity = function identity(optCb) {
return this.makeAPICall('users.identity', null, null, optCb);
UsersFacet.prototype.identity = function identity(options, optCb) {
var cb = null;
var opts = {};

cb = optCb;

if (options) {
if (isFunction(options)) {
cb = options;
} else {
if (options.user) {
opts.user = options.user;
}
}
}

return this.makeAPICall('users.identity', null, opts, cb);
};


Expand Down