You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
313 lines
13 KiB
YAML
313 lines
13 KiB
YAML
9 years ago
|
swagger: '2.0'
|
||
|
info:
|
||
|
title: "Matrix Client-Server v2 sync API"
|
||
|
version: "1.0.0"
|
||
|
host: localhost:8008
|
||
|
schemes:
|
||
|
- https
|
||
9 years ago
|
basePath: /_matrix/client/v2_alpha
|
||
9 years ago
|
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:
|
||
|
"/sync":
|
||
|
get:
|
||
|
summary: Synchronise the client's state and receive new messages.
|
||
|
description: |-
|
||
|
Synchronise the client's state with the latest state on the server.
|
||
9 years ago
|
Clients use this API when they first log in to get an initial snapshot
|
||
9 years ago
|
of the state on the server, and then continue to call this API to get
|
||
|
incremental deltas to the state, and to receive new messages.
|
||
|
security:
|
||
|
- accessToken: []
|
||
|
parameters:
|
||
|
- in: query
|
||
|
name: filter
|
||
|
type: string
|
||
|
description: |-
|
||
|
The ID of a filter created using the filter API.
|
||
9 years ago
|
x-example: "66696p746572"
|
||
9 years ago
|
- in: query
|
||
|
name: since
|
||
|
type: string
|
||
|
description: |-
|
||
|
A point in time to continue a sync from.
|
||
9 years ago
|
x-example: "s72594_4483_1934"
|
||
9 years ago
|
- in: query
|
||
|
name: full_state
|
||
|
type: boolean
|
||
|
description: |-
|
||
|
Controls whether to include the full state for all rooms the user
|
||
|
is a member of.
|
||
|
|
||
|
If this is set to ``true``, then all state events will be returned,
|
||
|
even if ``since`` is non-empty. The timeline will still be limited
|
||
9 years ago
|
by the ``since`` parameter. In this case, the ``timeout`` parameter
|
||
|
will be ignored and the query will return immediately, possibly with
|
||
|
an empty timeline.
|
||
9 years ago
|
|
||
|
If ``false``, and ``since`` is non-empty, only state which has
|
||
|
changed since the point indicated by ``since`` will be returned.
|
||
|
|
||
|
By default, this is ``false``.
|
||
|
x-example: "false"
|
||
9 years ago
|
- in: query
|
||
|
name: set_presence
|
||
|
type: string
|
||
9 years ago
|
enum: ["offline"]
|
||
9 years ago
|
description: |-
|
||
9 years ago
|
Controls whether the client is automatically marked as online by
|
||
|
polling this API. If this parameter is omitted then the client is
|
||
|
automatically marked as online when it uses this API. Otherwise if
|
||
|
the parameter is set to "offline" then the client is not marked as
|
||
|
being online when it uses this API.
|
||
|
x-example: "offline"
|
||
9 years ago
|
- in: query
|
||
|
name: timeout
|
||
|
type: integer
|
||
|
description: |-
|
||
|
The maximum time to poll in milliseconds before returning this
|
||
|
request.
|
||
9 years ago
|
x-example: 30000
|
||
9 years ago
|
responses:
|
||
|
200:
|
||
|
description:
|
||
|
The initial snapshot or delta for the client to use to update their
|
||
|
state.
|
||
|
schema:
|
||
|
type: object
|
||
|
properties:
|
||
|
next_batch:
|
||
|
type: string
|
||
|
description: |-
|
||
|
The batch token to supply in the ``since`` param of the next
|
||
|
``/sync`` request.
|
||
|
rooms:
|
||
9 years ago
|
title: Rooms
|
||
9 years ago
|
type: object
|
||
9 years ago
|
description: |-
|
||
9 years ago
|
Updates to rooms.
|
||
|
properties:
|
||
9 years ago
|
join:
|
||
9 years ago
|
title: Joined Rooms
|
||
9 years ago
|
type: object
|
||
9 years ago
|
description: |-
|
||
|
The rooms that the user has joined.
|
||
9 years ago
|
additionalProperties:
|
||
9 years ago
|
title: Joined Room
|
||
9 years ago
|
type: object
|
||
|
properties:
|
||
|
state:
|
||
9 years ago
|
title: State
|
||
|
type: object
|
||
9 years ago
|
description: |-
|
||
9 years ago
|
Updates to the state, between the time indicated by
|
||
|
the ``since`` parameter, and the start of the
|
||
|
``timeline`` (or all state up to the start of the
|
||
|
``timeline``, if ``since`` is not given, or
|
||
|
``full_state`` is true).
|
||
9 years ago
|
allOf:
|
||
9 years ago
|
- $ref: "definitions/event_batch.json"
|
||
9 years ago
|
timeline:
|
||
9 years ago
|
title: Timeline
|
||
|
type: object
|
||
9 years ago
|
description: |-
|
||
|
The timeline of messages and state changes in the
|
||
|
room.
|
||
|
allOf:
|
||
|
- $ref: "definitions/timeline_batch.json"
|
||
|
ephemeral:
|
||
9 years ago
|
title: Ephemeral
|
||
|
type: object
|
||
9 years ago
|
description: |-
|
||
|
The ephemeral events in the room that aren't
|
||
|
recorded in the timeline or state of the room.
|
||
|
e.g. typing.
|
||
|
allOf:
|
||
|
- $ref: "definitions/event_batch.json"
|
||
9 years ago
|
account_data:
|
||
9 years ago
|
title: Account Data
|
||
9 years ago
|
type: object
|
||
|
description: |-
|
||
|
The private data that this user has attached to
|
||
|
this room.
|
||
|
allOf:
|
||
|
- $ref: "definitions/event_batch.json"
|
||
9 years ago
|
invite:
|
||
9 years ago
|
title: Invited Rooms
|
||
9 years ago
|
type: object
|
||
|
description: |-
|
||
|
The rooms that the user has been invited to.
|
||
|
additionalProperties:
|
||
9 years ago
|
title: Invited Room
|
||
9 years ago
|
type: object
|
||
9 years ago
|
properties:
|
||
|
invite_state:
|
||
9 years ago
|
title: InviteState
|
||
|
type: object
|
||
9 years ago
|
description: |-
|
||
|
The state of a room that the user has been invited
|
||
9 years ago
|
to. These state events may only have the ``sender``,
|
||
9 years ago
|
``type``, ``state_key`` and ``content`` keys
|
||
|
present. These events do not replace any state that
|
||
|
the client already has for the room, for example if
|
||
|
the client has archived the room. Instead the
|
||
|
client should keep two separate copies of the
|
||
|
state: the one from the ``invite_state`` and one
|
||
|
from the archived ``state``. If the client joins
|
||
|
the room then the current state will be given as a
|
||
|
delta against the archived ``state`` not the
|
||
|
``invite_state``.
|
||
|
allOf:
|
||
|
- $ref: "definitions/event_batch.json"
|
||
9 years ago
|
leave:
|
||
|
title: Left rooms
|
||
9 years ago
|
type: object
|
||
|
description: |-
|
||
9 years ago
|
The rooms that the user has left or been banned from.
|
||
9 years ago
|
additionalProperties:
|
||
9 years ago
|
title: Left Room
|
||
9 years ago
|
type: object
|
||
|
properties:
|
||
|
state:
|
||
9 years ago
|
title: State
|
||
|
type: object
|
||
9 years ago
|
description: |-
|
||
9 years ago
|
The state updates for the room up to the start of the timeline.
|
||
9 years ago
|
allOf:
|
||
9 years ago
|
- $ref: "definitions/event_batch.json"
|
||
9 years ago
|
timeline:
|
||
9 years ago
|
title: Timeline
|
||
|
type: object
|
||
9 years ago
|
description: |-
|
||
|
The timeline of messages and state changes in the
|
||
|
room up to the point when the user left.
|
||
|
allOf:
|
||
|
- $ref: "definitions/timeline_batch.json"
|
||
9 years ago
|
presence:
|
||
9 years ago
|
title: Presence
|
||
|
type: object
|
||
9 years ago
|
description: |-
|
||
9 years ago
|
The updates to the presence status of other users.
|
||
9 years ago
|
allOf:
|
||
|
- $ref: "definitions/event_batch.json"
|
||
|
examples:
|
||
|
application/json: |-
|
||
|
{
|
||
|
"next_batch": "s72595_4483_1934",
|
||
9 years ago
|
"presence": {
|
||
9 years ago
|
"events": [
|
||
|
{
|
||
|
"sender": "@alice:example.com",
|
||
|
"type": "m.presence",
|
||
|
"content": {"presence": "online"}
|
||
|
}
|
||
|
]
|
||
|
},
|
||
9 years ago
|
"account_data": {
|
||
9 years ago
|
"events": [
|
||
|
{
|
||
|
"type": "org.example.custom.config",
|
||
|
"content": {
|
||
|
"custom_config_key": "custom_config_value"
|
||
|
}
|
||
|
}
|
||
|
]
|
||
|
},
|
||
9 years ago
|
"rooms": {
|
||
9 years ago
|
"join": {
|
||
9 years ago
|
"!726s6s6q:example.com": {
|
||
|
"state": {
|
||
|
"events": [
|
||
9 years ago
|
{
|
||
9 years ago
|
"sender": "@alice:example.com",
|
||
|
"type": "m.room.member",
|
||
|
"state_key": "@alice:example.com",
|
||
|
"content": {"membership": "join"},
|
||
|
"origin_server_ts": 1417731086795,
|
||
|
"event_id": "$66697273743031:example.com"
|
||
|
}
|
||
9 years ago
|
]
|
||
|
},
|
||
|
"timeline": {
|
||
|
"events": [
|
||
9 years ago
|
{
|
||
|
"sender": "@bob:example.com",
|
||
|
"type": "m.room.member",
|
||
|
"state_key": "@bob:example.com",
|
||
|
"content": {"membership": "join"},
|
||
|
"prev_content": {"membership": "invite"},
|
||
|
"origin_server_ts": 1417731086795,
|
||
9 years ago
|
"event_id": "$7365636s6r6432:example.com"
|
||
9 years ago
|
},
|
||
|
{
|
||
|
"sender": "@alice:example.com",
|
||
|
"type": "m.room.message",
|
||
|
"age": 124524,
|
||
|
"txn_id": "1234",
|
||
|
"content": {
|
||
|
"body": "I am a fish",
|
||
|
"msgtype": "m.text"
|
||
|
},
|
||
|
"origin_server_ts": 1417731086797,
|
||
|
"event_id": "$74686972643033:example.com"
|
||
|
}
|
||
9 years ago
|
],
|
||
|
"limited": true,
|
||
|
"prev_batch": "t34-23535_0_0"
|
||
|
},
|
||
|
"ephemeral": {
|
||
|
"events": [
|
||
|
{
|
||
|
"type": "m.typing",
|
||
|
"content": {"user_ids": ["@alice:example.com"]}
|
||
|
}
|
||
|
]
|
||
9 years ago
|
},
|
||
9 years ago
|
"account_data": {
|
||
9 years ago
|
"events": [
|
||
|
{
|
||
9 years ago
|
"type": "m.tag",
|
||
9 years ago
|
"content": {"tags": {"work": {"order": 1}}}
|
||
9 years ago
|
},
|
||
|
{
|
||
|
"type": "org.example.custom.room.config",
|
||
|
"content": {
|
||
|
"custom_config_key": "custom_config_value"
|
||
|
}
|
||
9 years ago
|
}
|
||
|
]
|
||
9 years ago
|
}
|
||
9 years ago
|
}
|
||
9 years ago
|
},
|
||
9 years ago
|
"invite": {
|
||
9 years ago
|
"!696r7674:example.com": {
|
||
|
"invite_state": {
|
||
|
"events": [
|
||
|
{
|
||
|
"sender": "@alice:example.com",
|
||
|
"type": "m.room.name",
|
||
|
"state_key": "",
|
||
|
"content": {"name": "My Room Name"}
|
||
|
},
|
||
|
{
|
||
|
"sender": "@alice:example.com",
|
||
|
"type": "m.room.member",
|
||
|
"state_key": "@bob:example.com",
|
||
|
"content": {"membership": "invite"}
|
||
|
}
|
||
|
]
|
||
|
}
|
||
|
}
|
||
|
},
|
||
9 years ago
|
"leave": {}
|
||
9 years ago
|
}
|
||
9 years ago
|
}
|