Use consistent event examples throughout the Client-Server API

Fixes https://github.com/matrix-org/matrix-doc/issues/1968
pull/977/head
Travis Ralston 6 years ago
parent 4452ebf371
commit c25afa663e

@ -101,65 +101,35 @@ paths:
- "$ref": "definitions/event-schemas/schema/core-event-schema/state_event.yaml" - "$ref": "definitions/event-schemas/schema/core-event-schema/state_event.yaml"
examples: examples:
application/json: { application/json: {
"end": "t29-57_2_0_2", "end": "t29-57_2_0_2",
"events_after": [ "events_after": [
{ {
"age": 91911336, "room_id": "!636q39766251:example.com",
"content": { "$ref": "definitions/event-schemas/examples/m.room.message#m.text"
"body": "7",
"msgtype": "m.text"
},
"event_id": "$14460306086CiUaL:localhost:8480",
"origin_server_ts": 1446030608551,
"room_id": "!sCDvXTtzjpiPxaqkkt:localhost:8480",
"type": "m.room.message",
"sender": "@test:localhost:8480"
}
],
"events_before": [
{
"age": 91911903,
"content": {
"body": "5",
"msgtype": "m.text"
},
"event_id": "$14460306074UYTlh:localhost:8480",
"origin_server_ts": 1446030607984,
"room_id": "!sCDvXTtzjpiPxaqkkt:localhost:8480",
"type": "m.room.message",
"sender": "@test:localhost:8480"
}
],
"start": "t27-54_2_0_2",
"state": [
{
"age": 3123715284,
"content": {
"creator": "@test:localhost:8480"
},
"event_id": "$14429988040dgQAE:localhost:8480",
"origin_server_ts": 1442998804603,
"room_id": "!sCDvXTtzjpiPxaqkkt:localhost:8480",
"state_key": "",
"type": "m.room.create",
"sender": "@test:localhost:8480"
},
{
"age": 2067105053,
"content": {
"avatar_url": "mxc://localhost:8480/tVWZTAIIfqtXMZZtmGCkVjTD#auto",
"displayname": "Bob2",
"membership": "join"
},
"event_id": "$14440554144URDbf:localhost:8480",
"origin_server_ts": 1444055414834,
"replaces_state": "$14440552472PgiGk:localhost:8480",
"room_id": "!sCDvXTtzjpiPxaqkkt:localhost:8480",
"state_key": "@test:localhost:8480",
"type": "m.room.member",
"sender": "@test:localhost:8480"
}
]
} }
],
"event": {
"event_id": "$f3h4d129462ha:example.com",
"room_id": "!636q39766251:example.com",
"$ref": "definitions/event-schemas/examples/m.room.message#m.image"
},
"events_before": [
{
"room_id": "!636q39766251:example.com",
"$ref": "definitions/event-schemas/examples/m.room.message#m.file"
}
],
"start": "t27-54_2_0_2",
"state": [
{
"room_id": "!636q39766251:example.com",
"$ref": "definitions/event-schemas/examples/m.room.create"
},
{
"room_id": "!636q39766251:example.com",
"$ref": "definitions/event-schemas/examples/m.room.member"
}
]
}
tags: tags:
- Room participation - Room participation

@ -114,43 +114,16 @@ paths:
"end": "t47409-4357353_219380_26003_2265", "end": "t47409-4357353_219380_26003_2265",
"chunk": [ "chunk": [
{ {
"origin_server_ts": 1444812213737, "room_id": "!636q39766251:example.com",
"sender": "@alice:example.com", "$ref": "definitions/event-schemas/examples/m.room.message#m.text"
"event_id": "$1444812213350496Caaaa:example.com",
"content": {
"body": "hello world",
"msgtype":"m.text"
},
"room_id":"!Xq3620DUiqCaoxq:example.com",
"type":"m.room.message",
"age": 1042
}, },
{ {
"origin_server_ts": 1444812194656 , "room_id": "!636q39766251:example.com",
"sender": "@bob:example.com", "$ref": "definitions/event-schemas/examples/m.room.name"
"event_id": "$1444812213350496Cbbbb:example.com",
"content": {
"body": "the world is big",
"msgtype":"m.text"
},
"room_id":"!Xq3620DUiqCaoxq:example.com",
"type":"m.room.message",
"age": 20123
}, },
{ {
"origin_server_ts": 1444812163990, "room_id": "!636q39766251:example.com",
"sender": "@bob:example.com", "$ref": "definitions/event-schemas/examples/m.room.message#m.video"
"event_id": "$1444812213350496Ccccc:example.com",
"content": {
"name": "New room name"
},
"prev_content": {
"name": "Old room name"
},
"state_key": "",
"room_id":"!Xq3620DUiqCaoxq:example.com",
"type":"m.room.name",
"age": 50789
} }
] ]
} }

