1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-26 17:03:12 +03:00

Implement 'joined_groups' API (#477)

* Add group summary api

* Add doc for group summary API

and remove callback param as it's deprecated

* API for /joined_groups

* Create group API

* Make doc marginally more helpful
This commit is contained in:
David Baker
2017-07-06 22:02:17 +01:00
committed by Luke Barnard
parent adc2070ac1
commit 527cd0a6e5

View File

@@ -401,6 +401,39 @@ MatrixBaseApis.prototype.roomState = function(roomId, callback) {
return this._http.authedRequest(callback, "GET", path);
};
/**
* @param {string} groupId
* @return {module:client.Promise} Resolves: Group summary object
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixBaseApis.prototype.getGroupSummary = function(groupId) {
const path = utils.encodeUri("/groups/$groupId/summary", {$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.
*/
MatrixBaseApis.prototype.getJoinedGroups = function() {
const path = utils.encodeUri("/joined_groups");
return this._http.authedRequest(undefined, "GET", path);
};
/**
* @param {Object} content Request content
* @param {string} content.localpart The local part of the desired group ID
* @param {Object} content.profile Group profile object
* @return {module:client.Promise} Resolves: Object with key group_id: id of the created group
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
MatrixBaseApis.prototype.createGroup = function(content) {
const path = utils.encodeUri("/create_group");
return this._http.authedRequest(
undefined, "POST", path, undefined, content,
);
};
/**
* Retrieve a state event.
* @param {string} roomId