From 3aabd63975fe760debbd8bb8727a7a7a98826222 Mon Sep 17 00:00:00 2001 From: Richard Lewis Date: Sun, 4 Nov 2018 21:49:17 +0000 Subject: [PATCH 1/2] Add function to get currently joined rooms. --- src/base-apis.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/base-apis.js b/src/base-apis.js index 6dc9169dd..a0a842140 100644 --- a/src/base-apis.js +++ b/src/base-apis.js @@ -927,6 +927,14 @@ MatrixBaseApis.prototype.setRoomReadMarkersHttpRequest = ); }; +/** + * @return {module:client.Promise} Resolves: A list of the user's current rooms + * @return {module:http-api.MatrixError} Rejects: with an error response. + */ +MatrixBaseApis.prototype.getJoinedRooms = function() { + const path = utils.encodeUri("/joined_rooms"); + return this._http.authedRequest(undefined, "GET", path); +}; // Room Directory operations // ========================= From a0d51803ed46bb3bec03c85ac6fbcede603c5de8 Mon Sep 17 00:00:00 2001 From: Richard Lewis Date: Mon, 5 Nov 2018 00:08:04 +0000 Subject: [PATCH 2/2] Add function to get currently joined room members. --- src/base-apis.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/base-apis.js b/src/base-apis.js index a0a842140..38de1d693 100644 --- a/src/base-apis.js +++ b/src/base-apis.js @@ -936,6 +936,20 @@ MatrixBaseApis.prototype.getJoinedRooms = function() { return this._http.authedRequest(undefined, "GET", path); }; +/** + * Retrieve membership info. for a room. + * @param {string} roomId ID of the room to get membership for + * @return {module:client.Promise} Resolves: A list of currently joined users + * and their profile data. + * @return {module:http-api.MatrixError} Rejects: with an error response. + */ +MatrixBaseApis.prototype.getJoinedRoomMembers = function(roomId) { + const path = utils.encodeUri("/rooms/$roomId/joined_members", { + $roomId: roomId, + }); + return this._http.authedRequest(undefined, "GET", path); +}; + // Room Directory operations // =========================