Replace the events array with events_map inside the room objects.

Only use indirection for the state and timeline events.
Use event_ids to reference the state and timeline events.
pull/977/head
Mark Haines 9 years ago
parent 6ad6c40147
commit 218cf94ead

@ -3,9 +3,9 @@
"properties": { "properties": {
"events": { "events": {
"type": "array", "type": "array",
"description": "List of indices into an events array", "description": "List of events",
"items": { "items": {
"type": "integer" "type": "object"
} }
} }
} }

@ -0,0 +1,12 @@
{
"type": "object",
"properties": {
"events": {
"type": "array",
"description": "List of event ids",
"items": {
"type": "string"
}
}
}
}

@ -1,6 +1,6 @@
{ {
"type": "object", "type": "object",
"allOf": [{"$ref":"definitions/event_batch.json"}], "allOf": [{"$ref":"definitions/room_event_batch.json"}],
"properties": { "properties": {
"limited": { "limited": {
"type": "boolean", "type": "boolean",

@ -71,13 +71,6 @@ paths:
description: |- description: |-
The batch token to supply in the ``since`` param of the next The batch token to supply in the ``since`` param of the next
``/sync`` request. ``/sync`` request.
events:
type: array
description: |-
A list of event objects that are referred to by index in the
rest of the ``sync`` response.
items:
type: object
rooms: rooms:
type: array type: array
description: |- description: |-
@ -89,11 +82,20 @@ paths:
type: string type: string
description: |- description: |-
The ID of the room. The ID of the room.
event_map:
type: object
description: |-
A map from event ID to events for this room. The events
are referenced from the ``timeline`` and ``state`` keys
for this room.
additionalProperties:
description: An event object.
type: object
state: state:
description: |- description: |-
The state updates for the room. The state updates for the room.
allOf: allOf:
- $ref: "definitions/event_batch.json" - $ref: "definitions/room_event_batch.json"
timeline: timeline:
description: |- description: |-
The timeline of messages and state changes in the room. The timeline of messages and state changes in the room.
@ -120,62 +122,76 @@ paths:
application/json: |- application/json: |-
{ {
"next_batch": "s72595_4483_1934", "next_batch": "s72595_4483_1934",
"events": [ "private_user_data": {
{ "events": [
"sender": "@bob:example.com", {
"type": "com.example.weird.setting", "sender": "@bob:example.com",
"content": {"setting1": true, "setting2": false} "type": "com.example.weird.setting",
}, "content": {"setting1": true, "setting2": false}
{ }
"sender": "@alice:example.com", ]
"type": "m.profile.display_name", },
"content": {"display_name": "Alice"} "public_user_data": {
}, "events": [
{ {
"sender": "@alice:example.com", "sender": "@alice:example.com",
"type": "m.presence", "type": "m.profile.display_name",
"content": {"presence": "online"} "content": {"display_name": "Alice"}
}, },
{ {
"room_id": "!726s6s6q:example.com", "sender": "@alice:example.com",
"type": "m.typing", "type": "m.presence",
"content": {"user_ids": ["@alice:example.com"]} "content": {"presence": "online"}
}, }
{ ]
"sender": "@alice:example.com", },
"room_id": "!726s6s6q:example.com",
"type": "m.room.member",
"state_key": "@alice:example.com",
"content": {"membership": "join"},
"origin_server_ts": 1417731086795
},
{
"sender": "@bob:example.com",
"room_id": "!726s6s6q:example.com",
"type": "m.room.member",
"state_key": "@bob:example.com",
"content": {"membership": "join"},
"origin_server_ts": 1417731086795
},
{
"sender": "@alice:example.com",
"room_id": "!726s6s6q:example.com",
"type": "m.room.message",
"unsigned": {"age": "124524", "txn_id": "1234"},
"content": {"body": "I am a fish", "msgtype": "m.text"},
"origin_server_ts": 1417731086797
}
],
"private_user_data": {"events": [0]},
"public_user_data": {"events": [1, 2]},
"rooms": [{ "rooms": [{
"room_id": "!726s6s6q:example.com", "room_id": "!726s6s6q:example.com",
"ephemeral": {"events": [3]}, "event_map": {
"state": {"events": [4, 5]}, "$66697273743031:example.com": {
"sender": "@alice:example.com",
"type": "m.room.member",
"state_key": "@alice:example.com",
"content": {"membership": "join"},
"origin_server_ts": 1417731086795
},
"$7365636s6r6432:example.com": {
"sender": "@bob:example.com",
"type": "m.room.member",
"state_key": "@bob:example.com",
"content": {"membership": "join"},
"origin_server_ts": 1417731086795
},
"$74686972643033:example.com": {
"sender": "@alice:example.com",
"type": "m.room.message",
"unsigned": {"age": "124524", "txn_id": "1234"},
"content": {"body": "I am a fish", "msgtype": "m.text"},
"origin_server_ts": 1417731086797
}
},
"state": {
"events": [
"$66697273743031:example.com",
"$7365636s6r6432:example.com"
]
},
"timeline": { "timeline": {
"events": [5,6], "events": [
"$7365636s6r6432:example.com",
"$74686972643033:example.com"
],
"limited": true, "limited": true,
"prev_batch": "t34-23535_0_0" "prev_batch": "t34-23535_0_0"
},
"ephemeral": {
"events": [
{
"room_id": "!726s6s6q:example.com",
"type": "m.typing",
"content": {"user_ids": ["@alice:example.com"]}
}
]
} }
}] }]
} }

Loading…
Cancel
Save