Merge branch 'master' into daniel/as
commit
22fdb8f911
@ -0,0 +1,148 @@
|
||||
swagger: '2.0'
|
||||
info:
|
||||
title: "Matrix Client-Server v1 Room Creation 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:
|
||||
"/createRoom":
|
||||
post:
|
||||
summary: Create a new room
|
||||
description: |-
|
||||
Create a new room with various configuration options.
|
||||
security:
|
||||
- accessToken: []
|
||||
parameters:
|
||||
- in: body
|
||||
name: body
|
||||
description: The desired room configuration.
|
||||
schema:
|
||||
type: object
|
||||
example: |-
|
||||
{
|
||||
"preset": "public_chat",
|
||||
"room_alias_name": "thepub",
|
||||
"name": "The Grand Duke Pub",
|
||||
"topic": "All about happy hour",
|
||||
"creation_content": {
|
||||
"m.federate": false
|
||||
}
|
||||
}
|
||||
properties:
|
||||
visibility:
|
||||
type: string
|
||||
enum: ["public", "private"]
|
||||
description: |-
|
||||
A ``public`` visibility indicates that the room will be shown
|
||||
in the published room list. A ``private`` visibility will hide
|
||||
the room from the published room list. Rooms default to
|
||||
``private`` visibility if this key is not included. NB: This
|
||||
should not be confused with ``join_rules`` which also uses the
|
||||
word ``public``.
|
||||
room_alias_name:
|
||||
type: string
|
||||
description: |-
|
||||
The desired room alias **local part**. If this is included, a
|
||||
room alias will be created and mapped to the newly created
|
||||
room. The alias will belong on the *same* home server which
|
||||
created the room. For example, if this was set to "foo" and
|
||||
sent to the homeserver "example.com" the complete room alias
|
||||
would be ``#foo:example.com``.
|
||||
name:
|
||||
type: string
|
||||
description: |-
|
||||
If this is included, an ``m.room.name`` event will be sent
|
||||
into the room to indicate the name of the room. See Room
|
||||
Events for more information on ``m.room.name``.
|
||||
topic:
|
||||
type: string
|
||||
description: |-
|
||||
If this is included, an ``m.room.topic`` event will be sent
|
||||
into the room to indicate the topic for the room. See Room
|
||||
Events for more information on ``m.room.topic``.
|
||||
invite:
|
||||
type: array
|
||||
description: |-
|
||||
A list of user IDs to invite to the room. This will tell the
|
||||
server to invite everyone in the list to the newly created room.
|
||||
items:
|
||||
type: string
|
||||
creation_content:
|
||||
title: CreationContent
|
||||
type: object
|
||||
description: |-
|
||||
Extra keys to be added to the content of the ``m.room.create``.
|
||||
The server will clober the following keys: ``creator``. Future
|
||||
versions of the specification may allow the server to clobber
|
||||
other keys.
|
||||
initial_state:
|
||||
type: array
|
||||
description: |-
|
||||
A list of state events to set in the new room. This allows
|
||||
the user to override the default state events set in the new
|
||||
room. The expected format of the state events are an object
|
||||
with type, state_key and content keys set.
|
||||
Takes precedence over events set by ``presets``, but gets
|
||||
overriden by ``name`` and ``topic`` keys.
|
||||
items:
|
||||
type: object
|
||||
title: StateEvent
|
||||
properties:
|
||||
type:
|
||||
type: string
|
||||
state_key:
|
||||
type: string
|
||||
content:
|
||||
type: string
|
||||
preset:
|
||||
type: string
|
||||
enum: ["private_chat", "public_chat", "trusted_private_chat"]
|
||||
description: |-
|
||||
Convenience parameter for setting various default state events
|
||||
based on a preset. Must be either:
|
||||
|
||||
``private_chat`` =>
|
||||
``join_rules`` is set to ``invite``.
|
||||
``history_visibility`` is set to ``shared``.
|
||||
|
||||
``trusted_private_chat`` =>
|
||||
``join_rules`` is set to ``invite``.
|
||||
``history_visibility`` is set to ``shared``.
|
||||
All invitees are given the same power level as the room creator.
|
||||
|
||||
``public_chat``: =>
|
||||
``join_rules`` is set to ``public``.
|
||||
``history_visibility`` is set to ``shared``.
|
||||
|
||||
responses:
|
||||
200:
|
||||
description: Information about the newly created room.
|
||||
schema:
|
||||
type: object
|
||||
description: Information about the newly created room.
|
||||
properties:
|
||||
room_id:
|
||||
type: string
|
||||
description: |-
|
||||
The created room's ID.
|
||||
examples:
|
||||
application/json: |-
|
||||
{
|
||||
"room_id": "!sefiuhWgwghwWgh:example.com"
|
||||
}
|
||||
400:
|
||||
description: >
|
||||
The request body is malformed or the room alias specified is already taken.
|
@ -0,0 +1,131 @@
|
||||
swagger: '2.0'
|
||||
info:
|
||||
title: "Matrix Client-Server v1 Rooms 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}/messages":
|
||||
get:
|
||||
summary: Get a list of events for this room
|
||||
description: |-
|
||||
This API returns a list of message and state events for a room. It uses
|
||||
pagination query parameters to paginate history in the room.
|
||||
security:
|
||||
- accessToken: []
|
||||
parameters:
|
||||
- in: path
|
||||
type: string
|
||||
name: roomId
|
||||
description: The room to get events from.
|
||||
required: true
|
||||
x-example: "!636q39766251:example.com"
|
||||
- in: query
|
||||
type: string
|
||||
name: from
|
||||
description: |-
|
||||
The token to start returning events from. This token can be obtained
|
||||
from the initial sync API.
|
||||
required: true
|
||||
x-example: "s345_678_333"
|
||||
- in: query
|
||||
type: string
|
||||
enum: ["b", "f"]
|
||||
name: dir
|
||||
description: |-
|
||||
The direction to return events from.
|
||||
required: true
|
||||
x-example: "b"
|
||||
- in: query
|
||||
type: integer
|
||||
name: limit
|
||||
description: |-
|
||||
The maximum number of events to return. Default: 10.
|
||||
x-example: "3"
|
||||
responses:
|
||||
200:
|
||||
description: A list of messages with a new token to request more.
|
||||
schema:
|
||||
type: object
|
||||
description: A list of messages with a new token to request more.
|
||||
properties:
|
||||
start:
|
||||
type: string
|
||||
description: |-
|
||||
The token to start paginating from. If ``dir=b`` this will be
|
||||
the token supplied in ``from``.
|
||||
end:
|
||||
type: string
|
||||
description: |-
|
||||
The token the pagination ends at. If ``dir=b`` this token should
|
||||
be used again to request even earlier events.
|
||||
chunk:
|
||||
type: array
|
||||
description: |-
|
||||
A list of room events.
|
||||
items:
|
||||
type: object
|
||||
title: RoomEvent
|
||||
examples:
|
||||
application/json: |-
|
||||
{
|
||||
"start": "t47429-4392820_219380_26003_2265",
|
||||
"end": "t47409-4357353_219380_26003_2265",
|
||||
"chunk": [
|
||||
{
|
||||
"origin_server_ts": 1444812213737,
|
||||
"user_id": "@alice:example.com",
|
||||
"event_id": "$1444812213350496Caaaa:example.com",
|
||||
"content": {
|
||||
"body": "hello world",
|
||||
"msgtype":"m.text"
|
||||
},
|
||||
"room_id":"!Xq3620DUiqCaoxq:example.com",
|
||||
"type":"m.room.message",
|
||||
"age": 1042
|
||||
},
|
||||
{
|
||||
"origin_server_ts": 1444812194656 ,
|
||||
"user_id": "@bob:example.com",
|
||||
"event_id": "$1444812213350496Cbbbb:example.com",
|
||||
"content": {
|
||||
"body": "the world is big",
|
||||
"msgtype":"m.text"
|
||||
},
|
||||
"room_id":"!Xq3620DUiqCaoxq:example.com",
|
||||
"type":"m.room.message",
|
||||
"age": 20123
|
||||
},
|
||||
{
|
||||
"origin_server_ts": 1444812163990,
|
||||
"user_id": "@bob:example.com",
|
||||
"event_id": "$1444812213350496Ccccc:example.com",
|
||||
"content": {
|
||||
"name": "New room name"
|
||||
},
|
||||
"prev_content": {
|
||||
"name": "Old room name"
|
||||
},
|
||||
"state_key": "",
|
||||
"room_id":"!Xq3620DUiqCaoxq:example.com",
|
||||
"type":"m.room.name",
|
||||
"age": 50789
|
||||
}
|
||||
]
|
||||
}
|
||||
403:
|
||||
description: >
|
||||
You aren't a member of the room.
|
@ -1,5 +1,5 @@
|
||||
Events
|
||||
======
|
||||
Event Structure
|
||||
===============
|
||||
|
||||
All communication in Matrix is expressed in the form of data objects called
|
||||
Events. These are the fundamental building blocks common to the client-server,
|
Loading…
Reference in New Issue