Merge pull request #1691 from matrix-org/rav/fix_make_join_doc

make_join and make_leave return their events under an `event` key
This commit is contained in:
Richard van der Hoff 2018-10-03 15:22:29 +01:00 committed by GitHub
commit 15eb69cc47
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 173 additions and 160 deletions

View file

@ -61,95 +61,101 @@ paths:
responses: responses:
200: 200:
description: |- description: |-
An unsigned event that the server may now use as a template A template to be used for the rest of the `Joining Rooms`_ handshake.
for the rest of the `Joining Rooms`_ handshake.
schema: schema:
allOf: type: object
- $ref: "definitions/unsigned_pdu.yaml" properties:
- type: object event:
properties: allOf:
# Note: we override a bunch of parameters to change their descriptions - $ref: "definitions/unsigned_pdu.yaml"
sender: - description: |-
type: string An unsigned template event.
description: The user ID of the joining member.
example: "@someone:example.org"
origin:
type: string
description: The name of the resident homeserver.
example: "matrix.org"
origin_server_ts:
type: integer
format: int64
description: A timestamp added by the resident homeserver.
example: 1234567890
type:
type: string
description: The value ``m.room.member``.
example: "m.room.member"
state_key:
type: string
description: The user ID of the joining member.
example: "@someone:example.org"
content:
type: object type: object
title: Membership Event Content
description: The content of the event.
example: {"membership": "join"}
properties: properties:
membership: # Note: we override a bunch of parameters to change their descriptions
sender:
type: string type: string
description: The value ``join``. description: The user ID of the joining member.
example: "join" example: "@someone:example.org"
required: ['membership'] origin:
depth: type: string
type: integer description: The name of the resident homeserver.
description: This field must be present but is ignored; it may be 0. example: "matrix.org"
example: 12 origin_server_ts:
auth_events: type: integer
type: array format: int64
description: |- description: A timestamp added by the resident homeserver.
An event reference list containing the authorization events that would example: 1234567890
allow the member to join the room. This should normally be the type:
``m.room.create``, ``m.room.power_levels``, and ``m.room.join_rules`` type: string
events. description: The value ``m.room.member``.
items: example: "m.room.member"
type: array state_key:
maxItems: 2 type: string
minItems: 2 description: The user ID of the joining member.
items: example: "@someone:example.org"
- type: string content:
title: Event ID type: object
example: "$abc123:matrix.org" title: Membership Event Content
- type: object description: The content of the event.
title: Event Hash example: {"membership": "join"}
example: { properties:
"sha256": "abase64encodedsha256hashshouldbe43byteslong" membership:
} type: string
properties: description: The value ``join``.
sha256: example: "join"
type: string required: ['membership']
description: The event hash. depth:
example: abase64encodedsha256hashshouldbe43byteslong type: integer
required: ['sha256'] description: This field must be present but is ignored; it may be 0.
redacts: example: 12
type: string auth_events:
description: Not used. type: array
required: description: |-
# Every other field is already flagged as required by the $ref An event reference list containing the authorization events that would
- state_key allow the member to join the room. This should normally be the
``m.room.create``, ``m.room.power_levels``, and ``m.room.join_rules``
events.
items:
type: array
maxItems: 2
minItems: 2
items:
- type: string
title: Event ID
example: "$abc123:matrix.org"
- type: object
title: Event Hash
example: {
"sha256": "abase64encodedsha256hashshouldbe43byteslong"
}
properties:
sha256:
type: string
description: The event hash.
example: abase64encodedsha256hashshouldbe43byteslong
required: ['sha256']
redacts:
type: string
description: Not used.
required:
# Every other field is already flagged as required by the $ref
- state_key
examples: examples:
application/json: { application/json: {
"$ref": "examples/unsigned_pdu.json", event: {
"type": "m.room.member", "$ref": "examples/unsigned_pdu.json",
"state_key": "@someone:example.org", "type": "m.room.member",
"content": { "state_key": "@someone:example.org",
"content": {
"membership": "join" "membership": "join"
}, },
"auth_events": [ "auth_events": [
["$room_cre4te_3vent:matrix.org", {"sha256": "abase64encodedsha256hashshouldbe43byteslong"}], ["$room_cre4te_3vent:matrix.org", {"sha256": "abase64encodedsha256hashshouldbe43byteslong"}],
["$room_j0in_rul3s_3vent:matrix.org", {"sha256": "abase64encodedsha256hashshouldbe43byteslong"}], ["$room_j0in_rul3s_3vent:matrix.org", {"sha256": "abase64encodedsha256hashshouldbe43byteslong"}],
["$room_p0wer_l3vels_3vent:matrix.org", {"sha256": "abase64encodedsha256hashshouldbe43byteslong"}] ["$room_p0wer_l3vels_3vent:matrix.org", {"sha256": "abase64encodedsha256hashshouldbe43byteslong"}]
] ]
}
} }
400: 400:
description: |- description: |-

