forked from cadence/out-of-your-element
Enumerate child rooms with hierarchy endpoint
This commit is contained in:
parent
ff7af39802
commit
642be26313
3 changed files with 42 additions and 3 deletions
|
@ -121,6 +121,19 @@ function getJoinedMembers(roomID) {
|
|||
return mreq.mreq("GET", `/client/v3/rooms/${roomID}/joined_members`)
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} roomID
|
||||
* @param {{from?: string, limit?: any}} pagination
|
||||
* @returns {Promise<Ty.HierarchyPagination<Ty.R.Hierarchy>>}
|
||||
*/
|
||||
function getHierarchy(roomID, pagination) {
|
||||
let path = `/client/v1/rooms/${roomID}/hierarchy`
|
||||
if (!pagination.from) delete pagination.from
|
||||
if (!pagination.limit) pagination.limit = 50
|
||||
path += `?${new URLSearchParams(pagination)}`
|
||||
return mreq.mreq("GET", path)
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} roomID
|
||||
* @param {string} eventID
|
||||
|
@ -239,6 +252,7 @@ module.exports.getEventForTimestamp = getEventForTimestamp
|
|||
module.exports.getAllState = getAllState
|
||||
module.exports.getStateEvent = getStateEvent
|
||||
module.exports.getJoinedMembers = getJoinedMembers
|
||||
module.exports.getHierarchy = getHierarchy
|
||||
module.exports.getRelations = getRelations
|
||||
module.exports.sendState = sendState
|
||||
module.exports.sendEvent = sendEvent
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue