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.
This commit is contained in:
Mark Haines 2015-10-06 13:42:03 +01:00
parent 0e5b00feaa
commit 0ce533d153

View file

@ -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: |-
A list of room ids that the user is a member of that
have updates.
items:
type: string.
invited:
type: array
description: |-
A list of room ids that the user has been invited to.
The entries in the room_map will have an
``invite_state`` key. But will lack the ``ephemeral``
key, the ``timeline`` key and the ``state`` key.
items:
type: string.
archived:
type: array
description: |-
A list of room ids that the user has left or been
banned from. The entries in the room_map will have a
``state`` key and a ``timeline`` key. But will lack the
``ephemeral`` key.
items:
type: string.
room_map:
description: |-
Map from room id to the updates for that room. The room ids
are referenced from the ``rooms`` key.
type: object
additionalProperties:
type: object
properties:
event_map:
type: object type: object
description: |- properties:
A map from event ID to events for this room. The events event_map:
are referenced from the ``timeline`` and ``state`` keys type: object
for this room. description: |-
additionalProperties: A map from event ID to events for this room. The
description: An event object. events are referenced from the ``timeline`` and
type: object ``state`` keys for this room.
state: additionalProperties:
description: |- description: An event object.
The state updates for the room. type: object
allOf: state:
- $ref: "definitions/room_event_batch.json" description: |-
timeline: The state updates for the room.
description: |- allOf:
The timeline of messages and state changes in the room. - $ref: "definitions/room_event_batch.json"
allOf: timeline:
- $ref: "definitions/timeline_batch.json" description: |-
ephemeral: The timeline of messages and state changes in the
description: |- room.
The ephemeral events in the room that aren't recorded allOf:
in the timeline or state of the room. E.g. typing. - $ref: "definitions/timeline_batch.json"
allOf: ephemeral:
- $ref: "definitions/event_batch.json" description: |-
invite_state: The ephemeral events in the room that aren't
description: |- recorded in the timeline or state of the room.
The state of a room that the user has been invited to. e.g. typing.
These state events may only have the `sender``, allOf:
``type``, ``state_key`` and ``content`` keys present. - $ref: "definitions/event_batch.json"
These events do not replace any state that the client invited:
already has for the room, for example if the client has type: object
archived the room. Instead the client should keep two description: |-
separate copies of the state: the one from the The rooms that the user has been invited to.
``invite_state`` and one from the archived ``state``. additionalProperties:
If the client joins the room then the current state type: object
will be given as a delta against the archived ``state`` properties:
not the ``invite_state``. invite_state:
allOf: description: |-
- $ref: "definitions/event_batch.json" The state of a room that the user has been invited
to. These state events may only have the `sender``,
``type``, ``state_key`` and ``content`` keys
present. These events do not replace any state that
the client already has for the room, for example if
the client has archived the room. Instead the
client should keep two separate copies of the
state: the one from the ``invite_state`` and one
from the archived ``state``. If the client joins
the room then the current state will be given as a
delta against the archived ``state`` not the
``invite_state``.
allOf:
- $ref: "definitions/event_batch.json"
archived:
type: object
description: |-
The rooms that the user has left or been banned from. The
entries in the room_map will lack an ``ephemeral`` key.
additionalProperties:
type: object
properties:
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:
description: |-
The state updates for the room up to the point when
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",
"type": "m.room.name",
"state_key": "",
"content": {"name": "My Room Name"}
},
{
"sender": "@alice:example.com", "sender": "@alice:example.com",
"type": "m.room.member", "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", "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": {}
} }
} }