|
|
|
# Copyright 2016 OpenMarket Ltd
|
|
|
|
#
|
|
|
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
# you may not use this file except in compliance with the License.
|
|
|
|
# You may obtain a copy of the License at
|
|
|
|
#
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
#
|
|
|
|
# Unless required by applicable law or agreed to in writing, software
|
|
|
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
# See the License for the specific language governing permissions and
|
|
|
|
# limitations under the License.
|
|
|
|
swagger: '2.0'
|
|
|
|
info:
|
|
|
|
title: "Matrix Client-Server state event send API"
|
|
|
|
version: "1.0.0"
|
|
|
|
host: localhost:8008
|
|
|
|
schemes:
|
|
|
|
- https
|
|
|
|
- http
|
|
|
|
basePath: /_matrix/client/%CLIENT_MAJOR_VERSION%
|
|
|
|
consumes:
|
|
|
|
- application/json
|
|
|
|
produces:
|
|
|
|
- application/json
|
|
|
|
securityDefinitions:
|
|
|
|
$ref: definitions/security.yaml
|
|
|
|
paths:
|
|
|
|
"/rooms/{roomId}/state/{eventType}/{stateKey}":
|
|
|
|
put:
|
|
|
|
summary: Send a state event to the given room.
|
|
|
|
description: |
|
|
|
|
State events can be sent using this endpoint. These events will be
|
|
|
|
overwritten if ``<room id>``, ``<event type>`` and ``<state key>`` all
|
|
|
|
match.
|
|
|
|
|
|
|
|
Requests to this endpoint **cannot use transaction IDs**
|
|
|
|
like other ``PUT`` paths because they cannot be differentiated from the
|
|
|
|
``state_key``. Furthermore, ``POST`` is unsupported on state paths.
|
|
|
|
|
|
|
|
The body of the request should be the content object of the event; the
|
|
|
|
fields in this object will vary depending on the type of event. See
|
|
|
|
`Room Events`_ for the ``m.`` event specification.
|
|
|
|
operationId: setRoomStateWithKey
|
|
|
|
security:
|
|
|
|
- accessToken: []
|
|
|
|
parameters:
|
|
|
|
- in: path
|
|
|
|
type: string
|
|
|
|
name: roomId
|
|
|
|
description: The room to set the state in
|
|
|
|
required: true
|
|
|
|
x-example: "!636q39766251:example.com"
|
|
|
|
- in: path
|
|
|
|
type: string
|
|
|
|
name: eventType
|
|
|
|
description: The type of event to send.
|
|
|
|
required: true
|
|
|
|
x-example: "m.room.member"
|
|
|
|
- in: path
|
|
|
|
type: string
|
|
|
|
name: stateKey
|
|
|
|
description: The state_key for the state to send. Defaults to the empty string.
|
|
|
|
required: true
|
|
|
|
x-example: "@alice:example.com"
|
|
|
|
- in: body
|
|
|
|
name: body
|
|
|
|
schema:
|
|
|
|
type: object
|
|
|
|
example: {
|
|
|
|
"membership": "join",
|
|
|
|
"avatar_url": "mxc://localhost/SEsfnsuifSDFSSEF#auto",
|
|
|
|
"displayname": "Alice Margatroid"
|
|
|
|
}
|
|
|
|
responses:
|
|
|
|
200:
|
|
|
|
description: "An ID for the sent event."
|
|
|
|
examples:
|
|
|
|
application/json: {
|
|
|
|
"event_id": "YUwRidLecu"
|
|
|
|
}
|
|
|
|
schema:
|
|
|
|
type: object
|
|
|
|
properties:
|
|
|
|
event_id:
|
|
|
|
type: string
|
|
|
|
description: |-
|
|
|
|
A unique identifier for the event.
|
|
|
|
tags:
|
|
|
|
- Room participation
|
|
|
|
"/rooms/{roomId}/state/{eventType}":
|
|
|
|
put:
|
|
|
|
summary: Send a state event to the given room.
|
|
|
|
description: |
|
|
|
|
State events can be sent using this endpoint. This endpoint is
|
|
|
|
equivalent to calling `/rooms/{roomId}/state/{eventType}/{stateKey}`
|
|
|
|
with an empty `stateKey`. Previous state events with matching
|
|
|
|
`<roomId>` and `<eventType>`, and empty `<stateKey>`, will be overwritten.
|
|
|
|
|
|
|
|
Requests to this endpoint **cannot use transaction IDs**
|
|
|
|
like other ``PUT`` paths because they cannot be differentiated from the
|
|
|
|
``state_key``. Furthermore, ``POST`` is unsupported on state paths.
|
|
|
|
|
|
|
|
The body of the request should be the content object of the event; the
|
|
|
|
fields in this object will vary depending on the type of event. See
|
|
|
|
`Room Events`_ for the ``m.`` event specification.
|
|
|
|
operationId: setRoomState
|
|
|
|
security:
|
|
|
|
- accessToken: []
|
|
|
|
parameters:
|
|
|
|
- in: path
|
|
|
|
type: string
|
|
|
|
name: roomId
|
|
|
|
description: The room to set the state in
|
|
|
|
required: true
|
|
|
|
x-example: "!636q39766251:example.com"
|
|
|
|
- in: path
|
|
|
|
type: string
|
|
|
|
name: eventType
|
|
|
|
description: The type of event to send.
|
|
|
|
required: true
|
|
|
|
x-example: "m.room.name"
|
|
|
|
- in: body
|
|
|
|
name: body
|
|
|
|
schema:
|
|
|
|
type: object
|
|
|
|
example: {
|
|
|
|
"name": "New name for the room"
|
|
|
|
}
|
|
|
|
responses:
|
|
|
|
200:
|
|
|
|
description: "An ID for the sent event."
|
|
|
|
examples:
|
|
|
|
application/json: {
|
|
|
|
"event_id": "YUwRidLecu"
|
|
|
|
}
|
|
|
|
schema:
|
|
|
|
type: object
|
|
|
|
properties:
|
|
|
|
event_id:
|
|
|
|
type: string
|
|
|
|
description: |-
|
|
|
|
A unique identifier for the event.
|
|
|
|
tags:
|
|
|
|
- Room participation
|