-
Notifications
You must be signed in to change notification settings - Fork 77
Open
Labels
enhancementNew feature or requestNew feature or request
Description
Is your feature request related to a problem? Please describe.
There is currently no wrapper around https://spec.matrix.org/v1.3/client-server-api/#get_matrixclientv3roomsroomidmessages to be able to load messages from a room.
Describe the solution you'd like
A nicely typed wrapper for that endpoint.
Describe alternatives you've considered
I'm currently doing this manually with doRequest
but it's a bit of extra legwork that I'd rather not do:
let from: string|undefined;
for (;;) {
const events = await this.matrixClient.doRequest(
'GET',
`/_matrix/client/v3/rooms/${encodeURIComponent(roomId)}/messages`,
{ dir: 'b', limit: 100, from },
);
for (const ev of events.chunk) {
if (ev.type === 'm.room.create') {
break;
} else if (ev.type === interestingEventType) {
interestingEvents.push(ev.content);
}
}
if (from === events.end) break;
from = events.end;
}
// use interestingEvents
The above could serve as an inspiration for the PR.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request