1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-25 05:23:13 +03:00

Add wrapper for group join API (#633)

Needed for new "joinable" groups.
This commit is contained in:
Luke Barnard
2018-03-29 12:42:16 +01:00
committed by GitHub
parent 3e5ea745d2
commit d53cd41aa6

View File

@@ -633,6 +633,19 @@ MatrixBaseApis.prototype.acceptGroupInvite = function(groupId, opts = null) {
return this._http.authedRequest(undefined, "PUT", path, undefined, opts || {}); return this._http.authedRequest(undefined, "PUT", path, undefined, opts || {});
}; };
/**
* @param {string} groupId
* @return {module:client.Promise} Resolves: Empty object
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixBaseApis.prototype.joinGroup = function(groupId) {
const path = utils.encodeUri(
"/groups/$groupId/self/join",
{$groupId: groupId},
);
return this._http.authedRequest(undefined, "PUT", path, undefined, {});
};
/** /**
* @param {string} groupId * @param {string} groupId
* @return {module:client.Promise} Resolves: Empty object * @return {module:client.Promise} Resolves: Empty object