Merge branch 'master' into hs/dns-to-be-hostname
commit
632101dcde
@ -1,16 +0,0 @@
|
|||||||
language: go
|
|
||||||
go:
|
|
||||||
- 1.8
|
|
||||||
|
|
||||||
sudo: required
|
|
||||||
|
|
||||||
# we only need a single git commit
|
|
||||||
git:
|
|
||||||
depth: 1
|
|
||||||
|
|
||||||
install:
|
|
||||||
- sudo apt-get update
|
|
||||||
- sudo apt-get install python3 python3-dev
|
|
||||||
|
|
||||||
script:
|
|
||||||
- ./scripts/test-and-build.sh
|
|
@ -0,0 +1,23 @@
|
|||||||
|
# OpenAPI Extensions
|
||||||
|
|
||||||
|
For some functionality that is not directly provided by the OpenAPI v2
|
||||||
|
specification, some extensions have been added that are to be consistent
|
||||||
|
across the specification. The defined extensions are listed below. Extensions
|
||||||
|
should not break parsers, however if extra functionality is required, aware
|
||||||
|
parsers should be able to take advantage of the added syntax.
|
||||||
|
|
||||||
|
## Extensible Query Parameters
|
||||||
|
|
||||||
|
<!-- TODO: Remove and change instances to 'explode' after OpenAPI/Swagger v3 update -->
|
||||||
|
|
||||||
|
If a unknown amount of query parameters can be added to a request, the `name`
|
||||||
|
must be `fields...`, with the trailing ellipses representing the possibility
|
||||||
|
of more fields.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
```
|
||||||
|
- in: query
|
||||||
|
name: fields...
|
||||||
|
type: string
|
||||||
|
```
|
@ -0,0 +1,88 @@
|
|||||||
|
# Copyright 2018 New Vector Ltd
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
type: object
|
||||||
|
title: Invite Event
|
||||||
|
description: An invite event
|
||||||
|
allOf:
|
||||||
|
- $ref: "pdu.yaml"
|
||||||
|
- type: object
|
||||||
|
properties:
|
||||||
|
# Note: we override a bunch of parameters to change their descriptions
|
||||||
|
sender:
|
||||||
|
type: string
|
||||||
|
# TODO: Verify/clarify this - it doesn't seem right, given this is a 'regular' invite
|
||||||
|
description: |-
|
||||||
|
The matrix ID of the user who sent the original ``m.room.third_party_invite``.
|
||||||
|
example: "@someone:example.org"
|
||||||
|
origin:
|
||||||
|
type: string
|
||||||
|
description: The name of the inviting homeserver.
|
||||||
|
example: "matrix.org"
|
||||||
|
origin_server_ts:
|
||||||
|
type: integer
|
||||||
|
format: int64
|
||||||
|
description: A timestamp added by the inviting 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 invited member.
|
||||||
|
example: "@joe:elsewhere.com"
|
||||||
|
content:
|
||||||
|
type: object
|
||||||
|
title: Membership Event Content
|
||||||
|
description: |-
|
||||||
|
The content of the event, matching what is available in the
|
||||||
|
`Client-Server API`_.
|
||||||
|
example: {"membership": "invite"}
|
||||||
|
properties:
|
||||||
|
membership:
|
||||||
|
type: string
|
||||||
|
description: The value ``invite``.
|
||||||
|
example: "invite"
|
||||||
|
required: ['membership']
|
||||||
|
auth_events:
|
||||||
|
type: array
|
||||||
|
description: |-
|
||||||
|
An event reference list containing the authorization events that would
|
||||||
|
allow the member to be invited to the room.
|
||||||
|
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
|
||||||
|
- unsigned # TODO: apparently this is required? Verify.
|
@ -1,69 +0,0 @@
|
|||||||
# Copyright 2017 Kamax.io
|
|
||||||
# Copyright 2018 New Vector Ltd
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
# you may not use this file except in compliance with the License.
|
|
||||||
# You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
# See the License for the specific language governing permissions and
|
|
||||||
# limitations under the License.
|
|
||||||
|
|
||||||
swagger: '2.0'
|
|
||||||
info:
|
|
||||||
title: "Matrix Federation Query API"
|
|
||||||
version: "1.0.0"
|
|
||||||
host: localhost:8448
|
|
||||||
schemes:
|
|
||||||
- https
|
|
||||||
basePath: /_matrix/federation/v1
|
|
||||||
produces:
|
|
||||||
- application/json
|
|
||||||
paths:
|
|
||||||
"/query/directory":
|
|
||||||
get:
|
|
||||||
summary: Retrieve the room ID and list of resident homeservers for a room
|
|
||||||
alias.
|
|
||||||
description: Retrieve the room ID and list of resident homeservers for a room
|
|
||||||
alias.
|
|
||||||
parameters:
|
|
||||||
- in: query
|
|
||||||
name: room_alias
|
|
||||||
type: string
|
|
||||||
description: Room alias.
|
|
||||||
required: true
|
|
||||||
x-example: "#room_alias:example.org"
|
|
||||||
responses:
|
|
||||||
200:
|
|
||||||
description: The corresponding room ID and list of known resident
|
|
||||||
homeservers for the room.
|
|
||||||
schema:
|
|
||||||
type: object
|
|
||||||
properties:
|
|
||||||
room_id:
|
|
||||||
type: string
|
|
||||||
description: The room ID mapped to the queried room alias.
|
|
||||||
x-example: "!roomid1234:example.org"
|
|
||||||
servers:
|
|
||||||
type: array
|
|
||||||
description: An array of server names that are likely to hold
|
|
||||||
then given room. This list may or may not include the server
|
|
||||||
answering the query.
|
|
||||||
items:
|
|
||||||
type: string
|
|
||||||
required:
|
|
||||||
- "room_id"
|
|
||||||
- "servers"
|
|
||||||
examples:
|
|
||||||
application/json: {
|
|
||||||
"room_id": "!roomid1234:example.org",
|
|
||||||
"servers": [
|
|
||||||
"example.org",
|
|
||||||
"example.com",
|
|
||||||
"another.example.com:8449",
|
|
||||||
]
|
|
||||||
}
|
|
@ -1,23 +1,23 @@
|
|||||||
{
|
{
|
||||||
"server_name": "example.org",
|
"server_name": "example.org",
|
||||||
"verify_keys": {
|
"verify_keys": {
|
||||||
"ed25519:auto2": {
|
"ed25519:abc123": {
|
||||||
"key": "Base+64+Encoded+Signature+Verification+Key"
|
"key": "VGhpcyBzaG91bGQgYmUgYSByZWFsIGVkMjU1MTkgcGF5bG9hZA"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"old_verify_keys": {
|
"old_verify_keys": {
|
||||||
"ed25519:auto1": {
|
"ed25519:0ldk3y": {
|
||||||
"expired_ts": 922834800000,
|
"expired_ts": 1532645052628,
|
||||||
"key": "Base+64+Encoded+Old+Verify+Key"
|
"key": "VGhpcyBzaG91bGQgYmUgeW91ciBvbGQga2V5J3MgZWQyNTUxOSBwYXlsb2FkLg"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"signatures": {
|
"signatures": {
|
||||||
"example.org": {
|
"example.org": {
|
||||||
"ed25519:auto2": "Base+64+Encoded+Signature"
|
"ed25519:auto2": "VGhpcyBzaG91bGQgYWN0dWFsbHkgYmUgYSBzaWduYXR1cmU"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"tls_fingerprints": [{
|
"tls_fingerprints": [{
|
||||||
"sha256": "Base+64+Encoded+SHA-256-Fingerprint"
|
"sha256": "VGhpcyBpcyBoYXNoIHdoaWNoIHNob3VsZCBiZSBieXRlcw"
|
||||||
}],
|
}],
|
||||||
"valid_until_ts": 1052262000000
|
"valid_until_ts": 1652262000000
|
||||||
}
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"$ref": "server_key.json",
|
||||||
|
"signatures": {
|
||||||
|
"example.org": {
|
||||||
|
"ed25519:abc123": "VGhpcyBzaG91bGQgYWN0dWFsbHkgYmUgYSBzaWduYXR1cmU"
|
||||||
|
},
|
||||||
|
"notary.server.com": {
|
||||||
|
"ed25519:010203": "VGhpcyBpcyBhbm90aGVyIHNpZ25hdHVyZQ"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,88 @@
|
|||||||
|
# Copyright 2018 New Vector Ltd
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
swagger: '2.0'
|
||||||
|
info:
|
||||||
|
title: "Matrix Federation Invite User To Room API"
|
||||||
|
version: "1.0.0"
|
||||||
|
host: localhost:8448
|
||||||
|
schemes:
|
||||||
|
- https
|
||||||
|
basePath: /_matrix/federation/v1
|
||||||
|
produces:
|
||||||
|
- application/json
|
||||||
|
paths:
|
||||||
|
"/invite/{roomId}/{eventId}":
|
||||||
|
put:
|
||||||
|
summary: Invites a user to a room
|
||||||
|
description: |-
|
||||||
|
Invites a remote user to a room. Once the event has been
|
||||||
|
signed by both the inviting homeserver and the invited
|
||||||
|
homeserver, it can be sent to all of the users in the room.
|
||||||
|
operationId: sendInvite
|
||||||
|
parameters:
|
||||||
|
- in: path
|
||||||
|
name: roomId
|
||||||
|
type: string
|
||||||
|
description: The room ID that the user is being invited to.
|
||||||
|
required: true
|
||||||
|
x-example: "!abc123:matrix.org"
|
||||||
|
- in: path
|
||||||
|
name: eventId
|
||||||
|
type: string
|
||||||
|
description: The event ID for the invite event.
|
||||||
|
required: true
|
||||||
|
x-example: "$abc123:example.org"
|
||||||
|
- in: body
|
||||||
|
name: body
|
||||||
|
type: object
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
$ref: "definitions/invite_event.yaml"
|
||||||
|
example: {
|
||||||
|
"$ref": "examples/pdu.json",
|
||||||
|
"type": "m.room.member",
|
||||||
|
"state_key": "@someone:example.org",
|
||||||
|
"content": {
|
||||||
|
"membership": "invite"
|
||||||
|
},
|
||||||
|
"unsigned": {}
|
||||||
|
}
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
description: |-
|
||||||
|
The event with the invited server's signature added. All other fields of the events
|
||||||
|
should remain untouched.
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
minItems: 2
|
||||||
|
maxItems: 2
|
||||||
|
items:
|
||||||
|
- type: integer
|
||||||
|
description: The value ``200``.
|
||||||
|
example: 200
|
||||||
|
- $ref: "definitions/invite_event.yaml"
|
||||||
|
examples:
|
||||||
|
application/json: [
|
||||||
|
200,
|
||||||
|
{
|
||||||
|
"$ref": "examples/pdu.json",
|
||||||
|
"type": "m.room.member",
|
||||||
|
"state_key": "@someone:example.org",
|
||||||
|
"content": {
|
||||||
|
"membership": "invite"
|
||||||
|
},
|
||||||
|
"unsigned": {}
|
||||||
|
}
|
||||||
|
]
|
@ -0,0 +1,285 @@
|
|||||||
|
# Copyright 2018 New Vector Ltd
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
swagger: '2.0'
|
||||||
|
info:
|
||||||
|
title: "Matrix Federation Join Room API"
|
||||||
|
version: "1.0.0"
|
||||||
|
host: localhost:8448
|
||||||
|
schemes:
|
||||||
|
- https
|
||||||
|
basePath: /_matrix/federation/v1
|
||||||
|
produces:
|
||||||
|
- application/json
|
||||||
|
paths:
|
||||||
|
"/make_join/{roomId}/{userId}":
|
||||||
|
get:
|
||||||
|
summary: Get information required to make a join event for a room
|
||||||
|
description: |-
|
||||||
|
Asks the receiving server to return information that the sending
|
||||||
|
server will need to prepare a join event to get into the room.
|
||||||
|
operationId: makeJoin
|
||||||
|
parameters:
|
||||||
|
- in: path
|
||||||
|
name: roomId
|
||||||
|
type: string
|
||||||
|
description: The room ID that is about to be joined.
|
||||||
|
required: true
|
||||||
|
x-example: "!abc123:matrix.org"
|
||||||
|
- in: path
|
||||||
|
name: userId
|
||||||
|
type: string
|
||||||
|
description: The user ID the join event will be for.
|
||||||
|
required: true
|
||||||
|
x-example: "@someone:example.org"
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
description: |-
|
||||||
|
An unsigned event that the server may now use as a template
|
||||||
|
for the rest of the `Joining Rooms`_ handshake.
|
||||||
|
schema:
|
||||||
|
allOf:
|
||||||
|
- $ref: "definitions/unsigned_pdu.yaml"
|
||||||
|
- type: object
|
||||||
|
properties:
|
||||||
|
# Note: we override a bunch of parameters to change their descriptions
|
||||||
|
sender:
|
||||||
|
type: string
|
||||||
|
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
|
||||||
|
title: Membership Event Content
|
||||||
|
description: The content of the event.
|
||||||
|
example: {"membership": "join"}
|
||||||
|
properties:
|
||||||
|
membership:
|
||||||
|
type: string
|
||||||
|
description: The value ``join``.
|
||||||
|
example: "join"
|
||||||
|
required: ['membership']
|
||||||
|
depth:
|
||||||
|
type: integer
|
||||||
|
description: This field must be present but is ignored; it may be 0.
|
||||||
|
example: 12
|
||||||
|
auth_events:
|
||||||
|
type: array
|
||||||
|
description: |-
|
||||||
|
An event reference list containing the authorization events that would
|
||||||
|
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:
|
||||||
|
application/json: {
|
||||||
|
"$ref": "examples/unsigned_pdu.json",
|
||||||
|
"type": "m.room.member",
|
||||||
|
"state_key": "@someone:example.org",
|
||||||
|
"content": {
|
||||||
|
"membership": "join"
|
||||||
|
},
|
||||||
|
"auth_events": [
|
||||||
|
["$room_cre4te_3vent:matrix.org", {"sha256": "abase64encodedsha256hashshouldbe43byteslong"}],
|
||||||
|
["$room_j0in_rul3s_3vent:matrix.org", {"sha256": "abase64encodedsha256hashshouldbe43byteslong"}],
|
||||||
|
["$room_p0wer_l3vels_3vent:matrix.org", {"sha256": "abase64encodedsha256hashshouldbe43byteslong"}]
|
||||||
|
]
|
||||||
|
}
|
||||||
|
"/send_join/{roomId}/{eventId}":
|
||||||
|
put:
|
||||||
|
summary: Submit a signed join event to a resident server
|
||||||
|
description: |-
|
||||||
|
Submits a signed join event to the resident server for it
|
||||||
|
to accept it into the room's graph.
|
||||||
|
operationId: sendJoin
|
||||||
|
parameters:
|
||||||
|
- in: path
|
||||||
|
name: roomId
|
||||||
|
type: string
|
||||||
|
description: The room ID that is about to be joined.
|
||||||
|
required: true
|
||||||
|
x-example: "!abc123:matrix.org"
|
||||||
|
- in: path
|
||||||
|
name: eventId
|
||||||
|
type: string
|
||||||
|
description: The event ID for the join event.
|
||||||
|
required: true
|
||||||
|
x-example: "$abc123:example.org"
|
||||||
|
- in: body
|
||||||
|
name: body
|
||||||
|
type: object
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
allOf:
|
||||||
|
- $ref: "definitions/pdu.yaml"
|
||||||
|
- type: object
|
||||||
|
properties:
|
||||||
|
# Note: we override a bunch of parameters to change their descriptions
|
||||||
|
sender:
|
||||||
|
type: string
|
||||||
|
description: The user ID of the joining member.
|
||||||
|
example: "@someone:example.org"
|
||||||
|
origin:
|
||||||
|
type: string
|
||||||
|
description: The name of the joining homeserver.
|
||||||
|
example: "matrix.org"
|
||||||
|
origin_server_ts:
|
||||||
|
type: integer
|
||||||
|
format: int64
|
||||||
|
description: A timestamp added by the joining 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
|
||||||
|
title: Membership Event Content
|
||||||
|
description: The content of the event.
|
||||||
|
example: {"membership": "join"}
|
||||||
|
properties:
|
||||||
|
membership:
|
||||||
|
type: string
|
||||||
|
description: The value ``join``.
|
||||||
|
example: "join"
|
||||||
|
required: ['membership']
|
||||||
|
depth:
|
||||||
|
type: integer
|
||||||
|
description: This field must be present but is ignored; it may be 0.
|
||||||
|
example: 12
|
||||||
|
auth_events:
|
||||||
|
type: array
|
||||||
|
description: |-
|
||||||
|
An event reference list containing the authorization events that would
|
||||||
|
allow the member to join the room.
|
||||||
|
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
|
||||||
|
example: {
|
||||||
|
"$ref": "examples/pdu.json",
|
||||||
|
"type": "m.room.member",
|
||||||
|
"state_key": "@someone:example.org",
|
||||||
|
"content": {
|
||||||
|
"membership": "join"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
description: |-
|
||||||
|
The full state for the room, having accepted the join event.
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
minItems: 2
|
||||||
|
maxItems: 2
|
||||||
|
items:
|
||||||
|
- type: integer
|
||||||
|
description: The value ``200``.
|
||||||
|
example: 200
|
||||||
|
- type: object
|
||||||
|
title: Room State
|
||||||
|
description: The state for the room.
|
||||||
|
properties:
|
||||||
|
origin:
|
||||||
|
type: string
|
||||||
|
description: The resident server's DNS name.
|
||||||
|
auth_chain:
|
||||||
|
type: array
|
||||||
|
description: The auth chain.
|
||||||
|
items:
|
||||||
|
type: object
|
||||||
|
schema:
|
||||||
|
$ref: "definitions/pdu.yaml"
|
||||||
|
state:
|
||||||
|
type: array
|
||||||
|
description: The room state.
|
||||||
|
items:
|
||||||
|
type: object
|
||||||
|
schema:
|
||||||
|
$ref: "definitions/pdu.yaml"
|
||||||
|
required: ["auth_chain", "state", "origin"]
|
||||||
|
examples:
|
||||||
|
application/json: [
|
||||||
|
200,
|
||||||
|
{
|
||||||
|
"origin": "matrix.org",
|
||||||
|
"auth_chain": [{"$ref": "examples/pdu.json"}],
|
||||||
|
"state": [{"$ref": "examples/pdu.json"}]
|
||||||
|
}
|
||||||
|
]
|
@ -0,0 +1,266 @@
|
|||||||
|
# Copyright 2018 New Vector Ltd
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
swagger: '2.0'
|
||||||
|
info:
|
||||||
|
title: "Matrix Federation Leave Room API"
|
||||||
|
version: "1.0.0"
|
||||||
|
host: localhost:8448
|
||||||
|
schemes:
|
||||||
|
- https
|
||||||
|
basePath: /_matrix/federation/v1
|
||||||
|
produces:
|
||||||
|
- application/json
|
||||||
|
paths:
|
||||||
|
"/make_leave/{roomId}/{userId}":
|
||||||
|
get:
|
||||||
|
summary: Get information required to make a leave event for a room
|
||||||
|
description: |-
|
||||||
|
Asks the receiving server to return information that the sending
|
||||||
|
server will need to prepare a leave event to get out of the room.
|
||||||
|
operationId: makeLeave
|
||||||
|
parameters:
|
||||||
|
- in: path
|
||||||
|
name: roomId
|
||||||
|
type: string
|
||||||
|
description: The room ID that is about to be left.
|
||||||
|
required: true
|
||||||
|
x-example: "!abc123:matrix.org"
|
||||||
|
- in: path
|
||||||
|
name: userId
|
||||||
|
type: string
|
||||||
|
description: The user ID the leave event will be for.
|
||||||
|
required: true
|
||||||
|
x-example: "@someone:example.org"
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
description: |-
|
||||||
|
An unsigned event that the sending server may use as a template
|
||||||
|
for when it calls ``/send_leave``.
|
||||||
|
schema:
|
||||||
|
allOf:
|
||||||
|
- $ref: "definitions/unsigned_pdu.yaml"
|
||||||
|
- type: object
|
||||||
|
properties:
|
||||||
|
# Note: we override a bunch of parameters to change their descriptions
|
||||||
|
sender:
|
||||||
|
type: string
|
||||||
|
description: The user ID of the leaving 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 leaving member.
|
||||||
|
example: "@someone:example.org"
|
||||||
|
content:
|
||||||
|
type: object
|
||||||
|
title: Membership Event Content
|
||||||
|
description: The content of the event.
|
||||||
|
example: {"membership": "leave"}
|
||||||
|
properties:
|
||||||
|
membership:
|
||||||
|
type: string
|
||||||
|
description: The value ``leave``.
|
||||||
|
example: "leave"
|
||||||
|
required: ['membership']
|
||||||
|
auth_events:
|
||||||
|
type: array
|
||||||
|
description: |-
|
||||||
|
An event reference list containing the authorization events that would
|
||||||
|
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:
|
||||||
|
application/json: {
|
||||||
|
"$ref": "examples/unsigned_pdu.json",
|
||||||
|
"type": "m.room.member",
|
||||||
|
"state_key": "@someone:example.org",
|
||||||
|
"content": {
|
||||||
|
"membership": "leave"
|
||||||
|
},
|
||||||
|
"auth_events": [
|
||||||
|
["$room_cre4te_3vent:matrix.org", {"sha256": "abase64encodedsha256hashshouldbe43byteslong"}],
|
||||||
|
["$room_j0in_rul3s_3vent:matrix.org", {"sha256": "abase64encodedsha256hashshouldbe43byteslong"}],
|
||||||
|
["$room_p0wer_l3vels_3vent:matrix.org", {"sha256": "abase64encodedsha256hashshouldbe43byteslong"}]
|
||||||
|
]
|
||||||
|
}
|
||||||
|
403:
|
||||||
|
description: |-
|
||||||
|
The request is not authorized. This could mean that the user is not in the room.
|
||||||
|
schema:
|
||||||
|
$ref: "../client-server/definitions/errors/error.yaml"
|
||||||
|
examples:
|
||||||
|
application/json: {
|
||||||
|
"errcode": "M_FORBIDDEN",
|
||||||
|
"error": "User is not in the room."
|
||||||
|
}
|
||||||
|
"/send_leave/{roomId}/{eventId}":
|
||||||
|
put:
|
||||||
|
summary: Submit a signed leave event to a resident server
|
||||||
|
description: |-
|
||||||
|
Submits a signed leave event to the resident server for it
|
||||||
|
to accept it into the room's graph.
|
||||||
|
operationId: sendLeave
|
||||||
|
parameters:
|
||||||
|
- in: path
|
||||||
|
name: roomId
|
||||||
|
type: string
|
||||||
|
description: The room ID that is about to be left.
|
||||||
|
required: true
|
||||||
|
x-example: "!abc123:matrix.org"
|
||||||
|
- in: path
|
||||||
|
name: eventId
|
||||||
|
type: string
|
||||||
|
description: The event ID for the leave event.
|
||||||
|
required: true
|
||||||
|
x-example: "$abc123:example.org"
|
||||||
|
- in: body
|
||||||
|
name: body
|
||||||
|
type: object
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
allOf:
|
||||||
|
- $ref: "definitions/pdu.yaml"
|
||||||
|
- type: object
|
||||||
|
properties:
|
||||||
|
# Note: we override a bunch of parameters to change their descriptions
|
||||||
|
sender:
|
||||||
|
type: string
|
||||||
|
description: The user ID of the leaving member.
|
||||||
|
example: "@someone:example.org"
|
||||||
|
origin:
|
||||||
|
type: string
|
||||||
|
description: The name of the leaving homeserver.
|
||||||
|
example: "matrix.org"
|
||||||
|
origin_server_ts:
|
||||||
|
type: integer
|
||||||
|
format: int64
|
||||||
|
description: A timestamp added by the leaving 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
|
||||||
|
title: Membership Event Content
|
||||||
|
description: The content of the event.
|
||||||
|
example: {"membership": "leave"}
|
||||||
|
properties:
|
||||||
|
membership:
|
||||||
|
type: string
|
||||||
|
description: The value ``leave``.
|
||||||
|
example: "leave"
|
||||||
|
required: ['membership']
|
||||||
|
depth:
|
||||||
|
type: integer
|
||||||
|
description: This field must be present but is ignored; it may be 0.
|
||||||
|
example: 12
|
||||||
|
auth_events:
|
||||||
|
type: array
|
||||||
|
description: |-
|
||||||
|
An event reference list containing the authorization events that would
|
||||||
|
allow the member to leave the room.
|
||||||
|
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
|
||||||
|
example: {
|
||||||
|
"$ref": "examples/pdu.json",
|
||||||
|
"type": "m.room.member",
|
||||||
|
"state_key": "@someone:example.org",
|
||||||
|
"content": {
|
||||||
|
"membership": "leave"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
description: |-
|
||||||
|
An empty response to indicate the event was accepted into the graph by
|
||||||
|
the receiving homeserver.
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
minItems: 2
|
||||||
|
maxItems: 2
|
||||||
|
items:
|
||||||
|
- type: integer
|
||||||
|
description: The value ``200``.
|
||||||
|
example: 200
|
||||||
|
- type: object
|
||||||
|
title: Empty Object
|
||||||
|
description: An empty object.
|
||||||
|
examples:
|
||||||
|
application/json: [200, {}]
|
@ -0,0 +1,166 @@
|
|||||||
|
# Copyright 2017 Kamax.io
|
||||||
|
# Copyright 2018 New Vector Ltd
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
swagger: '2.0'
|
||||||
|
info:
|
||||||
|
title: "Matrix Federation Query API"
|
||||||
|
version: "1.0.0"
|
||||||
|
host: localhost:8448
|
||||||
|
schemes:
|
||||||
|
- https
|
||||||
|
basePath: /_matrix/federation/v1
|
||||||
|
produces:
|
||||||
|
- application/json
|
||||||
|
paths:
|
||||||
|
"/query/{queryType}":
|
||||||
|
get:
|
||||||
|
summary: Query for information
|
||||||
|
description: |-
|
||||||
|
Performs a single query request on the receiving homeserver. The query string
|
||||||
|
arguments are dependent on which type of query is being made. Known query types
|
||||||
|
are specified as their own endpoints as an extension to this definition.
|
||||||
|
operationId: queryInfo
|
||||||
|
parameters:
|
||||||
|
- in: path
|
||||||
|
name: queryType
|
||||||
|
type: string
|
||||||
|
description: The type of query to make
|
||||||
|
required: true
|
||||||
|
x-example: profile
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
description: |-
|
||||||
|
The query response. The schema varies depending on the query being made.
|
||||||
|
"/query/directory":
|
||||||
|
get:
|
||||||
|
summary: Query for the room ID and resident homeservers for a room alias
|
||||||
|
description: |-
|
||||||
|
Performs a query to get the mapped room ID and list of resident homeservers in
|
||||||
|
the room for a given room alias. Homeservers should only query room aliases
|
||||||
|
that belong to the target server (identified by the DNS Name in the alias).
|
||||||
|
|
||||||
|
Servers may wish to cache the response to this query to avoid requesting the
|
||||||
|
information too often.
|
||||||
|
operationId: queryRoomDirectory
|
||||||
|
parameters:
|
||||||
|
- in: query
|
||||||
|
name: room_alias
|
||||||
|
type: string
|
||||||
|
description: The room alias to query.
|
||||||
|
required: true
|
||||||
|
x-example: "#room_alias:example.org"
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
description: |-
|
||||||
|
The corresponding room ID and list of known resident homeservers for the room.
|
||||||
|
schema:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
room_id:
|
||||||
|
type: string
|
||||||
|
description: The room ID mapped to the queried room alias.
|
||||||
|
x-example: "!roomid1234:example.org"
|
||||||
|
servers:
|
||||||
|
type: array
|
||||||
|
description: |-
|
||||||
|
An array of server names that are likely to hold the given room. This
|
||||||
|
list may or may not include the server answering the query.
|
||||||
|
items:
|
||||||
|
type: string
|
||||||
|
required:
|
||||||
|
- "room_id"
|
||||||
|
- "servers"
|
||||||
|
examples:
|
||||||
|
application/json: {
|
||||||
|
"room_id": "!roomid1234:example.org",
|
||||||
|
"servers": [
|
||||||
|
"example.org",
|
||||||
|
"example.com",
|
||||||
|
"another.example.com:8449",
|
||||||
|
]
|
||||||
|
}
|
||||||
|
404:
|
||||||
|
description: The room alias was not found.
|
||||||
|
schema:
|
||||||
|
$ref: "../client-server/definitions/errors/error.yaml"
|
||||||
|
examples:
|
||||||
|
application/json: {
|
||||||
|
"errcode": "M_NOT_FOUND",
|
||||||
|
"error": "Room alias not found."
|
||||||
|
}
|
||||||
|
"/query/profile":
|
||||||
|
get:
|
||||||
|
summary: Query for profile information about a given user
|
||||||
|
description: |-
|
||||||
|
Performs a query to get profile information, such as a display name or avatar,
|
||||||
|
for a given user. Homeservers should only query profiles for users that belong
|
||||||
|
to the target server (identified by the DNS Name in the user ID).
|
||||||
|
|
||||||
|
Servers may wish to cache the response to this query to avoid requesting the
|
||||||
|
information too often.
|
||||||
|
parameters:
|
||||||
|
- in: query
|
||||||
|
name: user_id
|
||||||
|
type: string
|
||||||
|
description: The user ID to query.
|
||||||
|
required: true
|
||||||
|
x-example: "@someone:example.org"
|
||||||
|
- in: query
|
||||||
|
name: field
|
||||||
|
type: enum
|
||||||
|
enum: ['displayname', 'avatar_url']
|
||||||
|
description: |-
|
||||||
|
The field to query. If specified, the server will only return the given field
|
||||||
|
in the response. If not specified, the server will return the full profile for
|
||||||
|
the user.
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
description: |-
|
||||||
|
The profile for the user. If a ``field`` is specified in the request, only the
|
||||||
|
matching field should be included in the response. If no ``field`` was specified,
|
||||||
|
the response should include the fields of the user's profile that can be made
|
||||||
|
public, such as the display name and avatar.
|
||||||
|
|
||||||
|
If the user does not have a particular field set on their profile, the server
|
||||||
|
should exclude it from the response body or give it the value ``null``.
|
||||||
|
schema:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
displayname:
|
||||||
|
type: string
|
||||||
|
description: |-
|
||||||
|
The display name of the user. May be omitted if the user does not have a
|
||||||
|
display name set.
|
||||||
|
x-example: "John Doe"
|
||||||
|
avatar_url:
|
||||||
|
type: string
|
||||||
|
description: |-
|
||||||
|
The avatar URL for the user's avatar. May be omitted if the user does not
|
||||||
|
have an avatar set.
|
||||||
|
x-example: "mxc://matrix.org/MyC00lAvatar"
|
||||||
|
examples:
|
||||||
|
application/json: {
|
||||||
|
"displayname": "John Doe",
|
||||||
|
"avatar_url": "mxc://matrix.org/MyC00lAvatar"
|
||||||
|
}
|
||||||
|
404:
|
||||||
|
description: The user does not exist or does not have a profile.
|
||||||
|
schema:
|
||||||
|
$ref: "../client-server/definitions/errors/error.yaml"
|
||||||
|
examples:
|
||||||
|
application/json: {
|
||||||
|
"errcode": "M_NOT_FOUND",
|
||||||
|
"error": "User does not exist."
|
||||||
|
}
|
@ -1,44 +0,0 @@
|
|||||||
# Copyright 2018 New Vector Ltd
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
# you may not use this file except in compliance with the License.
|
|
||||||
# You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
# See the License for the specific language governing permissions and
|
|
||||||
# limitations under the License.
|
|
||||||
|
|
||||||
swagger: '2.0'
|
|
||||||
info:
|
|
||||||
title: "Matrix Federation Query API"
|
|
||||||
version: "1.0.0"
|
|
||||||
host: localhost:8448
|
|
||||||
schemes:
|
|
||||||
- https
|
|
||||||
basePath: /_matrix/federation/v1
|
|
||||||
produces:
|
|
||||||
- application/json
|
|
||||||
paths:
|
|
||||||
"/query/{queryType}":
|
|
||||||
get:
|
|
||||||
summary: Query for information
|
|
||||||
description: |-
|
|
||||||
Performs a single query request on the receiving homeserver. The query string
|
|
||||||
arguments are dependent on which type of query is being made. Known query types
|
|
||||||
are specified as their own endpoints as an extension to this definition.
|
|
||||||
operationId: queryInfo
|
|
||||||
parameters:
|
|
||||||
- in: path
|
|
||||||
name: queryType
|
|
||||||
type: string
|
|
||||||
description: The type of query to make
|
|
||||||
required: true
|
|
||||||
x-example: profile
|
|
||||||
responses:
|
|
||||||
200:
|
|
||||||
description: |-
|
|
||||||
The query response. The schema varies depending on the query being made.
|
|
Loading…
Reference in New Issue