Skip to content

Commit d58d0a1

Browse files
apply review feedback (#4035)
1 parent 92aef5b commit d58d0a1

File tree

1 file changed

+20
-10
lines changed

1 file changed

+20
-10
lines changed

proposals/2666-get-rooms-in-common.md

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,19 @@ Homeservers will implement a new endpoint `/_matrix/client/v1/user/mutual_rooms`
2626
This endpoint will take a query parameter of `user_id` which will contain the MXID of the user
2727
matched against.
2828

29-
This endpoint can be rate limited.
29+
This endpoint can be rate limited and requires authentication.
3030

3131
The response format will be an array containing all rooms where both the authenticated user and
32-
`user_id` have a membership of type `join`. If the `user_id` does not exist, or does not share any
33-
rooms with the authenticated user, an empty array should be returned.
32+
`user_id` have a membership of type `join`.
33+
34+
If the `user_id` does not exist, or does not share any rooms with the authenticated user,
35+
an empty array should be returned.
36+
37+
Handling invalid user IDs should result in an error, is likely implementation-specific,
38+
and is beyond the scope of this proposal.
3439

3540
```http
36-
GET /_matrix/client/v1/user/mutual_rooms/?user_id=%40bob%3Aexample.com
41+
GET /_matrix/client/v1/user/mutual_rooms?user_id=%40bob%3Aexample.com
3742
```
3843

3944
```json
@@ -47,24 +52,29 @@ GET /_matrix/client/v1/user/mutual_rooms/?user_id=%40bob%3Aexample.com
4752
```
4853

4954
The server may decide that the response to this endpoint is too large, and thus an optional key
50-
`"next_batch_token"` can be inserted, which the client has to pass to `batch_token` in the query
55+
`"next_batch"` can be inserted, which the client has to pass to `from` in the query
5156
parameters together with the original `user_id` to fetch the next batch of responses. This will
52-
continue until the server does no longer insert `"next_batch_token"`.
57+
continue until the server does no longer insert `"next_batch"`.
5358

5459
```json5
5560
{
5661
"joined": [
5762
// ...
5863
],
59-
"next_batch_token": "<a string up to 32 characters abiding by the regex /[a-zA-Z0-9]+/>"
64+
"next_batch": "<an opaque identifier, containing only the characters [0-9a-zA-Z._~-], non-empty if not omitted, and at most 255 characters>"
6065
}
6166
```
6267

63-
The response error for when the given `batch_token` is invalid will be a response with HTTP code 400,
68+
The batch tokens this endpoint generates are only valid for this endpoint.
69+
70+
The response error for when the given `from` batch token is invalid will be a response with HTTP code 400,
6471
with `M_INVALID_PARAM` as `errcode`.
6572

66-
The response error for trying to get shared rooms with yourself will be an HTTP code 422, with
67-
`M_INVALID_PARAM` as the `errcode`.
73+
The response error for trying to get shared rooms with yourself will be an HTTP code 400, with
74+
`M_UNKNOWN` as the `errcode`. And the error description may be "you cannot request rooms in common with yourself".
75+
76+
Tokens generated by this endpoint must be valid for at least 10 minutes, after which, tokens can expire.
77+
Expired tokens must be handled similar to invalid tokens, as described above.
6878

6979
## Potential issues
7080

0 commit comments

Comments
 (0)