matrix-doc/api/client-server/event_context.yaml

139 lines
5.0 KiB
YAML
Raw Normal View History

# 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.
2015-10-29 12:43:36 +00:00
swagger: '2.0'
info:
2015-12-08 14:01:16 +00:00
title: "Matrix Client-Server Event Context API"
2015-10-29 12:43:36 +00:00
version: "1.0.0"
host: localhost:8008
schemes:
- https
- http
2016-01-08 14:05:04 +00:00
basePath: /_matrix/client/%CLIENT_MAJOR_VERSION%
2015-10-29 12:43:36 +00:00
consumes:
- application/json
produces:
- application/json
securityDefinitions:
$ref: definitions/security.yaml
2015-10-29 12:43:36 +00:00
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
2015-12-07 16:33:48 +00:00
after the specified event. This allows clients to get the context
surrounding an event.
*Note*: This endpoint supports lazy-loading of room member events. See `Filtering <#lazy-loading-room-members>`_
for more information.
operationId: getEventContext
2015-10-29 12:43:36 +00:00
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
2015-12-07 16:32:43 +00:00
x-example: "$f3h4d129462ha:example.com"
2015-10-29 12:43:36 +00:00
- in: query
type: integer
name: limit
description: |-
The maximum number of events to return. Default: 10.
2015-12-08 14:06:59 +00:00
x-example: 3
2015-10-29 12:43:36 +00:00
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.
2015-10-29 12:43:36 +00:00
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"
2015-10-29 12:43:36 +00:00
events_after:
type: array
description: |-
A list of room events that happened just after the
requested event, in chronological order.
2015-10-29 12:43:36 +00:00
items:
allOf:
- "$ref": "definitions/event-schemas/schema/core-event-schema/room_event.yaml"
2015-10-29 12:43:36 +00:00
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"
2015-10-29 12:43:36 +00:00
examples:
application/json: {
"end": "t29-57_2_0_2",
"events_after": [
{
"room_id": "!636q39766251:example.com",
"$ref": "definitions/event-schemas/examples/m.room.message$m.text"
2015-10-29 12:43:36 +00:00
}
],
"event": {
"event_id": "$f3h4d129462ha:example.com",
"room_id": "!636q39766251:example.com",
"$ref": "definitions/event-schemas/examples/m.room.message$m.image"
},
"events_before": [
{
"room_id": "!636q39766251:example.com",
"$ref": "definitions/event-schemas/examples/m.room.message$m.file"
}
],
"start": "t27-54_2_0_2",
"state": [
{
"room_id": "!636q39766251:example.com",
"$ref": "definitions/event-schemas/examples/m.room.create"
},
{
"room_id": "!636q39766251:example.com",
"$ref": "definitions/event-schemas/examples/m.room.member"
}
]
}
2015-12-08 14:07:08 +00:00
tags:
- Room participation