@ -75,16 +75,7 @@ paths:
"room_id": "!abcdefg:example.com", "room_id": "!abcdefg:example.com",
"ts": 1475508881945, "ts": 1475508881945,
"event": { "event": {
"sender": "@alice:example.com", "$ref": "definitions/event-schemas/examples/m.room.message#m.text"
"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"
} }
} }
] ]

@ -64,18 +64,7 @@ paths:
"start": "s3456_9_0", "start": "s3456_9_0",
"end": "s3457_9_0", "end": "s3457_9_0",
"chunk": [ "chunk": [
{ {"$ref": "definitions/event-schemas/examples/m.room.message#m.text"}
"age": 32,
"content": {
"body": "incoming message",
"msgtype": "m.text"
},
"event_id": "$14328055551tzaee:localhost",
"origin_server_ts": 1432804485886,
"room_id": "!TmaZBKYIFrIPVGoUYp:localhost",
"type": "m.room.message",
"sender": "@bob:localhost"
}
] ]
} }
schema: schema:
@ -142,16 +131,7 @@ paths:
application/json: { application/json: {
"end": "s3456_9_0", "end": "s3456_9_0",
"presence": [ "presence": [
{ {"$ref": "definitions/event-schemas/examples/m.presence"}
"content": {
"avatar_url": "mxc://localhost/GCmhgzMPRjqgpODLsNQzVuHZ#auto",
"displayname": "Bob",
"last_active_ago": 31053,
"presence": "online",
"user_id": "@bob:localhost"
},
"type": "m.presence"
}
], ],
"account_data": [ "account_data": [
{ {
@ -167,28 +147,12 @@ paths:
"messages": { "messages": {
"chunk": [ "chunk": [
{ {
"age": 343513403, "room_id": "!TmaZBKYIFrIPVGoUYp:localhost",
"content": { "$ref": "definitions/event-schemas/examples/m.room.message#m.text"
"body": "foo",
"msgtype": "m.text"
},
"event_id": "$14328044851tzTJS:localhost",
"origin_server_ts": 1432804485886,
"room_id": "!TmaZBKYIFrIPVGoUYp:localhost",
"type": "m.room.message",
"sender": "@alice:localhost"
}, },
{ {
"age": 343511809, "room_id": "!TmaZBKYIFrIPVGoUYp:localhost",
"content": { "$ref": "definitions/event-schemas/examples/m.room.message#m.video"
"body": "bar",
"msgtype": "m.text"
},
"event_id": "$14328044872spjFg:localhost",
"origin_server_ts": 1432804487480,
"room_id": "!TmaZBKYIFrIPVGoUYp:localhost",
"type": "m.room.message",
"sender": "@bob:localhost"
} }
], ],
"end": "s3456_9_0", "end": "s3456_9_0",
@ -197,81 +161,20 @@ paths:
"room_id": "!TmaZBKYIFrIPVGoUYp:localhost", "room_id": "!TmaZBKYIFrIPVGoUYp:localhost",
"state": [ "state": [
{ {
"age": 7148266897, "room_id": "!TmaZBKYIFrIPVGoUYp:localhost",
"content": { "$ref": "definitions/event-schemas/examples/m.room.join_rules"
"join_rule": "public"
},
"event_id": "$14259997323TLwtb:localhost",
"origin_server_ts": 1425999732392,
"room_id": "!TmaZBKYIFrIPVGoUYp:localhost",
"state_key": "",
"type": "m.room.join_rules",
"sender": "@alice:localhost"
},
{
"age": 6547561012,
"content": {
"avatar_url": "mxc://localhost/fzysBrHpPEeTGANCVLXWXNMI#auto",
"membership": "join"
},
"event_id": "$1426600438280zExKY:localhost",
"membership": "join",
"origin_server_ts": 1426600438277,
"room_id": "!TmaZBKYIFrIPVGoUYp:localhost",
"state_key": "@alice:localhost",
"type": "m.room.member",
"sender": "@alice:localhost"
}, },
{ {
"age": 7148267200, "room_id": "!TmaZBKYIFrIPVGoUYp:localhost",
"content": { "$ref": "definitions/event-schemas/examples/m.room.member"
"creator": "@alice:localhost"
},
"event_id": "$14259997320KhbwJ:localhost",
"origin_server_ts": 1425999732089,
"room_id": "!TmaZBKYIFrIPVGoUYp:localhost",
"state_key": "",
"type": "m.room.create",
"sender": "@alice:localhost"
}, },
{ {
"age": 1622568720, "room_id": "!TmaZBKYIFrIPVGoUYp:localhost",
"content": { "$ref": "definitions/event-schemas/examples/m.room.create"
"avatar_url": "mxc://localhost/GCmhgzMPRjqgpODLsNQzVuHZ#auto",
"displayname": "Bob",
"membership": "join"
},
"event_id": "$1431525430134MxlLX:localhost",
"origin_server_ts": 1431525430569,
"replaces_state": "$142652023736BSXcM:localhost",
"room_id": "!TmaZBKYIFrIPVGoUYp:localhost",
"state_key": "@bob:localhost",
"type": "m.room.member",
"sender": "@bob:localhost"
}, },
{ {
"age": 7148267004, "room_id": "!TmaZBKYIFrIPVGoUYp:localhost",
"content": { "$ref": "definitions/event-schemas/examples/m.room.power_levels"
"ban": 50,
"events": {
"m.room.name": 100,
"m.room.power_levels": 100
},
"events_default": 0,
"kick": 50,
"redact": 50,
"state_default": 50,
"users": {
"@alice:localhost": 100
},
"users_default": 0
},
"event_id": "$14259997322mqfaq:localhost",
"origin_server_ts": 1425999732285,
"room_id": "!TmaZBKYIFrIPVGoUYp:localhost",
"state_key": "",
"type": "m.room.power_levels",
"sender": "@alice:localhost"
} }
], ],
"visibility": "private", "visibility": "private",
@ -423,16 +326,7 @@ paths:
200: 200:
description: The full event. description: The full event.
examples: examples:
application/json: { application/json: {"$ref": "definitions/event-schemas/examples/m.room.message#m.text"}
"content": {
"body": "Hello world!",
"msgtype": "m.text"
},
"room_id": "!wfgy43Sg4a:matrix.org",
"sender": "@bob:matrix.org",
"event_id": "$asfDuShaf7Gafaw:matrix.org",
"type": "m.room.message"
}
schema: schema:
allOf: allOf:
- "$ref": "definitions/event-schemas/schema/core-event-schema/event.yaml" - "$ref": "definitions/event-schemas/schema/core-event-schema/event.yaml"

@ -75,16 +75,8 @@ paths:
"end": "s3457_9_0", "end": "s3457_9_0",
"chunk": [ "chunk": [
{ {
"age": 32, "room_id": "!somewhere:over.the.rainbow",
"content": { "$ref": "definitions/event-schemas/examples/m.room.message#m.text"
"body": "incoming message",
"msgtype": "m.text"
},
"event_id": "$14328055551tzaee:localhost",
"origin_server_ts": 1432804485886,
"room_id": "!TmaZBKYIFrIPVGoUYp:localhost",
"type": "m.room.message",
"sender": "@bob:localhost"
} }
] ]
} }

@ -43,28 +43,12 @@ paths:
"messages": { "messages": {
"chunk": [ "chunk": [
{ {
"age": 343513403,
"content": {
"body": "foo",
"msgtype": "m.text"
},
"event_id": "$14328044851tzTJS:example.com",
"origin_server_ts": 1432804485886,
"room_id": "!636q39766251:example.com", "room_id": "!636q39766251:example.com",
"type": "m.room.message", "$ref": "definitions/event-schemas/examples/m.room.message#m.text"
"sender": "@alice:example.com"
}, },
{ {
"age": 343511809,
"content": {
"body": "bar",
"msgtype": "m.text"
},
"event_id": "$14328044872spjFg:example.com",
"origin_server_ts": 1432804487480,
"room_id": "!636q39766251:example.com", "room_id": "!636q39766251:example.com",
"type": "m.room.message", "$ref": "definitions/event-schemas/examples/m.room.message#m.file"
"sender": "@bob:example.com"
} }
], ],
"end": "s3456_9_0", "end": "s3456_9_0",
@ -73,81 +57,20 @@ paths:
"room_id": "!636q39766251:example.com", "room_id": "!636q39766251:example.com",
"state": [ "state": [
{ {
"age": 7148266897,
"content": {
"join_rule": "public"
},
"event_id": "$14259997323TLwtb:example.com",
"origin_server_ts": 1425999732392,
"room_id": "!636q39766251:example.com",
"state_key": "",
"type": "m.room.join_rules",
"sender": "@alice:example.com"
},
{
"age": 6547561012,
"content": {
"avatar_url": "mxc://example.com/fzysBrHpPEeTGANCVLXWXNMI#auto",
"membership": "join"
},
"event_id": "$1426600438280zExKY:example.com",
"membership": "join",
"origin_server_ts": 1426600438277,
"room_id": "!636q39766251:example.com", "room_id": "!636q39766251:example.com",
"state_key": "@alice:example.com", "$ref": "definitions/event-schemas/examples/m.room.join_rules"
"type": "m.room.member",
"sender": "@alice:example.com"
}, },
{ {
"age": 7148267200,
"content": {
"creator": "@alice:example.com"
},
"event_id": "$14259997320KhbwJ:example.com",
"origin_server_ts": 1425999732089,
"room_id": "!636q39766251:example.com", "room_id": "!636q39766251:example.com",
"state_key": "", "$ref": "definitions/event-schemas/examples/m.room.member"
"type": "m.room.create",
"sender": "@alice:example.com"
}, },
{ {
"age": 1622568720,
"content": {
"avatar_url": "mxc://example.com/GCmhgzMPRjqgpODLsNQzVuHZ#auto",
"displayname": "Bob",
"membership": "join"
},
"event_id": "$1431525430134MxlLX:example.com",
"origin_server_ts": 1431525430569,
"replaces_state": "$142652023736BSXcM:example.com",
"room_id": "!636q39766251:example.com", "room_id": "!636q39766251:example.com",
"state_key": "@bob:example.com", "$ref": "definitions/event-schemas/examples/m.room.create"
"type": "m.room.member",
"sender": "@bob:example.com"
}, },
{ {
"age": 7148267004,
"content": {
"ban": 50,
"events": {
"m.room.name": 100,
"m.room.power_levels": 100
},
"events_default": 0,
"kick": 50,
"redact": 50,
"state_default": 50,
"users": {
"@alice:example.com": 100
},
"users_default": 0
},
"event_id": "$14259997322mqfaq:example.com",
"origin_server_ts": 1425999732285,
"room_id": "!636q39766251:example.com", "room_id": "!636q39766251:example.com",
"state_key": "", "$ref": "definitions/event-schemas/examples/m.room.power_levels"
"type": "m.room.power_levels",
"sender": "@alice:example.com"
} }
], ],
"visibility": "private", "visibility": "private",

@ -42,7 +42,7 @@ paths:
name: roomId name: roomId
description: The ID of the room the event is in. description: The ID of the room the event is in.
required: true required: true
x-example: "!asfDuShaf7Gafaw:matrix.org" x-example: "!636q39766251:matrix.org"
- in: path - in: path
type: string type: string
name: eventId name: eventId
@ -54,15 +54,9 @@ paths:
description: The full event. description: The full event.
examples: examples:
application/json: { application/json: {
"content": { "room_id": "!636q39766251:matrix.org",
"body": "Hello world!", "$ref": "definitions/event-schemas/examples/m.room.message#m.text"
"msgtype": "m.text" }
},
"room_id": "!wfgy43Sg4a:matrix.org",
"sender": "@bob:matrix.org",
"event_id": "$asfDuShaf7Gafaw:matrix.org",
"type": "m.room.message"
}
schema: schema:
allOf: allOf:
- "$ref": "definitions/event-schemas/schema/core-event-schema/event.yaml" - "$ref": "definitions/event-schemas/schema/core-event-schema/event.yaml"
@ -178,84 +172,23 @@ paths:
description: The current state of the room description: The current state of the room
examples: examples:
application/json: [ application/json: [
{ {
"age": 7148266897, "room_id": "!636q39766251:example.com",
"content": { "$ref": "definitions/event-schemas/examples/m.room.join_rules"
"join_rule": "public" },
}, {
"event_id": "$14259997323TLwtb:example.com", "room_id": "!636q39766251:example.com",
"origin_server_ts": 1425999732392, "$ref": "definitions/event-schemas/examples/m.room.member"
"room_id": "!636q39766251:example.com", },
"state_key": "", {
"type": "m.room.join_rules", "room_id": "!636q39766251:example.com",
"sender": "@alice:example.com" "$ref": "definitions/event-schemas/examples/m.room.create"
}, },
{ {
"age": 6547561012, "room_id": "!636q39766251:example.com",
"content": { "$ref": "definitions/event-schemas/examples/m.room.power_levels"
"avatar_url": "mxc://example.com/fzysBrHpPEeTGANCVLXWXNMI#auto", }
"membership": "join" ]
},
"event_id": "$1426600438280zExKY:example.com",
"membership": "join",
"origin_server_ts": 1426600438277,
"room_id": "!636q39766251:example.com",
"state_key": "@alice:example.com",
"type": "m.room.member",
"sender": "@alice:example.com"
},
{
"age": 7148267200,
"content": {
"creator": "@alice:example.com"
},
"event_id": "$14259997320KhbwJ:example.com",
"origin_server_ts": 1425999732089,
"room_id": "!636q39766251:example.com",
"state_key": "",
"type": "m.room.create",
"sender": "@alice:example.com"
},
{
"age": 1622568720,
"content": {
"avatar_url": "mxc://example.com/GCmhgzMPRjqgpODLsNQzVuHZ#auto",
"displayname": "Bob",
"membership": "join"
},
"event_id": "$1431525430134MxlLX:example.com",
"origin_server_ts": 1431525430569,
"replaces_state": "$142652023736BSXcM:example.com",
"room_id": "!636q39766251:example.com",
"state_key": "@bob:example.com",
"type": "m.room.member",
"sender": "@bob:example.com"
},
{
"age": 7148267004,
"content": {
"ban": 50,
"events": {
"m.room.name": 100,
"m.room.power_levels": 100
},
"events_default": 0,
"kick": 50,
"redact": 50,
"state_default": 50,
"users": {
"@alice:example.com": 100
},
"users_default": 0
},
"event_id": "$14259997322mqfaq:example.com",
"origin_server_ts": 1425999732285,
"room_id": "!636q39766251:example.com",
"state_key": "",
"type": "m.room.power_levels",
"sender": "@alice:example.com"
}
]
schema: schema:
type: array type: array
title: RoomState title: RoomState
@ -300,33 +233,8 @@ paths:
application/json: { application/json: {
"chunk": [ "chunk": [
{ {
"age": 6547561012,
"content": {
"avatar_url": "mxc://example.com/fzysBrHpPEeTGANCVLXWXNMI#auto",
"membership": "join"
},
"event_id": "$1426600438280zExKY:example.com",
"membership": "join",
"origin_server_ts": 1426600438277,
"room_id": "!636q39766251:example.com",
"state_key": "@alice:example.com",
"type": "m.room.member",
"sender": "@alice:example.com"
},
{
"age": 1622568720,
"content": {
"avatar_url": "mxc://example.com/GCmhgzMPRjqgpODLsNQzVuHZ#auto",
"displayname": "Bob",
"membership": "join"
},
"event_id": "$1431525430134MxlLX:example.com",
"origin_server_ts": 1431525430569,
"replaces_state": "$142652023736BSXcM:example.com",
"room_id": "!636q39766251:example.com", "room_id": "!636q39766251:example.com",
"state_key": "@bob:example.com", "$ref": "definitions/event-schemas/examples/m.room.member"
"type": "m.room.member",
"sender": "@bob:example.com"
} }
] ]
} }

@ -280,7 +280,7 @@ paths:
Any groups that were requested. Any groups that were requested.
The outer ``string`` key is the group key requested (eg: ``room_id`` The outer ``string`` key is the group key requested (eg: ``room_id``
or ``sender``). The inner ``string`` key is the grouped value (eg: or ``sender``). The inner ``string`` key is the grouped value (eg:
a room's ID or a user's ID). a room's ID or a user's ID).
additionalProperties: additionalProperties:
type: object type: object
@ -347,16 +347,9 @@ paths:
{ {
"rank": 0.00424866, "rank": 0.00424866,
"result": { "result": {
"age": 526228296,
"content": {
"body": "Test content martians and men",
"msgtype": "m.text"
},
"event_id": "$144429830826TWwbB:localhost",
"origin_server_ts": 1444298308034,
"room_id": "!qPewotXpIctQySfjSy:localhost", "room_id": "!qPewotXpIctQySfjSy:localhost",
"type": "m.room.message", "event_id": "$144429830826TWwbB:localhost",
"sender": "@test:localhost" "$ref": "definitions/event-schemas/examples/m.room.message#m.text"
} }
} }
] ]

@ -310,11 +310,7 @@ paths:
"next_batch": "s72595_4483_1934", "next_batch": "s72595_4483_1934",
"presence": { "presence": {
"events": [ "events": [
{ {"$ref": "definitions/event-schemas/examples/m.presence"}
"sender": "@alice:example.com",
"type": "m.presence",
"content": {"presence": "online"}
}
] ]
}, },
"account_data": { "account_data": {
@ -333,36 +329,20 @@ paths:
"state": { "state": {
"events": [ "events": [
{ {
"sender": "@alice:example.com", "room_id": "!726s6s6q:example.com",
"type": "m.room.member", "$ref": "definitions/event-schemas/examples/m.room.member"
"state_key": "@alice:example.com",
"content": {"membership": "join"},
"origin_server_ts": 1417731086795,
"event_id": "$66697273743031:example.com"
} }
] ]
}, },
"timeline": { "timeline": {
"events": [ "events": [
{ {
"sender": "@bob:example.com", "room_id": "!726s6s6q:example.com",
"type": "m.room.member", "$ref": "definitions/event-schemas/examples/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", "room_id": "!726s6s6q:example.com",
"type": "m.room.message", "$ref": "definitions/event-schemas/examples/m.room.message#m.text"
"txn_id": "1234",
"content": {
"body": "I am a fish",
"msgtype": "m.text"
},
"origin_server_ts": 1417731086797,
"event_id": "$74686972643033:example.com"
} }
], ],
"limited": true, "limited": true,
@ -370,18 +350,12 @@ paths:
}, },
"ephemeral": { "ephemeral": {
"events": [ "events": [
{ {"$ref": "definitions/event-schemas/examples/m.typing"}
"type": "m.typing",
"content": {"user_ids": ["@alice:example.com"]}
}
] ]
}, },
"account_data": { "account_data": {
"events": [ "events": [
{ {"$ref": "definitions/event-schemas/examples/m.tag"},
"type": "m.tag",
"content": {"tags": {"work": {"order": 1}}}
},
{ {
"type": "org.example.custom.room.config", "type": "org.example.custom.room.config",
"content": { "content": {

@ -0,0 +1 @@
Use consistent examples of events throughout the specification.
Loading…
Cancel
Save