Add sections for typing. Add swagger, JSON schema and example m.typing event
parent
e5fecbb87f
commit
2b7e02c080
@ -0,0 +1,77 @@
|
|||||||
|
swagger: '2.0'
|
||||||
|
info:
|
||||||
|
title: "Matrix Client-Server v1 Typing 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}/typing/{userId}":
|
||||||
|
put:
|
||||||
|
summary: Informs the server that the user has started or stopped typing.
|
||||||
|
description: |-
|
||||||
|
This tells the server that the user is typing for the next N
|
||||||
|
milliseconds where N is the value specified in the ``timeout`` key.
|
||||||
|
Alternatively, if ``typing`` is ``false``, it tells the server that the
|
||||||
|
user has stopped typing.
|
||||||
|
security:
|
||||||
|
- accessToken: []
|
||||||
|
parameters:
|
||||||
|
- in: path
|
||||||
|
type: string
|
||||||
|
name: userId
|
||||||
|
description: The user who has started to type.
|
||||||
|
required: true
|
||||||
|
x-example: "@alice:example.com"
|
||||||
|
- in: path
|
||||||
|
type: string
|
||||||
|
name: roomId
|
||||||
|
description: The room in which the user is typing.
|
||||||
|
required: true
|
||||||
|
x-example: "!wefh3sfukhs:example.com"
|
||||||
|
- in: body
|
||||||
|
name: typingState
|
||||||
|
description: The current typing state.
|
||||||
|
required: true
|
||||||
|
schema:
|
||||||
|
type: object
|
||||||
|
example: |-
|
||||||
|
{
|
||||||
|
"typing": true,
|
||||||
|
"timeout": 30000
|
||||||
|
}
|
||||||
|
properties:
|
||||||
|
typing:
|
||||||
|
type: boolean
|
||||||
|
description: |-
|
||||||
|
Whether the user is typing or not. If ``false``, the ``timeout``
|
||||||
|
key can be omitted.
|
||||||
|
timeout:
|
||||||
|
type: integer
|
||||||
|
description: The length of time in milliseconds to mark this user as typing.
|
||||||
|
required: ["typing"]
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
description: The new typing state was set.
|
||||||
|
examples:
|
||||||
|
application/json: |-
|
||||||
|
{}
|
||||||
|
schema:
|
||||||
|
type: object # empty json object
|
||||||
|
429:
|
||||||
|
description: This request was rate-limited.
|
||||||
|
schema:
|
||||||
|
"$ref": "definitions/error.yaml"
|
||||||
|
|
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"type": "m.typing",
|
||||||
|
"room_id": "!z0mnsuiwhifuhwwfw:matrix.org",
|
||||||
|
"content": {
|
||||||
|
"user_ids": ["@alice:matrix.org", "@bob:example.com"]
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,28 @@
|
|||||||
|
{
|
||||||
|
"type": "object",
|
||||||
|
"title": "Typing Event",
|
||||||
|
"description": "Informs the client of the list of users currently typing.",
|
||||||
|
"properties": {
|
||||||
|
"content": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"user_ids": {
|
||||||
|
"type": "array",
|
||||||
|
"items": {
|
||||||
|
"type": "string"
|
||||||
|
},
|
||||||
|
"description": "The list of user IDs typing in this room, if any."
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": ["user_ids"]
|
||||||
|
},
|
||||||
|
"type": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": ["m.typing"]
|
||||||
|
},
|
||||||
|
"room_id": {
|
||||||
|
"type": "string"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"required": ["type", "room_id", "content"]
|
||||||
|
}
|
Loading…
Reference in New Issue