View file

@ -52,91 +52,98 @@ paths:
responses: responses:
200: 200:
description: |- description: |-
An unsigned event that the sending server may use as a template A template to be used to call ``/send_leave``.
for when it calls ``/send_leave``.
schema: schema:
allOf: schema:
- $ref: "definitions/unsigned_pdu.yaml" type: object
- type: object properties:
properties: event:
# Note: we override a bunch of parameters to change their descriptions allOf:
sender: - $ref: "definitions/unsigned_pdu.yaml"
type: string - description: |-
description: The user ID of the leaving member. An unsigned template event.
example: "@someone:example.org"
origin:
type: string
description: The name of the resident homeserver.
example: "matrix.org"
origin_server_ts:
type: integer
format: int64
description: A timestamp added by the resident homeserver.
example: 1234567890
type:
type: string
description: The value ``m.room.member``.
example: "m.room.member"
state_key:
type: string
description: The user ID of the leaving member.
example: "@someone:example.org"
content:
type: object type: object
title: Membership Event Content
description: The content of the event.
example: {"membership": "leave"}
properties: properties:
membership: # Note: we override a bunch of parameters to change their descriptions
sender:
type: string type: string
description: The value ``leave``. description: The user ID of the leaving member.
example: "leave" example: "@someone:example.org"
required: ['membership'] origin:
auth_events: type: string
type: array description: The name of the resident homeserver.
description: |- example: "matrix.org"
An event reference list containing the authorization events that would origin_server_ts:
allow the member to leave the room. This should normally be the type: integer
``m.room.create``, ``m.room.power_levels``, and ``m.room.join_rules`` format: int64
events. description: A timestamp added by the resident homeserver.
items: example: 1234567890
type: array type:
maxItems: 2 type: string
minItems: 2 description: The value ``m.room.member``.
items: example: "m.room.member"
- type: string state_key:
title: Event ID type: string
example: "$abc123:matrix.org" description: The user ID of the leaving member.
- type: object example: "@someone:example.org"
title: Event Hash content:
example: { type: object
"sha256": "abase64encodedsha256hashshouldbe43byteslong" title: Membership Event Content
} description: The content of the event.
properties: example: {"membership": "leave"}
sha256: properties:
type: string membership:
description: The event hash. type: string
example: abase64encodedsha256hashshouldbe43byteslong description: The value ``leave``.
required: ['sha256'] example: "leave"
redacts: required: ['membership']
type: string auth_events:
description: Not used. type: array
required: description: |-
# Every other field is already flagged as required by the $ref An event reference list containing the authorization events that would
- state_key allow the member to leave the room. This should normally be the
``m.room.create``, ``m.room.power_levels``, and ``m.room.join_rules``
events.
items:
type: array
maxItems: 2
minItems: 2
items:
- type: string
title: Event ID
example: "$abc123:matrix.org"
- type: object
title: Event Hash
example: {
"sha256": "abase64encodedsha256hashshouldbe43byteslong"
}
properties:
sha256:
type: string
description: The event hash.
example: abase64encodedsha256hashshouldbe43byteslong
required: ['sha256']
redacts:
type: string
description: Not used.
required:
# Every other field is already flagged as required by the $ref
- state_key
examples: examples:
application/json: { application/json: {
"$ref": "examples/unsigned_pdu.json", "event": {
"type": "m.room.member", "$ref": "examples/unsigned_pdu.json",
"state_key": "@someone:example.org", "type": "m.room.member",
"content": { "state_key": "@someone:example.org",
"content": {
"membership": "leave" "membership": "leave"
}, },
"auth_events": [ "auth_events": [
["$room_cre4te_3vent:matrix.org", {"sha256": "abase64encodedsha256hashshouldbe43byteslong"}], ["$room_cre4te_3vent:matrix.org", {"sha256": "abase64encodedsha256hashshouldbe43byteslong"}],
["$room_j0in_rul3s_3vent:matrix.org", {"sha256": "abase64encodedsha256hashshouldbe43byteslong"}], ["$room_j0in_rul3s_3vent:matrix.org", {"sha256": "abase64encodedsha256hashshouldbe43byteslong"}],
["$room_p0wer_l3vels_3vent:matrix.org", {"sha256": "abase64encodedsha256hashshouldbe43byteslong"}] ["$room_p0wer_l3vels_3vent:matrix.org", {"sha256": "abase64encodedsha256hashshouldbe43byteslong"}]
] ]
}
} }
403: 403:
description: |- description: |-