Flatten the response to /sync
Now that we don't expect there to be duplication betwen the 'timeline' and 'state' results, there's no point in having the state map. (That does mean the events themselves need event_id fields though). Also: - move the contents of the 'unsigned' dictionary into the events themselves - replace the state list with two layers of dictionary keyed on type and state_key - rename the children of the 'rooms' dict from "joined/invited/archived" to "join/invite/leave" to match the membership states
This commit is contained in:
parent
b41d771c15
commit
29bd4d45ee
5 changed files with 84 additions and 126 deletions
|
@ -2,16 +2,34 @@
|
|||
"type": "object",
|
||||
"title": "Event",
|
||||
"properties": {
|
||||
"age": {
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "Time in milliseconds since the event was sent."
|
||||
},
|
||||
"content": {
|
||||
"type": "object",
|
||||
"title": "EventContent",
|
||||
"description": "The content of this event. The fields in this object will vary depending on the type of event."
|
||||
},
|
||||
"event_id": {
|
||||
"type": "string",
|
||||
"description": "Globally unique identifier for this event."
|
||||
},
|
||||
"origin_server_ts": {
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "Timestamp in milliseconds on originating homeserver when this event was sent."
|
||||
},
|
||||
"prev_content": {
|
||||
"title": "EventContent",
|
||||
"type": "object",
|
||||
"description": "Optional. The previous ``content`` for this state. This will be present only for state events appearing in the ``timeline``. If this is not a state event, or there is no previous content, this key will be missing."
|
||||
},
|
||||
"prev_sender": {
|
||||
"type": "string",
|
||||
"description": "Optional. The ``sender`` of the previous event for this state. This will be present only for state events appearing in the ``timeline``. If this is not a state event, or there was no previous event for this state, this key will be missing."
|
||||
},
|
||||
"sender": {
|
||||
"type": "string",
|
||||
"description": "The MXID of the user who sent this event."
|
||||
|
@ -24,30 +42,9 @@
|
|||
"type": "string",
|
||||
"description": "The type of event."
|
||||
},
|
||||
"unsigned": {
|
||||
"type": "object",
|
||||
"title": "Unsigned",
|
||||
"description": "Information about this event which was not sent by the originating homeserver",
|
||||
"properties": {
|
||||
"age": {
|
||||
"type": "integer",
|
||||
"format": "int64",
|
||||
"description": "Time in milliseconds since the event was sent."
|
||||
},
|
||||
"prev_content": {
|
||||
"title": "EventContent",
|
||||
"type": "object",
|
||||
"description": "Optional. The previous ``content`` for this state. This will be present only for state events appearing in the ``timeline``. If this is not a state event, or there is no previous content, this key will be missing."
|
||||
},
|
||||
"replaces_state": {
|
||||
"type": "string",
|
||||
"description": "Optional. The event_id of the previous event for this state. This will be present only for state events appearing in the ``timeline``. If this is not a state event, or there is no previous content, this key will be missing."
|
||||
},
|
||||
"txn_id": {
|
||||
"type": "string",
|
||||
"description": "Optional. The transaction ID set when this message was sent. This key will only be present for message events sent by the device calling this API."
|
||||
}
|
||||
}
|
||||
"txn_id": {
|
||||
"type": "string",
|
||||
"description": "Optional. The transaction ID set when this message was sent. This key will only be present for message events sent by the device calling this API."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,12 +0,0 @@
|
|||
{
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"events": {
|
||||
"type": "array",
|
||||
"description": "List of event ids",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"type": "object",
|
||||
"allOf": [{"$ref":"definitions/room_event_batch.json"}],
|
||||
"allOf": [{"$ref":"definitions/event_batch.json"}],
|
||||
"properties": {
|
||||
"limited": {
|
||||
"type": "boolean",
|
||||
|
|
|
@ -95,7 +95,7 @@ paths:
|
|||
description: |-
|
||||
Updates to rooms.
|
||||
properties:
|
||||
joined:
|
||||
join:
|
||||
title: Joined Rooms
|
||||
type: object
|
||||
description: |-
|
||||
|
@ -104,19 +104,6 @@ paths:
|
|||
title: Joined Room
|
||||
type: object
|
||||
properties:
|
||||
event_map:
|
||||
title: EventMap
|
||||
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:
|
||||
title: Event
|
||||
description: An event object.
|
||||
type: object
|
||||
allOf:
|
||||
- $ref: "definitions/event.json"
|
||||
state:
|
||||
title: State
|
||||
type: object
|
||||
|
@ -127,7 +114,7 @@ paths:
|
|||
``timeline``, if ``since`` is not given, or
|
||||
``full_state`` is true).
|
||||
allOf:
|
||||
- $ref: "definitions/room_event_batch.json"
|
||||
- $ref: "definitions/state_batch.json"
|
||||
timeline:
|
||||
title: Timeline
|
||||
type: object
|
||||
|
@ -145,7 +132,7 @@ paths:
|
|||
e.g. typing.
|
||||
allOf:
|
||||
- $ref: "definitions/event_batch.json"
|
||||
invited:
|
||||
invite:
|
||||
title: Invited Rooms
|
||||
type: object
|
||||
description: |-
|
||||
|
@ -171,36 +158,23 @@ paths:
|
|||
delta against the archived ``state`` not the
|
||||
``invite_state``.
|
||||
allOf:
|
||||
- $ref: "definitions/event_batch.json"
|
||||
archived:
|
||||
title: Archived rooms
|
||||
- $ref: "definitions/state_batch.json"
|
||||
leave:
|
||||
title: Left rooms
|
||||
type: object
|
||||
description: |-
|
||||
The rooms that the user has left or been banned from.
|
||||
additionalProperties:
|
||||
title: Archived Room
|
||||
title: Left Room
|
||||
type: object
|
||||
properties:
|
||||
event_map:
|
||||
title: EventMap
|
||||
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:
|
||||
title: Event
|
||||
description: An event object.
|
||||
type: object
|
||||
allOf:
|
||||
- $ref: "definitions/event.json"
|
||||
state:
|
||||
title: State
|
||||
type: object
|
||||
description: |-
|
||||
The state updates for the room up to the start of the timeline.
|
||||
allOf:
|
||||
- $ref: "definitions/room_event_batch.json"
|
||||
- $ref: "definitions/state_batch.json"
|
||||
timeline:
|
||||
title: Timeline
|
||||
type: object
|
||||
|
@ -230,46 +204,43 @@ paths:
|
|||
]
|
||||
},
|
||||
"rooms": {
|
||||
"joined": {
|
||||
"join": {
|
||||
"!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"},
|
||||
"unsigned": {
|
||||
"prev_content": {"membership": "invite"}
|
||||
},
|
||||
"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"
|
||||
]
|
||||
"m.room.member": {
|
||||
"@alice:example.com": {
|
||||
"sender": "@alice:example.com",
|
||||
"type": "m.room.member",
|
||||
"state_key": "@alice:example.com",
|
||||
"content": {"membership": "join"},
|
||||
"origin_server_ts": 1417731086795,
|
||||
"event_id": "$66697273743031:example.com"
|
||||
}
|
||||
}
|
||||
},
|
||||
"timeline": {
|
||||
"events": [
|
||||
"$7365636s6r6432:example.com",
|
||||
"$74686972643033:example.com"
|
||||
{
|
||||
"sender": "@bob:example.com",
|
||||
"type": "m.room.member",
|
||||
"state_key": "@bob:example.com",
|
||||
"content": {"membership": "join"},
|
||||
"prev_content": {"membership": "invite"},
|
||||
"origin_server_ts": 1417731086795,
|
||||
"event_id": "$7365636s6r6432:example.com":
|
||||
},
|
||||
{
|
||||
"sender": "@alice:example.com",
|
||||
"type": "m.room.message",
|
||||
"age": 124524,
|
||||
"txn_id": "1234",
|
||||
"content": {
|
||||
"body": "I am a fish",
|
||||
"msgtype": "m.text"
|
||||
},
|
||||
"origin_server_ts": 1417731086797,
|
||||
"event_id": "$74686972643033:example.com"
|
||||
}
|
||||
],
|
||||
"limited": true,
|
||||
"prev_batch": "t34-23535_0_0"
|
||||
|
@ -277,6 +248,7 @@ paths:
|
|||
"ephemeral": {
|
||||
"events": [
|
||||
{
|
||||
"room_id": "!726s6s6q:example.com",
|
||||
"type": "m.typing",
|
||||
"content": {"user_ids": ["@alice:example.com"]}
|
||||
}
|
||||
|
@ -284,26 +256,30 @@ paths:
|
|||
}
|
||||
}
|
||||
},
|
||||
"invited": {
|
||||
"invite": {
|
||||
"!696r7674:example.com": {
|
||||
"invite_state": {
|
||||
"events": [
|
||||
{
|
||||
"m.room.name": {
|
||||
"": {
|
||||
"sender": "@alice:example.com",
|
||||
"type": "m.room.name",
|
||||
"state_key": "",
|
||||
"content": {"name": "My Room Name"}
|
||||
},
|
||||
{
|
||||
"content": {"name": "My Room Name"},
|
||||
"event_id": "$asdkgjrsfg2314375:example.com",
|
||||
|
||||
}
|
||||
},
|
||||
"m.room.member": {
|
||||
"@bob:example.com": {
|
||||
"sender": "@alice:example.com",
|
||||
"type": "m.room.member",
|
||||
"state_key": "@bob:example.com",
|
||||
"content": {"membership": "invite"}
|
||||
}
|
||||
]
|
||||
"content": {"membership": "invite"},
|
||||
"event_id": "$257kasjdg315324akhg:example.com",
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"archived": {}
|
||||
"leave": {}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue