|
| 1 | +# Copyright 2018 New Vector Ltd |
| 2 | +# Copyright 2020 The Matrix.org Foundation C.I.C. |
| 3 | +# |
| 4 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | +# you may not use this file except in compliance with the License. |
| 6 | +# You may obtain a copy of the License at |
| 7 | +# |
| 8 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | +# |
| 10 | +# Unless required by applicable law or agreed to in writing, software |
| 11 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | +# See the License for the specific language governing permissions and |
| 14 | +# limitations under the License. |
| 15 | + |
| 16 | +swagger: '2.0' |
| 17 | +info: |
| 18 | + title: "Matrix Federation Join Room API" |
| 19 | + version: "1.0.0" |
| 20 | +host: localhost:8448 |
| 21 | +schemes: |
| 22 | + - https |
| 23 | +basePath: /_matrix/federation/v2 |
| 24 | +consumes: |
| 25 | + - application/json |
| 26 | +produces: |
| 27 | + - application/json |
| 28 | +securityDefinitions: |
| 29 | + $ref: definitions/security.yaml |
| 30 | +paths: |
| 31 | + # Note: there is no v2 of make_join (yet) |
| 32 | + "/send_join/{roomId}/{eventId}": |
| 33 | + put: |
| 34 | + summary: Submit a signed join event to a resident server |
| 35 | + description: |- |
| 36 | + .. Note:: |
| 37 | + This API is nearly identical to the v1 API with the |
| 38 | + exception of the response format being fixed. |
| 39 | +
|
| 40 | + This endpoint is preferred over the v1 API as it provides |
| 41 | + a more standarised response format. Senders which receive |
| 42 | + a 400, 404, or other status code which indicates this endpoint |
| 43 | + is not available should retry using the v1 API instead. |
| 44 | +
|
| 45 | + Submits a signed join event to the resident server for it |
| 46 | + to accept it into the room's graph. Note that events have |
| 47 | + a different format depending on the room version - check |
| 48 | + the `room version specification`_ for precise event formats. |
| 49 | + **The request and response body here describes the common |
| 50 | + event fields in more detail and may be missing other required |
| 51 | + fields for a PDU.** |
| 52 | + operationId: sendJoinV2 |
| 53 | + security: |
| 54 | + - signedRequest: [] |
| 55 | + parameters: |
| 56 | + - in: path |
| 57 | + name: roomId |
| 58 | + type: string |
| 59 | + description: The room ID that is about to be joined. |
| 60 | + required: true |
| 61 | + x-example: "!abc123:matrix.org" |
| 62 | + - in: path |
| 63 | + name: eventId |
| 64 | + type: string |
| 65 | + description: The event ID for the join event. |
| 66 | + required: true |
| 67 | + x-example: "$abc123:example.org" |
| 68 | + - in: body |
| 69 | + name: body |
| 70 | + type: object |
| 71 | + required: true |
| 72 | + schema: |
| 73 | + type: object |
| 74 | + properties: |
| 75 | + sender: |
| 76 | + type: string |
| 77 | + description: The user ID of the joining member. |
| 78 | + example: "@someone:example.org" |
| 79 | + origin: |
| 80 | + type: string |
| 81 | + description: The name of the joining homeserver. |
| 82 | + example: "matrix.org" |
| 83 | + origin_server_ts: |
| 84 | + type: integer |
| 85 | + format: int64 |
| 86 | + description: A timestamp added by the joining homeserver. |
| 87 | + example: 1234567890 |
| 88 | + type: |
| 89 | + type: string |
| 90 | + description: The value ``m.room.member``. |
| 91 | + example: "m.room.member" |
| 92 | + state_key: |
| 93 | + type: string |
| 94 | + description: The user ID of the joining member. |
| 95 | + example: "@someone:example.org" |
| 96 | + content: |
| 97 | + type: object |
| 98 | + title: Membership Event Content |
| 99 | + description: The content of the event. |
| 100 | + example: {"membership": "join"} |
| 101 | + properties: |
| 102 | + membership: |
| 103 | + type: string |
| 104 | + description: The value ``join``. |
| 105 | + example: "join" |
| 106 | + required: ['membership'] |
| 107 | + required: |
| 108 | + - state_key |
| 109 | + - sender |
| 110 | + - origin |
| 111 | + - origin_server_ts |
| 112 | + - type |
| 113 | + - content |
| 114 | + example: { |
| 115 | + "$ref": "examples/minimal_pdu.json", |
| 116 | + "type": "m.room.member", |
| 117 | + "state_key": "@someone:example.org", |
| 118 | + "origin": "example.org", |
| 119 | + "origin_server_ts": 1549041175876, |
| 120 | + "sender": "@someone:example.org", |
| 121 | + "content": { |
| 122 | + "membership": "join" |
| 123 | + } |
| 124 | + } |
| 125 | + responses: |
| 126 | + 200: |
| 127 | + description: |- |
| 128 | + The full state for the room, having accepted the join event. |
| 129 | + schema: |
| 130 | + type: object |
| 131 | + title: Room State |
| 132 | + description: The state for the room. |
| 133 | + properties: |
| 134 | + origin: |
| 135 | + type: string |
| 136 | + description: The resident server's DNS name. |
| 137 | + auth_chain: |
| 138 | + type: array |
| 139 | + description: |- |
| 140 | + The auth chain. Note that events have a different format depending on |
| 141 | + the room version - check the `room version specification`_ for precise |
| 142 | + event formats. |
| 143 | + items: |
| 144 | + type: object |
| 145 | + title: PDU |
| 146 | + description: |- |
| 147 | + The `PDUs <#pdus>`_ that make up the auth chain. The event format varies depending |
| 148 | + on the room version - check the `room version specification`_ for precise event formats. |
| 149 | + schema: |
| 150 | + type: object |
| 151 | + properties: [] |
| 152 | + example: |
| 153 | + $ref: "examples/minimal_pdu.json" |
| 154 | + state: |
| 155 | + type: array |
| 156 | + description: |- |
| 157 | + The room state. The event format varies depending on the room version - |
| 158 | + check the `room version specification`_ for precise event formats. |
| 159 | + items: |
| 160 | + type: object |
| 161 | + title: PDU |
| 162 | + description: |- |
| 163 | + The `PDUs <#pdus>`_ for the fully resolved state of the room. The event format varies depending |
| 164 | + on the room version - check the `room version specification`_ for precise event formats. |
| 165 | + schema: |
| 166 | + type: object |
| 167 | + properties: [] |
| 168 | + example: |
| 169 | + $ref: "examples/minimal_pdu.json" |
| 170 | + required: ["auth_chain", "state", "origin"] |
| 171 | + examples: |
| 172 | + application/json: { |
| 173 | + "origin": "matrix.org", |
| 174 | + "auth_chain": [{"$ref": "examples/minimal_pdu.json"}], |
| 175 | + "state": [{"$ref": "examples/minimal_pdu.json"}] |
| 176 | + } |
0 commit comments