Merge pull request #2051 from matrix-org/travis/1.0/fix-examples
Use consistent event examples throughout the Client-Server API
This commit is contained in:
commit
ad07d8e6ff
38 changed files with 107 additions and 488 deletions
|
@ -56,7 +56,7 @@ paths:
|
|||
example: {
|
||||
"events": [
|
||||
{"$ref": "../../event-schemas/examples/m.room.member"},
|
||||
{"$ref": "../../event-schemas/examples/m.room.message#m.text"}
|
||||
{"$ref": "../../event-schemas/examples/m.room.message$m.text"}
|
||||
]
|
||||
}
|
||||
description: Transaction information
|
||||
|
|
|
@ -101,65 +101,35 @@ paths:
|
|||
- "$ref": "definitions/event-schemas/schema/core-event-schema/state_event.yaml"
|
||||
examples:
|
||||
application/json: {
|
||||
"end": "t29-57_2_0_2",
|
||||
"events_after": [
|
||||
{
|
||||
"age": 91911336,
|
||||
"content": {
|
||||
"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"
|
||||
}
|
||||
]
|
||||
"end": "t29-57_2_0_2",
|
||||
"events_after": [
|
||||
{
|
||||
"room_id": "!636q39766251:example.com",
|
||||
"$ref": "definitions/event-schemas/examples/m.room.message$m.text"
|
||||
}
|
||||
],
|
||||
"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:
|
||||
- Room participation
|
||||
|
|
|
@ -114,43 +114,16 @@ paths:
|
|||
"end": "t47409-4357353_219380_26003_2265",
|
||||
"chunk": [
|
||||
{
|
||||
"origin_server_ts": 1444812213737,
|
||||
"sender": "@alice:example.com",
|
||||
"event_id": "$1444812213350496Caaaa:example.com",
|
||||
"content": {
|
||||
"body": "hello world",
|
||||
"msgtype":"m.text"
|
||||
},
|
||||
"room_id":"!Xq3620DUiqCaoxq:example.com",
|
||||
"type":"m.room.message",
|
||||
"age": 1042
|
||||
"room_id": "!636q39766251:example.com",
|
||||
"$ref": "definitions/event-schemas/examples/m.room.message$m.text"
|
||||
},
|
||||
{
|
||||
"origin_server_ts": 1444812194656 ,
|
||||
"sender": "@bob:example.com",
|
||||
"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
|
||||
"room_id": "!636q39766251:example.com",
|
||||
"$ref": "definitions/event-schemas/examples/m.room.name"
|
||||
},
|
||||
{
|
||||
"origin_server_ts": 1444812163990,
|
||||
"sender": "@bob:example.com",
|
||||
"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
|
||||
"room_id": "!636q39766251:example.com",
|
||||
"$ref": "definitions/event-schemas/examples/m.room.message$m.video"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -75,16 +75,7 @@ paths:
|
|||
"room_id": "!abcdefg:example.com",
|
||||
"ts": 1475508881945,
|
||||
"event": {
|
||||
"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"
|
||||
"$ref": "definitions/event-schemas/examples/m.room.message$m.text"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
|
@ -64,18 +64,7 @@ paths:
|
|||
"start": "s3456_9_0",
|
||||
"end": "s3457_9_0",
|
||||
"chunk": [
|
||||
{
|
||||
"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"
|
||||
}
|
||||
{"$ref": "definitions/event-schemas/examples/m.room.message$m.text"}
|
||||
]
|
||||
}
|
||||
schema:
|
||||
|
@ -142,16 +131,7 @@ paths:
|
|||
application/json: {
|
||||
"end": "s3456_9_0",
|
||||
"presence": [
|
||||
{
|
||||
"content": {
|
||||
"avatar_url": "mxc://localhost/GCmhgzMPRjqgpODLsNQzVuHZ#auto",
|
||||
"displayname": "Bob",
|
||||
"last_active_ago": 31053,
|
||||
"presence": "online",
|
||||
"user_id": "@bob:localhost"
|
||||
},
|
||||
"type": "m.presence"
|
||||
}
|
||||
{"$ref": "definitions/event-schemas/examples/m.presence"}
|
||||
],
|
||||
"account_data": [
|
||||
{
|
||||
|
@ -167,28 +147,12 @@ paths:
|
|||
"messages": {
|
||||
"chunk": [
|
||||
{
|
||||
"age": 343513403,
|
||||
"content": {
|
||||
"body": "foo",
|
||||
"msgtype": "m.text"
|
||||
},
|
||||
"event_id": "$14328044851tzTJS:localhost",
|
||||
"origin_server_ts": 1432804485886,
|
||||
"room_id": "!TmaZBKYIFrIPVGoUYp:localhost",
|
||||
"type": "m.room.message",
|
||||
"sender": "@alice:localhost"
|
||||
"room_id": "!TmaZBKYIFrIPVGoUYp:localhost",
|
||||
"$ref": "definitions/event-schemas/examples/m.room.message$m.text"
|
||||
},
|
||||
{
|
||||
"age": 343511809,
|
||||
"content": {
|
||||
"body": "bar",
|
||||
"msgtype": "m.text"
|
||||
},
|
||||
"event_id": "$14328044872spjFg:localhost",
|
||||
"origin_server_ts": 1432804487480,
|
||||
"room_id": "!TmaZBKYIFrIPVGoUYp:localhost",
|
||||
"type": "m.room.message",
|
||||
"sender": "@bob:localhost"
|
||||
"room_id": "!TmaZBKYIFrIPVGoUYp:localhost",
|
||||
"$ref": "definitions/event-schemas/examples/m.room.message$m.video"
|
||||
}
|
||||
],
|
||||
"end": "s3456_9_0",
|
||||
|
@ -197,81 +161,20 @@ paths:
|
|||
"room_id": "!TmaZBKYIFrIPVGoUYp:localhost",
|
||||
"state": [
|
||||
{
|
||||
"age": 7148266897,
|
||||
"content": {
|
||||
"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"
|
||||
"room_id": "!TmaZBKYIFrIPVGoUYp:localhost",
|
||||
"$ref": "definitions/event-schemas/examples/m.room.join_rules"
|
||||
},
|
||||
{
|
||||
"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"
|
||||
"room_id": "!TmaZBKYIFrIPVGoUYp:localhost",
|
||||
"$ref": "definitions/event-schemas/examples/m.room.member"
|
||||
},
|
||||
{
|
||||
"age": 7148267200,
|
||||
"content": {
|
||||
"creator": "@alice:localhost"
|
||||
},
|
||||
"event_id": "$14259997320KhbwJ:localhost",
|
||||
"origin_server_ts": 1425999732089,
|
||||
"room_id": "!TmaZBKYIFrIPVGoUYp:localhost",
|
||||
"state_key": "",
|
||||
"type": "m.room.create",
|
||||
"sender": "@alice:localhost"
|
||||
"room_id": "!TmaZBKYIFrIPVGoUYp:localhost",
|
||||
"$ref": "definitions/event-schemas/examples/m.room.create"
|
||||
},
|
||||
{
|
||||
"age": 1622568720,
|
||||
"content": {
|
||||
"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,
|
||||
"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: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"
|
||||
"room_id": "!TmaZBKYIFrIPVGoUYp:localhost",
|
||||
"$ref": "definitions/event-schemas/examples/m.room.power_levels"
|
||||
}
|
||||
],
|
||||
"visibility": "private",
|
||||
|
@ -423,16 +326,7 @@ paths:
|
|||
200:
|
||||
description: The full event.
|
||||
examples:
|
||||
application/json: {
|
||||
"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"
|
||||
}
|
||||
application/json: {"$ref": "definitions/event-schemas/examples/m.room.message$m.text"}
|
||||
schema:
|
||||
allOf:
|
||||
- "$ref": "definitions/event-schemas/schema/core-event-schema/event.yaml"
|
||||
|
|
|
@ -75,16 +75,8 @@ paths:
|
|||
"end": "s3457_9_0",
|
||||
"chunk": [
|
||||
{
|
||||
"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"
|
||||
"room_id": "!somewhere:over.the.rainbow",
|
||||
"$ref": "definitions/event-schemas/examples/m.room.message$m.text"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -43,28 +43,12 @@ paths:
|
|||
"messages": {
|
||||
"chunk": [
|
||||
{
|
||||
"age": 343513403,
|
||||
"content": {
|
||||
"body": "foo",
|
||||
"msgtype": "m.text"
|
||||
},
|
||||
"event_id": "$14328044851tzTJS:example.com",
|
||||
"origin_server_ts": 1432804485886,
|
||||
"room_id": "!636q39766251:example.com",
|
||||
"type": "m.room.message",
|
||||
"sender": "@alice:example.com"
|
||||
"$ref": "definitions/event-schemas/examples/m.room.message$m.text"
|
||||
},
|
||||
{
|
||||
"age": 343511809,
|
||||
"content": {
|
||||
"body": "bar",
|
||||
"msgtype": "m.text"
|
||||
},
|
||||
"event_id": "$14328044872spjFg:example.com",
|
||||
"origin_server_ts": 1432804487480,
|
||||
"room_id": "!636q39766251:example.com",
|
||||
"type": "m.room.message",
|
||||
"sender": "@bob:example.com"
|
||||
"$ref": "definitions/event-schemas/examples/m.room.message$m.file"
|
||||
}
|
||||
],
|
||||
"end": "s3456_9_0",
|
||||
|
@ -73,81 +57,20 @@ paths:
|
|||
"room_id": "!636q39766251:example.com",
|
||||
"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"
|
||||
"$ref": "definitions/event-schemas/examples/m.room.join_rules"
|
||||
},
|
||||
{
|
||||
"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"
|
||||
"$ref": "definitions/event-schemas/examples/m.room.member"
|
||||
},
|
||||
{
|
||||
"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"
|
||||
"$ref": "definitions/event-schemas/examples/m.room.create"
|
||||
},
|
||||
{
|
||||
"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"
|
||||
"$ref": "definitions/event-schemas/examples/m.room.power_levels"
|
||||
}
|
||||
],
|
||||
"visibility": "private",
|
||||
|
|
|
@ -42,7 +42,7 @@ paths:
|
|||
name: roomId
|
||||
description: The ID of the room the event is in.
|
||||
required: true
|
||||
x-example: "!asfDuShaf7Gafaw:matrix.org"
|
||||
x-example: "!636q39766251:matrix.org"
|
||||
- in: path
|
||||
type: string
|
||||
name: eventId
|
||||
|
@ -54,15 +54,9 @@ paths:
|
|||
description: The full event.
|
||||
examples:
|
||||
application/json: {
|
||||
"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"
|
||||
}
|
||||
"room_id": "!636q39766251:matrix.org",
|
||||
"$ref": "definitions/event-schemas/examples/m.room.message$m.text"
|
||||
}
|
||||
schema:
|
||||
allOf:
|
||||
- "$ref": "definitions/event-schemas/schema/core-event-schema/event.yaml"
|
||||
|
@ -178,84 +172,23 @@ paths:
|
|||
description: The current state of the room
|
||||
examples:
|
||||
application/json: [
|
||||
{
|
||||
"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",
|
||||
"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"
|
||||
}
|
||||
]
|
||||
{
|
||||
"room_id": "!636q39766251:example.com",
|
||||
"$ref": "definitions/event-schemas/examples/m.room.join_rules"
|
||||
},
|
||||
{
|
||||
"room_id": "!636q39766251:example.com",
|
||||
"$ref": "definitions/event-schemas/examples/m.room.member"
|
||||
},
|
||||
{
|
||||
"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.power_levels"
|
||||
}
|
||||
]
|
||||
schema:
|
||||
type: array
|
||||
title: RoomState
|
||||
|
@ -300,33 +233,8 @@ paths:
|
|||
application/json: {
|
||||
"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",
|
||||
"state_key": "@bob:example.com",
|
||||
"type": "m.room.member",
|
||||
"sender": "@bob:example.com"
|
||||
"$ref": "definitions/event-schemas/examples/m.room.member"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -347,16 +347,9 @@ paths:
|
|||
{
|
||||
"rank": 0.00424866,
|
||||
"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",
|
||||
"type": "m.room.message",
|
||||
"sender": "@test:localhost"
|
||||
"event_id": "$144429830826TWwbB:localhost",
|
||||
"$ref": "definitions/event-schemas/examples/m.room.message$m.text"
|
||||
}
|
||||
}
|
||||
]
|
||||
|
|
|
@ -310,11 +310,7 @@ paths:
|
|||
"next_batch": "s72595_4483_1934",
|
||||
"presence": {
|
||||
"events": [
|
||||
{
|
||||
"sender": "@alice:example.com",
|
||||
"type": "m.presence",
|
||||
"content": {"presence": "online"}
|
||||
}
|
||||
{"$ref": "definitions/event-schemas/examples/m.presence"}
|
||||
]
|
||||
},
|
||||
"account_data": {
|
||||
|
@ -333,36 +329,20 @@ paths:
|
|||
"state": {
|
||||
"events": [
|
||||
{
|
||||
"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"
|
||||
"room_id": "!726s6s6q:example.com",
|
||||
"$ref": "definitions/event-schemas/examples/m.room.member"
|
||||
}
|
||||
]
|
||||
},
|
||||
"timeline": {
|
||||
"events": [
|
||||
{
|
||||
"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"
|
||||
"room_id": "!726s6s6q:example.com",
|
||||
"$ref": "definitions/event-schemas/examples/m.room.member"
|
||||
},
|
||||
{
|
||||
"sender": "@alice:example.com",
|
||||
"type": "m.room.message",
|
||||
"txn_id": "1234",
|
||||
"content": {
|
||||
"body": "I am a fish",
|
||||
"msgtype": "m.text"
|
||||
},
|
||||
"origin_server_ts": 1417731086797,
|
||||
"event_id": "$74686972643033:example.com"
|
||||
"room_id": "!726s6s6q:example.com",
|
||||
"$ref": "definitions/event-schemas/examples/m.room.message$m.text"
|
||||
}
|
||||
],
|
||||
"limited": true,
|
||||
|
@ -370,18 +350,12 @@ paths:
|
|||
},
|
||||
"ephemeral": {
|
||||
"events": [
|
||||
{
|
||||
"type": "m.typing",
|
||||
"content": {"user_ids": ["@alice:example.com"]}
|
||||
}
|
||||
{"$ref": "definitions/event-schemas/examples/m.typing"}
|
||||
]
|
||||
},
|
||||
"account_data": {
|
||||
"events": [
|
||||
{
|
||||
"type": "m.tag",
|
||||
"content": {"tags": {"work": {"order": 1}}}
|
||||
},
|
||||
{"$ref": "definitions/event-schemas/examples/m.tag"},
|
||||
{
|
||||
"type": "org.example.custom.room.config",
|
||||
"content": {
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
Use consistent examples of events throughout the specification.
|
|
@ -112,8 +112,8 @@ def check_example_dir(exampledir, schemadir):
|
|||
continue
|
||||
examplepath = os.path.join(root, filename)
|
||||
schemapath = examplepath.replace(exampledir, schemadir)
|
||||
if schemapath.find("#") >= 0:
|
||||
schemapath = schemapath[:schemapath.find("#")]
|
||||
if schemapath.find("$") >= 0:
|
||||
schemapath = schemapath[:schemapath.find("$")]
|
||||
try:
|
||||
check_example_file(examplepath, schemapath)
|
||||
except Exception as e:
|
||||
|
|
|
@ -115,7 +115,7 @@ class MatrixSections(Sections):
|
|||
schemas = self.units.get("event_schemas")
|
||||
renders = {}
|
||||
for event_type in schemas:
|
||||
underscored_event_type = event_type.replace(".", "_").replace("#", "_")
|
||||
underscored_event_type = event_type.replace(".", "_").replace("$", "_")
|
||||
renders[underscored_event_type + "_event"] = self._render_events(
|
||||
lambda x: x == event_type, sorted
|
||||
)
|
||||
|
@ -125,7 +125,7 @@ class MatrixSections(Sections):
|
|||
def filterFn(eventType):
|
||||
return (
|
||||
eventType.startswith("m.room") and
|
||||
not eventType.startswith("m.room.message#m.")
|
||||
not eventType.startswith("m.room.message$m.")
|
||||
)
|
||||
return self._render_events(filterFn, sorted)
|
||||
|
||||
|
@ -138,22 +138,22 @@ class MatrixSections(Sections):
|
|||
]["subtitle"]
|
||||
sections = []
|
||||
msgtype_order = [
|
||||
"m.room.message#m.text", "m.room.message#m.emote",
|
||||
"m.room.message#m.notice", "m.room.message#m.image",
|
||||
"m.room.message#m.file"
|
||||
"m.room.message$m.text", "m.room.message$m.emote",
|
||||
"m.room.message$m.notice", "m.room.message$m.image",
|
||||
"m.room.message$m.file"
|
||||
]
|
||||
excluded_types = [
|
||||
# We exclude server notices from here because we handle them in a
|
||||
# dedicated module. We do not want to confuse developers this early
|
||||
# in the spec.
|
||||
"m.room.message#m.server_notice",
|
||||
"m.room.message$m.server_notice",
|
||||
]
|
||||
other_msgtypes = [
|
||||
k for k in schemas.keys() if k.startswith("m.room.message#") and
|
||||
k for k in schemas.keys() if k.startswith("m.room.message$") and
|
||||
k not in msgtype_order and k not in excluded_types
|
||||
]
|
||||
for event_name in (msgtype_order + other_msgtypes):
|
||||
if not event_name.startswith("m.room.message#m."):
|
||||
if not event_name.startswith("m.room.message$m."):
|
||||
continue
|
||||
sections.append(template.render(
|
||||
example=examples[event_name][0],
|
||||
|
|
|
@ -795,7 +795,7 @@ class MatrixUnits(Units):
|
|||
if not filename.startswith("m."):
|
||||
continue
|
||||
|
||||
event_name = filename.split("#")[0]
|
||||
event_name = filename.split("$")[0]
|
||||
filepath = os.path.join(path, filename)
|
||||
logger.info("Reading event example: %s" % filepath)
|
||||
try:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue