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

support paginating relations

This commit is contained in:
Bruno Windels
2019-06-25 14:51:25 +02:00
parent 424b6303ef
commit 67462e9fc4
2 changed files with 20 additions and 6 deletions

View File

@@ -440,14 +440,20 @@ MatrixBaseApis.prototype.createRoom = function(options, callback) {
};
MatrixBaseApis.prototype.fetchRelations =
async function(roomId, eventId, relationType, eventType) {
async function(roomId, eventId, relationType, eventType, opts) {
const queryParams = {};
if (opts.token) {
queryParams.from = opts.token;
}
const queryString = utils.encodeParams(queryParams);
// valid options include: room_alias_name, visibility, invite
const response = await this._http.authedRequestWithPrefix(
undefined,
"GET", `/rooms/${roomId}/relations/${eventId}/${relationType}/${eventType}`,
"GET",
`/rooms/${roomId}/relations/${eventId}/${relationType}/${eventType}?` + queryString,
null, null, httpApi.PREFIX_UNSTABLE,
);
return response.chunk;
return response;
};
/**