Skip to content

Commit f6da709

Browse files
authored
Mark from parameter as optional for /messages (#1002)
As per MSC3567, the `from` parameter is now optional for the `/messages` endpoint to allow fetching first or latest room content without having to rely on `/sync` matrix-org/matrix-spec-proposals#3567
1 parent ac9bee3 commit f6da709

File tree

2 files changed

+28
-17
lines changed

2 files changed

+28
-17
lines changed
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Make `from` optional on `GET /_matrix/client/v3/messages` to allow requesting events from the start or end of the room history, as per [MSC3567](https://github.com/matrix-org/matrix-doc/pull/3567).

data/api/client-server/message_pagination.yaml

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
14-
swagger: '2.0'
14+
swagger: "2.0"
1515
info:
1616
title: "Matrix Client-Server Rooms API"
1717
version: "1.0.0"
@@ -49,6 +49,10 @@ paths:
4949
- in: query
5050
type: string
5151
name: from
52+
x-changedInMatrixVersion:
53+
1.3: |
54+
Previously, this field was required and paginating from the first or
55+
last visible event in the room history wasn't supported.
5256
description: |-
5357
The token to start returning events from. This token can be obtained
5458
from a `prev_batch` or `next_batch` token returned by the `/sync` endpoint,
@@ -57,7 +61,11 @@ paths:
5761
This endpoint can also accept a value returned as a `start` token
5862
by a previous request to this endpoint, though servers are not
5963
required to support this. Clients should not rely on the behaviour.
60-
required: true
64+
65+
If it is not provided, the homeserver shall return a list of messages
66+
from the first or last (per the value of the `dir` parameter) visible
67+
event in the room history for the requesting user.
68+
required: false
6169
x-example: "s345_678_333"
6270
- in: query
6371
type: string
@@ -141,23 +149,25 @@ paths:
141149
$ref: "definitions/client_event.yaml"
142150
required: [start, chunk]
143151
examples:
144-
application/json: {
152+
application/json:
153+
{
145154
"start": "t47429-4392820_219380_26003_2265",
146155
"end": "t47409-4357353_219380_26003_2265",
147-
"chunk": [
148-
{
149-
"room_id": "!636q39766251:example.com",
150-
"$ref": "../../event-schemas/examples/m.room.message$m.text.yaml"
151-
},
152-
{
153-
"room_id": "!636q39766251:example.com",
154-
"$ref": "../../event-schemas/examples/m.room.name.yaml"
155-
},
156-
{
157-
"room_id": "!636q39766251:example.com",
158-
"$ref": "../../event-schemas/examples/m.room.message$m.video.yaml"
159-
}
160-
]
156+
"chunk":
157+
[
158+
{
159+
"room_id": "!636q39766251:example.com",
160+
"$ref": "../../event-schemas/examples/m.room.message$m.text.yaml",
161+
},
162+
{
163+
"room_id": "!636q39766251:example.com",
164+
"$ref": "../../event-schemas/examples/m.room.name.yaml",
165+
},
166+
{
167+
"room_id": "!636q39766251:example.com",
168+
"$ref": "../../event-schemas/examples/m.room.message$m.video.yaml",
169+
},
170+
],
161171
}
162172
403:
163173
description: >

0 commit comments

Comments
 (0)