diff --git a/lib/api.user.js b/lib/api.user.js index e754f61..30b763e 100644 --- a/lib/api.user.js +++ b/lib/api.user.js @@ -348,6 +348,20 @@ var deleteEmailToken = module.exports.deleteEmailToken = function(restCtx, userI RestUtil.RestRequest(restCtx, url, 'DELETE', {}, callback); }; +/** + * Get a user's most recent groups through the REST API. + * + * @param {RestContext} restCtx Standard REST Context object that contains the current tenant URL and the current user credentials + * @param {String} userId User id whose recent groups you wish to receive + * @param {Function} callback Standard callback function + * @param {Object} callback.err Standard error object, if any + * @param {Group[]} callback.response The user's most recently visited groups + */ +var getRecentlyVisitedGroups = module.exports.getRecentlyVisitedGroups = function(restCtx, userId, callback) { + var url = '/api/user/' + RestUtil.encodeURIComponent(userId) + '/groups/recent'; + RestUtil.RestRequest(restCtx, url, 'GET', {}, callback); +}; + /** * Create a private tenant administrator user with mapped local authentication credentials on the provided tenant *