You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-11-28 05:03:59 +03:00
Add base API for Space Summary MSC2946
This commit is contained in:
@@ -2374,3 +2374,26 @@ MatrixBaseApis.prototype.reportEvent = function(roomId, eventId, score, reason)
|
||||
return this._http.authedRequest(undefined, "POST", path, null, {score, reason});
|
||||
};
|
||||
|
||||
/**
|
||||
* Fetches or paginates a summary of a space as defined by MSC2946
|
||||
* @param {string} roomId The ID of the space-room to use as the root of the summary.
|
||||
* @param {number?} maxRoomsPerSpace The maximum number of rooms to return per subspace.
|
||||
* @param {boolean?} autoJoinOnly Whether to only return rooms with auto_join=true.
|
||||
* @param {number?} limit The maximum number of rooms to return in total.
|
||||
* @param {string?} batch The opaque token to paginate a previous summary request.
|
||||
* @returns {Promise} the response, with next_batch, rooms, events fields.
|
||||
*/
|
||||
MatrixBaseApis.prototype.getSpaceSummary = function(roomId, maxRoomsPerSpace, autoJoinOnly, limit, batch) {
|
||||
const path = utils.encodeUri("/rooms/$roomId/spaces", {
|
||||
$roomId: roomId,
|
||||
});
|
||||
|
||||
return this._http.authedRequest(undefined, "POST", path, null, {
|
||||
max_rooms_per_space: maxRoomsPerSpace,
|
||||
auto_join_only: autoJoinOnly,
|
||||
limit,
|
||||
batch,
|
||||
}, {
|
||||
prefix: PREFIX_UNSTABLE,
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user