From a0d5150ce9137bdf8ca670f46bf9c1a883dca3b4 Mon Sep 17 00:00:00 2001 From: skarppinen Date: Tue, 24 May 2016 12:58:15 +0100 Subject: [PATCH 1/3] API method to show recently visited groups for user --- lib/api.user.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/lib/api.user.js b/lib/api.user.js index e754f61..03b1caf 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) + '/recent'; + RestUtil.RestRequest(restCtx, url, 'GET', {}, callback); +}; + /** * Create a private tenant administrator user with mapped local authentication credentials on the provided tenant * From 35a40f7a8b94a552bd83e3a3b0008a1809c7d85e Mon Sep 17 00:00:00 2001 From: Salla Karppinen Date: Mon, 30 Jan 2017 12:07:42 +0000 Subject: [PATCH 2/3] Added keyword groups to API path --- lib/api.user.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/api.user.js b/lib/api.user.js index 03b1caf..d792687 100644 --- a/lib/api.user.js +++ b/lib/api.user.js @@ -358,7 +358,7 @@ var deleteEmailToken = module.exports.deleteEmailToken = function(restCtx, userI * @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) + '/recent'; + var url = '/api/user/' + RestUtil.encodeURIComponent(userId) + '/recent/groups'; RestUtil.RestRequest(restCtx, url, 'GET', {}, callback); }; From 393de735c2b53330d4b283754f1416d530062135 Mon Sep 17 00:00:00 2001 From: Salla Karppinen Date: Mon, 30 Jan 2017 12:23:10 +0000 Subject: [PATCH 3/3] Swapped groups and recent in path --- lib/api.user.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/api.user.js b/lib/api.user.js index d792687..30b763e 100644 --- a/lib/api.user.js +++ b/lib/api.user.js @@ -358,7 +358,7 @@ var deleteEmailToken = module.exports.deleteEmailToken = function(restCtx, userI * @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) + '/recent/groups'; + var url = '/api/user/' + RestUtil.encodeURIComponent(userId) + '/groups/recent'; RestUtil.RestRequest(restCtx, url, 'GET', {}, callback); };