Split the room_map into separate sections based on whether they are

"joined/invited/archived".

Rename the room_map to rooms and remove the grouping indirection. When we
want groups then we can add them under a separate key, either at the
top-level or as part of the events themselves.
markjh/v2_sync_api
Mark Haines 9 years ago
parent 0e5b00feaa
commit 0ce533d153

@ -74,82 +74,92 @@ paths:
rooms: rooms:
type: object type: object
description: |- description: |-
The updates to rooms, grouped according to the filter. By Updates to rooms.
default there is a single ``default`` group. properties:
additionalProperties: joined:
joined: type: object
type: array additionalProperties:
description: |- type: object
A list of room ids that the user is a member of that properties:
have updates. event_map:
items: type: object
type: string. description: |-
invited: A map from event ID to events for this room. The
type: array events are referenced from the ``timeline`` and
description: |- ``state`` keys for this room.
A list of room ids that the user has been invited to. additionalProperties:
The entries in the room_map will have an description: An event object.
``invite_state`` key. But will lack the ``ephemeral`` type: object
key, the ``timeline`` key and the ``state`` key. state:
items: description: |-
type: string. The state updates for the room.
archived: allOf:
type: array - $ref: "definitions/room_event_batch.json"
description: |- timeline:
A list of room ids that the user has left or been description: |-
banned from. The entries in the room_map will have a The timeline of messages and state changes in the
``state`` key and a ``timeline`` key. But will lack the room.
``ephemeral`` key. allOf:
items: - $ref: "definitions/timeline_batch.json"
type: string. ephemeral:
room_map: description: |-
description: |- The ephemeral events in the room that aren't
Map from room id to the updates for that room. The room ids recorded in the timeline or state of the room.
are referenced from the ``rooms`` key. e.g. typing.
type: object allOf:
additionalProperties: - $ref: "definitions/event_batch.json"
type: object invited:
properties: type: object
event_map: description: |-
The rooms that the user has been invited to.
additionalProperties:
type: object type: object
description: |- properties:
A map from event ID to events for this room. The events invite_state:
are referenced from the ``timeline`` and ``state`` keys description: |-
for this room. The state of a room that the user has been invited
additionalProperties: to. These state events may only have the `sender``,
description: An event object. ``type``, ``state_key`` and ``content`` keys
type: object present. These events do not replace any state that
state: the client already has for the room, for example if
description: |- the client has archived the room. Instead the
The state updates for the room. client should keep two separate copies of the
allOf: state: the one from the ``invite_state`` and one
- $ref: "definitions/room_event_batch.json" from the archived ``state``. If the client joins
timeline: the room then the current state will be given as a
description: |- delta against the archived ``state`` not the
The timeline of messages and state changes in the room. ``invite_state``.
allOf: allOf:
- $ref: "definitions/timeline_batch.json" - $ref: "definitions/event_batch.json"
ephemeral: archived:
description: |- type: object
The ephemeral events in the room that aren't recorded description: |-
in the timeline or state of the room. E.g. typing. The rooms that the user has left or been banned from. The
allOf: entries in the room_map will lack an ``ephemeral`` key.
- $ref: "definitions/event_batch.json" additionalProperties:
invite_state: type: object
description: |- properties:
The state of a room that the user has been invited to. event_map:
These state events may only have the `sender``, type: object
``type``, ``state_key`` and ``content`` keys present. description: |-
These events do not replace any state that the client A map from event ID to events for this room. The
already has for the room, for example if the client has events are referenced from the ``timeline`` and
archived the room. Instead the client should keep two ``state`` keys for this room.
separate copies of the state: the one from the additionalProperties:
``invite_state`` and one from the archived ``state``. description: An event object.
If the client joins the room then the current state type: object
will be given as a delta against the archived ``state`` state:
not the ``invite_state``. description: |-
allOf: The state updates for the room up to the point when
- $ref: "definitions/event_batch.json" the user left.
allOf:
- $ref: "definitions/room_event_batch.json"
timeline:
description: |-
The timeline of messages and state changes in the
room up to the point when the user left.
allOf:
- $ref: "definitions/timeline_batch.json"
presence: presence:
description: |- description: |-
The updates to the presence status of other users. The updates to the presence status of other users.
@ -169,78 +179,79 @@ paths:
] ]
}, },
"rooms": { "rooms": {
"default": { "joined": {
"invited": ["!696r7674:example.com"], "!726s6s6q:example.com": {
"archived": [], "event_map": {
"joined": ["!726s6s6q:example.com"] "$66697273743031:example.com": {
}
},
"room_map": {
"!726s6s6q:example.com": {
"event_map": {
"$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": {
"events": [
"$7365636s6r6432:example.com",
"$74686972643033:example.com"
],
"limited": true,
"prev_batch": "t34-23535_0_0"
},
"ephemeral": {
"events": [
{
"room_id": "!726s6s6q:example.com",
"type": "m.typing",
"content": {"user_ids": ["@alice:example.com"]}
}
]
}
},
"!696r7674:example.com": {
"invite_state": {
"events": [
{
"sender": "@alice:example.com", "sender": "@alice:example.com",
"type": "m.room.name", "type": "m.room.member",
"state_key": "", "state_key": "@alice:example.com",
"content": {"name": "My Room Name"} "content": {"membership": "join"},
"origin_server_ts": 1417731086795
}, },
{ "$7365636s6r6432:example.com": {
"sender": "@alice:example.com", "sender": "@bob:example.com",
"type": "m.room.member", "type": "m.room.member",
"state_key": "@bob:example.com", "state_key": "@bob:example.com",
"content": {"membership": "invite"} "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": {
"events": [
"$7365636s6r6432:example.com",
"$74686972643033:example.com"
],
"limited": true,
"prev_batch": "t34-23535_0_0"
},
"ephemeral": {
"events": [
{
"room_id": "!726s6s6q:example.com",
"type": "m.typing",
"content": {"user_ids": ["@alice:example.com"]}
}
]
}
} }
} },
"invited": {
"!696r7674:example.com": {
"invite_state": {
"events": [
{
"sender": "@alice:example.com",
"type": "m.room.name",
"state_key": "",
"content": {"name": "My Room Name"}
},
{
"sender": "@alice:example.com",
"type": "m.room.member",
"state_key": "@bob:example.com",
"content": {"membership": "invite"}
}
]
}
}
},
"archived": {}
} }
} }

Loading…
Cancel
Save