matrix-org / matrix-org/matrix-spec
Ability to specify a filter for /_matrix/client/v3/rooms/{roomId}/state
Nobody has claimed this yet.
- Dominant language
- HTML
- Stars
- 330
- Forks
- 150
- Avg merge
- 2h 21m
- Merged PRs (30d)
- 3
Description
For https://spec.matrix.org/latest/client-server-api/#get_matrixclientv3roomsroomidstate
When working on specific integrations (notably, those that do not /sync) it's common practice to pull in state for a room via the /state API. The reason for doing so is that often you want several state events, and events of the same type. There isn't another way currently to fetch many state events of the same type, as the only APIs that exist are /state, and /state/{eventType}/{stateKey}.
Therefore, often a lot of time is wasted gathering the entire state of the room and sending it along to the integration whereby most of it (e.g. members) are thrown out immediately. Performance could be improved on both sides by allowing a mechanism to filter for the state you care about instead.
For the example of hookshot, we have many state event types that we support (uk.half-shot.hookshot.github.*) but also many that we don't care about. Often the startup loop consists of fetching all state for a room, and then determining it's room type(s) by the events that get returned. A lot of time could be saved by specifying a filter here.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading the Matrix Client-Server API section for GET /_matrix/client/v3/rooms/{roomId}/state, linked in the issue. Consider the Hookshot example and the need to fetch selected events, including multiple events of the same type. Done would mean the specification defines a filter mechanism for this endpoint; the issue does not specify its exact syntax or behavior.
Written by the indexing model from the issue text.
Assessment
- Domain
- api, backend-api-design
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100