diff --git a/src/base-apis.js b/src/base-apis.js index 1d59d9137..eca3c0ca9 100644 --- a/src/base-apis.js +++ b/src/base-apis.js @@ -443,6 +443,20 @@ MatrixBaseApis.prototype.setGroupProfile = function(groupId, profile) { ); }; +/** + * @param {string} groupId + * @param {boolean} isJoinable whether anyone can join the group or only those who + * are invited. + * @return {module:client.Promise} Resolves: Empty object + * @return {module:http-api.MatrixError} Rejects: with an error response. + */ +MatrixBaseApis.prototype.setGroupJoinable = function(groupId, isJoinable) { + const path = utils.encodeUri("/groups/$groupId/joinable", {$groupId: groupId}); + return this._http.authedRequest( + undefined, "PUT", path, undefined, { joinable: isJoinable }, + ); +}; + /** * @param {string} groupId * @return {module:client.Promise} Resolves: Group users list object