Swaggerify /rooms/:room_id/leave
This commit is contained in:
parent
994c0974f9
commit
8201eaa042
4 changed files with 132 additions and 76 deletions
|
@ -1,6 +1,6 @@
|
||||||
swagger: '2.0'
|
swagger: '2.0'
|
||||||
info:
|
info:
|
||||||
title: "Matrix Client-Server v1 Room Membership API"
|
title: "Matrix Client-Server v1 Room Joining API"
|
||||||
version: "1.0.0"
|
version: "1.0.0"
|
||||||
host: localhost:8008
|
host: localhost:8008
|
||||||
schemes:
|
schemes:
|
||||||
|
@ -18,55 +18,6 @@ securityDefinitions:
|
||||||
name: access_token
|
name: access_token
|
||||||
in: query
|
in: query
|
||||||
paths:
|
paths:
|
||||||
"/rooms/{roomId}/join":
|
|
||||||
post:
|
|
||||||
summary: Start the requesting user participating in a particular room.
|
|
||||||
description: |-
|
|
||||||
This API starts a user participating in a particular room, if that user
|
|
||||||
is allowed to participate in that room. After this call, the client is
|
|
||||||
allowed to see all current state events in the room, and all subsequent
|
|
||||||
events associated with the room until the user leaves the room.
|
|
||||||
|
|
||||||
After a user has joined a room, the room will appear as an entry in the
|
|
||||||
response of the |initialSync| API.
|
|
||||||
security:
|
|
||||||
- accessToken: []
|
|
||||||
parameters:
|
|
||||||
- in: path
|
|
||||||
type: string
|
|
||||||
name: roomId
|
|
||||||
description: The room identifier or room alias to join.
|
|
||||||
required: true
|
|
||||||
x-example: "#monkeys:matrix.org"
|
|
||||||
responses:
|
|
||||||
200:
|
|
||||||
description: |-
|
|
||||||
The room has been joined.
|
|
||||||
|
|
||||||
The joined room ID must be returned in the ``room_id`` field.
|
|
||||||
examples:
|
|
||||||
application/json: |-
|
|
||||||
{"room_id": "!d41d8cd:matrix.org"}
|
|
||||||
schema:
|
|
||||||
type: object
|
|
||||||
403:
|
|
||||||
description: |-
|
|
||||||
You do not have permission to join the room. A meaningful ``errcode`` and description error text will be returned. Example reasons for rejection are:
|
|
||||||
|
|
||||||
- The room is invite-only and the user was not invited.
|
|
||||||
- The user has been banned from the room.
|
|
||||||
examples:
|
|
||||||
application/json: |-
|
|
||||||
{"errcode": "M_FORBIDDEN", "error": "You are not invited to this room."}
|
|
||||||
429:
|
|
||||||
description: This request was rate-limited.
|
|
||||||
schema:
|
|
||||||
"$ref": "definitions/error.yaml"
|
|
||||||
x-alias:
|
|
||||||
canonical-link: "post-matrix-client-api-v1-rooms-roomid-join"
|
|
||||||
aliases:
|
|
||||||
- /join/{roomId}
|
|
||||||
|
|
||||||
# With an extra " " to disambiguate from the 3pid invite endpoint
|
# With an extra " " to disambiguate from the 3pid invite endpoint
|
||||||
# The extra space makes it sort first for what I'm sure is a good reason.
|
# The extra space makes it sort first for what I'm sure is a good reason.
|
||||||
"/rooms/{roomId}/invite ":
|
"/rooms/{roomId}/invite ":
|
68
api/client-server/v1/joining.yaml
Normal file
68
api/client-server/v1/joining.yaml
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
swagger: '2.0'
|
||||||
|
info:
|
||||||
|
title: "Matrix Client-Server v1 Room Inviting API"
|
||||||
|
version: "1.0.0"
|
||||||
|
host: localhost:8008
|
||||||
|
schemes:
|
||||||
|
- https
|
||||||
|
- http
|
||||||
|
basePath: /_matrix/client/api/v1
|
||||||
|
consumes:
|
||||||
|
- application/json
|
||||||
|
produces:
|
||||||
|
- application/json
|
||||||
|
securityDefinitions:
|
||||||
|
accessToken:
|
||||||
|
type: apiKey
|
||||||
|
description: The user_id or application service access_token
|
||||||
|
name: access_token
|
||||||
|
in: query
|
||||||
|
paths:
|
||||||
|
"/rooms/{roomId}/join":
|
||||||
|
post:
|
||||||
|
summary: Start the requesting user participating in a particular room.
|
||||||
|
description: |-
|
||||||
|
This API starts a user participating in a particular room, if that user
|
||||||
|
is allowed to participate in that room. After this call, the client is
|
||||||
|
allowed to see all current state events in the room, and all subsequent
|
||||||
|
events associated with the room until the user leaves the room.
|
||||||
|
|
||||||
|
After a user has joined a room, the room will appear as an entry in the
|
||||||
|
response of the |initialSync| API.
|
||||||
|
security:
|
||||||
|
- accessToken: []
|
||||||
|
parameters:
|
||||||
|
- in: path
|
||||||
|
type: string
|
||||||
|
name: roomId
|
||||||
|
description: The room identifier or room alias to join.
|
||||||
|
required: true
|
||||||
|
x-example: "#monkeys:matrix.org"
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
description: |-
|
||||||
|
The room has been joined.
|
||||||
|
|
||||||
|
The joined room ID must be returned in the ``room_id`` field.
|
||||||
|
examples:
|
||||||
|
application/json: |-
|
||||||
|
{"room_id": "!d41d8cd:matrix.org"}
|
||||||
|
schema:
|
||||||
|
type: object
|
||||||
|
403:
|
||||||
|
description: |-
|
||||||
|
You do not have permission to join the room. A meaningful ``errcode`` and description error text will be returned. Example reasons for rejection are:
|
||||||
|
|
||||||
|
- The room is invite-only and the user was not invited.
|
||||||
|
- The user has been banned from the room.
|
||||||
|
examples:
|
||||||
|
application/json: |-
|
||||||
|
{"errcode": "M_FORBIDDEN", "error": "You are not invited to this room."}
|
||||||
|
429:
|
||||||
|
description: This request was rate-limited.
|
||||||
|
schema:
|
||||||
|
"$ref": "definitions/error.yaml"
|
||||||
|
x-alias:
|
||||||
|
canonical-link: "post-matrix-client-api-v1-rooms-roomid-join"
|
||||||
|
aliases:
|
||||||
|
- /join/{roomId}
|
57
api/client-server/v1/leaving.yaml
Normal file
57
api/client-server/v1/leaving.yaml
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
swagger: '2.0'
|
||||||
|
info:
|
||||||
|
title: "Matrix Client-Server v1 Room Leaving API"
|
||||||
|
version: "1.0.0"
|
||||||
|
host: localhost:8008
|
||||||
|
schemes:
|
||||||
|
- https
|
||||||
|
- http
|
||||||
|
basePath: /_matrix/client/api/v1
|
||||||
|
consumes:
|
||||||
|
- application/json
|
||||||
|
produces:
|
||||||
|
- application/json
|
||||||
|
securityDefinitions:
|
||||||
|
accessToken:
|
||||||
|
type: apiKey
|
||||||
|
description: The user_id or application service access_token
|
||||||
|
name: access_token
|
||||||
|
in: query
|
||||||
|
paths:
|
||||||
|
"/rooms/{roomId}/leave":
|
||||||
|
post:
|
||||||
|
summary: Stop the requesting user participating in a particular room.
|
||||||
|
description: |-
|
||||||
|
This API stops a user participating in a particular room.
|
||||||
|
|
||||||
|
If the user was already in the room, they will no longer be able to see
|
||||||
|
new events in the room. If the room requires an invite to join, they
|
||||||
|
will need to be re-invited before they can re-join.
|
||||||
|
|
||||||
|
If the user was invited to the room, but had not joined, this call
|
||||||
|
serves to reject the invite.
|
||||||
|
|
||||||
|
The user will still be allowed to retrieve history from the room which
|
||||||
|
they were previously allowed to see.
|
||||||
|
security:
|
||||||
|
- accessToken: []
|
||||||
|
parameters:
|
||||||
|
- in: path
|
||||||
|
type: string
|
||||||
|
name: roomId
|
||||||
|
description: The room identifier to leave.
|
||||||
|
required: true
|
||||||
|
x-example: "!nkl290a:matrix.org"
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
description: |-
|
||||||
|
The room has been left.
|
||||||
|
examples:
|
||||||
|
application/json: |-
|
||||||
|
{}
|
||||||
|
schema:
|
||||||
|
type: object
|
||||||
|
429:
|
||||||
|
description: This request was rate-limited.
|
||||||
|
schema:
|
||||||
|
"$ref": "definitions/error.yaml"
|
|
@ -870,42 +870,22 @@ following values:
|
||||||
``invite``
|
``invite``
|
||||||
This room can only be joined if you were invited.
|
This room can only be joined if you were invited.
|
||||||
|
|
||||||
{{membership_http_api}}
|
{{inviting_http_api}}
|
||||||
|
|
||||||
|
{{joining_http_api}}
|
||||||
|
|
||||||
Leaving rooms
|
Leaving rooms
|
||||||
~~~~~~~~~~~~~
|
~~~~~~~~~~~~~
|
||||||
.. TODO-spec - HS deleting rooms they are no longer a part of. Not implemented.
|
|
||||||
- This is actually Very Tricky. If all clients a HS is serving leave a room,
|
|
||||||
the HS will no longer get any new events for that room, because the servers
|
|
||||||
who get the events are determined on the *membership list*. There should
|
|
||||||
probably be a way for a HS to lurk on a room even if there are 0 of their
|
|
||||||
members in the room.
|
|
||||||
- Grace period before deletion?
|
|
||||||
- Under what conditions should a room NOT be purged?
|
|
||||||
|
|
||||||
|
|
||||||
A user can leave a room to stop receiving events for that room. A user must
|
A user can leave a room to stop receiving events for that room. A user must
|
||||||
have been invited to or have joined the room before they are eligible to leave
|
have been invited to or have joined the room before they are eligible to leave
|
||||||
the room. Leaving a room to which the user has been invited rejects the invite.
|
the room. Leaving a room to which the user has been invited rejects the invite.
|
||||||
|
Once a user leaves a room, it will no longer appear on the |initialSync|_ API.
|
||||||
|
|
||||||
Whether or not they actually joined the room, if the room is
|
Whether or not they actually joined the room, if the room is
|
||||||
an "invite-only" room they will need to be re-invited before they can re-join
|
an "invite-only" room they will need to be re-invited before they can re-join
|
||||||
the room. To leave a room, a request should be made to
|
the room.
|
||||||
|/rooms/<room_id>/leave|_ with::
|
|
||||||
|
|
||||||
{}
|
{{leaving_http_api}}
|
||||||
|
|
||||||
Alternatively, the membership state for this user in this room can be modified
|
|
||||||
directly by sending the following request to
|
|
||||||
``/rooms/<room id>/state/m.room.member/<url encoded user id>``::
|
|
||||||
|
|
||||||
{
|
|
||||||
"membership": "leave"
|
|
||||||
}
|
|
||||||
|
|
||||||
See the `Room events`_ section for more information on ``m.room.member``. Once a
|
|
||||||
user has left a room, that room will no longer appear on the |initialSync|_ API.
|
|
||||||
If all members in a room leave, that room becomes eligible for deletion.
|
|
||||||
|
|
||||||
Banning users in a room
|
Banning users in a room
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue