|
|
|
# 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 Event Context 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}/context/{eventId}":
|
|
|
|
get:
|
|
|
|
summary: Get events and state around the specified event.
|
|
|
|
description: |-
|
|
|
|
This API returns a number of events that happened just before and
|
|
|
|
after the specified event. This allows clients to get the context
|
|
|
|
surrounding an event.
|
|
|
|
security:
|
|
|
|
- accessToken: []
|
|
|
|
parameters:
|
|
|
|
- in: path
|
|
|
|
type: string
|
|
|
|
name: roomId
|
|
|
|
description: The room to get events from.
|
|
|
|
required: true
|
|
|
|
x-example: "!636q39766251:example.com"
|
|
|
|
- in: path
|
|
|
|
type: string
|
|
|
|
name: eventId
|
|
|
|
description: The event to get context around.
|
|
|
|
required: true
|
|
|
|
x-example: "$f3h4d129462ha:example.com"
|
|
|
|
- in: query
|
|
|
|
type: integer
|
|
|
|
name: limit
|
|
|
|
description: |-
|
|
|
|
The maximum number of events to return. Default: 10.
|
|
|
|
x-example: 3
|
|
|
|
responses:
|
|
|
|
200:
|
|
|
|
description: The events and state surrounding the requested event.
|
|
|
|
schema:
|
|
|
|
type: object
|
|
|
|
description: The events and state surrounding the requested event.
|
|
|
|
properties:
|
|
|
|
start:
|
|
|
|
type: string
|
|
|
|
description: |-
|
|
|
|
A token that can be used to paginate backwards with.
|
|
|
|
end:
|
|
|
|
type: string
|
|
|
|
description: |-
|
|
|
|
A token that can be used to paginate forwards with.
|
|
|
|
events_before:
|
|
|
|
type: array
|
|
|
|
description: |-
|
|
|
|
A list of room events that happened just before the
|
|
|
|
requested event, in reverse-chronological order.
|
|
|
|
items:
|
|
|
|
allOf:
|
|
|
|
- "$ref": "definitions/event-schemas/schema/core-event-schema/room_event.yaml"
|
|
|
|
event:
|
|
|
|
description: |-
|
|
|
|
Details of the requested event.
|
|
|
|
allOf:
|
|
|
|
- "$ref": "definitions/event-schemas/schema/core-event-schema/room_event.yaml"
|
|
|
|
events_after:
|
|
|
|
type: array
|
|
|
|
description: |-
|
|
|
|
A list of room events that happened just after the
|
|
|
|
requested event, in chronological order.
|
|
|
|
items:
|
|
|
|
allOf:
|
|
|
|
- "$ref": "definitions/event-schemas/schema/core-event-schema/room_event.yaml"
|
|
|
|
state:
|
|
|
|
type: array
|
|
|
|
description: |-
|
|
|
|
The state of the room at the last event returned.
|
|
|
|
items:
|
|
|
|
allOf:
|
|
|
|
- "$ref": "definitions/event-schemas/schema/core-event-schema/state_event.yaml"
|
|
|
|
examples:
|
|
|
|
application/json: |-
|
|
|
|
{
|
|
|
|
"end": "t29-57_2_0_2",
|
|
|
|
"events_after": [
|
|
|
|
{
|
|
|
|
"age": 91911336,
|
|
|
|
"content": {
|
|
|
|
"body": "7",
|
|
|
|
"msgtype": "m.text"
|
|
|
|
},
|
|
|
|
"event_id": "$14460306086CiUaL:localhost:8480",
|
|
|
|
"origin_server_ts": 1446030608551,
|
|
|
|
"room_id": "!sCDvXTtzjpiPxaqkkt:localhost:8480",
|
|
|
|
"type": "m.room.message",
|
|
|
|
"sender": "@test:localhost:8480"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"events_before": [
|
|
|
|
{
|
|
|
|
"age": 91911903,
|
|
|
|
"content": {
|
|
|
|
"body": "5",
|
|
|
|
"msgtype": "m.text"
|
|
|
|
},
|
|
|
|
"event_id": "$14460306074UYTlh:localhost:8480",
|
|
|
|
"origin_server_ts": 1446030607984,
|
|
|
|
"room_id": "!sCDvXTtzjpiPxaqkkt:localhost:8480",
|
|
|
|
"type": "m.room.message",
|
|
|
|
"sender": "@test:localhost:8480"
|
|
|
|
}
|
|
|
|
],
|
|
|
|
"start": "t27-54_2_0_2",
|
|
|
|
"state": [
|
|
|
|
{
|
|
|
|
"age": 3123715284,
|
|
|
|
"content": {
|
|
|
|
"creator": "@test:localhost:8480"
|
|
|
|
},
|
|
|
|
"event_id": "$14429988040dgQAE:localhost:8480",
|
|
|
|
"origin_server_ts": 1442998804603,
|
|
|
|
"room_id": "!sCDvXTtzjpiPxaqkkt:localhost:8480",
|
|
|
|
"state_key": "",
|
|
|
|
"type": "m.room.create",
|
|
|
|
"sender": "@test:localhost:8480"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"age": 2067105053,
|
|
|
|
"content": {
|
|
|
|
"avatar_url": "mxc://localhost:8480/tVWZTAIIfqtXMZZtmGCkVjTD#auto",
|
|
|
|
"displayname": "Bob2",
|
|
|
|
"membership": "join"
|
|
|
|
},
|
|
|
|
"event_id": "$14440554144URDbf:localhost:8480",
|
|
|
|
"origin_server_ts": 1444055414834,
|
|
|
|
"replaces_state": "$14440552472PgiGk:localhost:8480",
|
|
|
|
"room_id": "!sCDvXTtzjpiPxaqkkt:localhost:8480",
|
|
|
|
"state_key": "@test:localhost:8480",
|
|
|
|
"type": "m.room.member",
|
|
|
|
"sender": "@test:localhost:8480"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
tags:
|
|
|
|
- Room participation
|