From 055590c0c67914d59dbce41db72eb44ca1fcfd6b Mon Sep 17 00:00:00 2001 From: David Baker Date: Fri, 21 Jul 2017 11:13:27 +0100 Subject: [PATCH] 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.