Skip to content

Commit 486a8f8

Browse files
authored
Improvements to "Events" section (#2349)
* Clarify string formats of event endpoints and schemas Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr> * Fix links to endpoints Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr> * Add changelog Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr> --------- Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
1 parent 96799c2 commit 486a8f8

25 files changed

Lines changed: 106 additions & 13 deletions
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Clarify formats of string types.

content/client-server-api/_index.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3348,8 +3348,8 @@ room at the start of the returned timeline. The response also includes a
33483348
`next_batch` field, which should be used as the value of the `since`
33493349
parameter in the next call to `/sync`. Finally, the response includes,
33503350
for each room, a `prev_batch` field, which can be passed as a `from`/`to`
3351-
parameter to the [`/rooms/<room_id>/messages`](/client-server-api/#get_matrixclientv3roomsroomidmessages) API to retrieve earlier
3352-
messages.
3351+
parameter to the [`/rooms/{roomId}/messages`](#get_matrixclientv3roomsroomidmessages)
3352+
API to retrieve earlier messages.
33533353

33543354
For example, a `/sync` request might return a range of four events
33553355
`E2`, `E3`, `E4` and `E5` within a given room, omitting two prior events
@@ -3368,7 +3368,8 @@ response to the previous call as the `since` parameter. The client
33683368
should also pass a `timeout` parameter. The server will then hold open
33693369
the HTTP connection for a short period of time waiting for new events,
33703370
returning early if an event occurs. Only the `/sync` API (and the
3371-
deprecated `/events` API) support long-polling in this way.
3371+
deprecated [`/events`](#get_matrixclientv3events) API) support
3372+
long-polling in this way.
33723373

33733374
Continuing the example above, an incremental sync might report
33743375
a single new event `E6`. The response can be visualised as:
@@ -3388,7 +3389,7 @@ containing only the most recent message events. A state "delta" is also
33883389
returned, summarising any state changes in the omitted part of the
33893390
timeline. The client may therefore end up with "gaps" in its knowledge
33903391
of the message timeline. The client can fill these gaps using the
3391-
[`/rooms/<room_id>/messages`](/client-server-api/#get_matrixclientv3roomsroomidmessages) API.
3392+
[`/rooms/{roomId}/messages`](#get_matrixclientv3roomsroomidmessages) API.
33923393

33933394
Continuing our example, suppose we make a third `/sync` request asking for
33943395
events since the last sync, by passing the `next_batch` token `x-y-z` as
@@ -3411,7 +3412,7 @@ The limited response includes a state delta which describes how the state
34113412
of the room changes over the gap. This delta explains how to build the state
34123413
prior to returned timeline (i.e. at `E7`) from the state the client knows
34133414
(i.e. at `E6`). To close the gap, the client should make a request to
3414-
[`/rooms/<room_id>/messages`](/client-server-api/#get_matrixclientv3roomsroomidmessages)
3415+
[`/rooms/{roomId}/messages`](#get_matrixclientv3roomsroomidmessages)
34153416
with the query parameters `from=x-y-z` and `to=d-e-f`.
34163417

34173418
{{% boxes/warning %}}

data/api/client-server/definitions/client_event.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,9 @@ allOf:
2424
room_id:
2525
description: The ID of the room associated with this event.
2626
type: string
27+
format: mx-room-id
28+
pattern: "^!"
2729
example: '!jEsUZKDJdhlrceRyVU:example.org'
28-
2930
unsigned:
3031
properties:
3132
redacted_because:
@@ -43,6 +44,6 @@ allOf:
4344
"unsigned": {
4445
"age": 1257,
4546
}
46-
}
47+
}
4748
required:
4849
- room_id

data/api/client-server/definitions/client_event_without_room_id.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ properties:
2828
event_id:
2929
description: The globally unique identifier for this event.
3030
type: string
31+
format: mx-event-id
32+
pattern: "^\\$"
3133
example: '$26RqwJMLw-yds1GAH_QxjHRC1Da9oasK0e5VLnck_45'
3234
type:
3335
description: The type of the event.
@@ -47,6 +49,8 @@ properties:
4749
sender:
4850
description: Contains the fully-qualified ID of the user who sent this event.
4951
type: string
52+
format: mx-user-id
53+
pattern: "^@"
5054
example: "@example:example.org"
5155
origin_server_ts:
5256
description: |-

data/api/client-server/definitions/m.relates_to.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,7 @@ properties:
3939
such.
4040
event_id:
4141
type: string
42+
format: mx-event-id
43+
pattern: "^\\$"
4244
description: The event ID of the event that this event relates to.
4345
required: ['rel_type', 'event_id']

data/api/client-server/message_pagination.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ paths:
3737
example: "!636q39766251:example.com"
3838
schema:
3939
type: string
40+
format: mx-room-id
41+
pattern: "^!"
4042
- in: query
4143
name: from
4244
x-changedInMatrixVersion:

data/api/client-server/old_sync.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,8 @@ paths:
148148
properties:
149149
room_id:
150150
type: string
151+
format: mx-room-id
152+
pattern: "^!"
151153
description: The ID of this room.
152154
membership:
153155
type: string
@@ -337,6 +339,8 @@ paths:
337339
example: $asfDuShaf7Gafaw:matrix.org
338340
schema:
339341
type: string
342+
format: mx-event-id
343+
pattern: "^\\$"
340344
responses:
341345
"200":
342346
description: The full event.

data/api/client-server/redaction.yaml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,17 @@ paths:
4343
example: "!637q39766251:example.com"
4444
schema:
4545
type: string
46+
format: mx-room-id
47+
pattern: "^!"
4648
- in: path
4749
name: eventId
48-
description: The ID of the event to redact
50+
description: The ID of the event to redact.
4951
required: true
50-
example: bai2b1i9:matrix.org
52+
example: $bai2b1i9:matrix.org
5153
schema:
5254
type: string
55+
format: mx-event-id
56+
pattern: "^\\$"
5357
- in: path
5458
name: txnId
5559
description: |-
@@ -82,6 +86,8 @@ paths:
8286
properties:
8387
event_id:
8488
type: string
89+
format: mx-event-id
90+
pattern: "^\\$"
8591
description: A unique identifier for the event.
8692
examples:
8793
response:

data/api/client-server/relations.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,8 @@ components:
233233
example: "!636q39766251:matrix.org"
234234
schema:
235235
type: string
236+
format: mx-room-id
237+
pattern: "^!"
236238
eventId:
237239
in: path
238240
name: eventId
@@ -241,6 +243,8 @@ components:
241243
example: $asfDuShaf7Gafaw
242244
schema:
243245
type: string
246+
format: mx-event-id
247+
pattern: "^\\$"
244248
from:
245249
in: query
246250
name: from

data/api/client-server/room_event_by_timestamp.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,8 @@ paths:
5656
example: "!636q39766251:matrix.org"
5757
schema:
5858
type: string
59+
format: mx-room-id
60+
pattern: "^!"
5961
- in: query
6062
name: ts
6163
description: |-
@@ -86,6 +88,8 @@ paths:
8688
properties:
8789
event_id:
8890
type: string
91+
format: mx-event-id
92+
pattern: "^\\$"
8993
description: The ID of the event found
9094
origin_server_ts:
9195
type: integer

0 commit comments

Comments
 (0)