From 055590c0c67914d59dbce41db72eb44ca1fcfd6b Mon Sep 17 00:00:00 2001 From: David Baker Date: Fri, 21 Jul 2017 11:13:27 +0100 Subject: [PATCH 1/2] Add more group APIs --- src/base-apis.js | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/src/base-apis.js b/src/base-apis.js index 1249dcd31..33940e267 100644 --- a/src/base-apis.js +++ b/src/base-apis.js @@ -411,6 +411,30 @@ MatrixBaseApis.prototype.getGroupSummary = function(groupId) { return this._http.authedRequest(undefined, "GET", path); }; +/** + * @param {string} groupId + * @param {Object} profile The group profile object, with name, avatar_url, + * short_description and long_description keys. + * @return {module:client.Promise} Resolves: Empty object + * @return {module:http-api.MatrixError} Rejects: with an error response. + */ +MatrixBaseApis.prototype.setGroupProfile = function(groupId, profile) { + const path = utils.encodeUri("/groups/$groupId/profile", {$groupId: groupId}); + return this._http.authedRequest( + undefined, "POST", path, undefined, profile, + ); +}; + +/** + * @param {string} groupId + * @return {module:client.Promise} Resolves: Group users list object + * @return {module:http-api.MatrixError} Rejects: with an error response. + */ +MatrixBaseApis.prototype.getGroupUsers = function(groupId) { + const path = utils.encodeUri("/groups/$groupId/users", {$groupId: groupId}); + return this._http.authedRequest(undefined, "GET", path); +}; + /** * @return {module:client.Promise} Resolves: The groups to which the user is joined * @return {module:http-api.MatrixError} Rejects: with an error response. From ed029fe3481972bfeb4959f80fe4a2098887f2e5 Mon Sep 17 00:00:00 2001 From: David Baker Date: Mon, 24 Jul 2017 09:55:04 +0100 Subject: [PATCH 2/2] More useful doc --- src/base-apis.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/base-apis.js b/src/base-apis.js index 33940e267..6e9364b0b 100644 --- a/src/base-apis.js +++ b/src/base-apis.js @@ -413,8 +413,11 @@ MatrixBaseApis.prototype.getGroupSummary = function(groupId) { /** * @param {string} groupId - * @param {Object} profile The group profile object, with name, avatar_url, - * short_description and long_description keys. + * @param {Object} profile The group profile object + * @param {string=} profile.name Name of the group + * @param {string=} profile.avatar_url MXC avatar URL + * @param {string=} profile.short_description A short description of the room + * @param {string=} profile.long_description A longer HTML description of the room * @return {module:client.Promise} Resolves: Empty object * @return {module:http-api.MatrixError} Rejects: with an error response. */