2016-07-12 16:22:33 +00:00
|
|
|
# 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-06-02 14:10:44 +00:00
|
|
|
swagger: '2.0'
|
|
|
|
info:
|
2015-12-04 11:09:35 +00:00
|
|
|
title: "Matrix Client-Server Presence API"
|
2015-06-02 14:10:44 +00:00
|
|
|
version: "1.0.0"
|
|
|
|
host: localhost:8008
|
|
|
|
schemes:
|
|
|
|
- https
|
|
|
|
- http
|
2015-12-04 11:09:35 +00:00
|
|
|
basePath: /_matrix/client/%CLIENT_MAJOR_VERSION%
|
2015-06-02 14:10:44 +00:00
|
|
|
consumes:
|
|
|
|
- application/json
|
|
|
|
produces:
|
|
|
|
- application/json
|
|
|
|
securityDefinitions:
|
2016-05-03 12:57:16 +00:00
|
|
|
$ref: definitions/security.yaml
|
2015-06-02 14:10:44 +00:00
|
|
|
paths:
|
|
|
|
"/presence/{userId}/status":
|
|
|
|
put:
|
|
|
|
summary: Update this user's presence state.
|
|
|
|
description: |-
|
2015-06-02 15:01:26 +00:00
|
|
|
This API sets the given user's presence state. When setting the status,
|
|
|
|
the activity time is updated to reflect that activity; the client does
|
|
|
|
not need to specify the ``last_active_ago`` field. You cannot set the
|
|
|
|
presence state of another user.
|
2017-08-02 23:19:34 +00:00
|
|
|
operationId: setPresence
|
2015-06-02 14:10:44 +00:00
|
|
|
security:
|
|
|
|
- accessToken: []
|
|
|
|
parameters:
|
|
|
|
- in: path
|
|
|
|
type: string
|
|
|
|
name: userId
|
|
|
|
description: The user whose presence state to update.
|
|
|
|
required: true
|
|
|
|
x-example: "@alice:example.com"
|
|
|
|
- in: body
|
|
|
|
name: presenceState
|
|
|
|
description: The updated presence state.
|
|
|
|
required: true
|
|
|
|
schema:
|
|
|
|
type: object
|
2017-09-26 16:53:28 +00:00
|
|
|
example: {
|
2015-06-02 14:10:44 +00:00
|
|
|
"presence": "online",
|
|
|
|
"status_msg": "I am here."
|
|
|
|
}
|
|
|
|
properties:
|
|
|
|
presence:
|
|
|
|
type: string
|
2016-02-23 09:00:55 +00:00
|
|
|
enum: ["online", "offline", "unavailable"]
|
2015-06-02 14:10:44 +00:00
|
|
|
description: The new presence state.
|
|
|
|
status_msg:
|
|
|
|
type: string
|
|
|
|
description: "The status message to attach to this state."
|
|
|
|
required: ["presence"]
|
|
|
|
responses:
|
|
|
|
200:
|
|
|
|
description: The new presence state was set.
|
|
|
|
examples:
|
2017-09-26 16:53:28 +00:00
|
|
|
application/json: {
|
|
|
|
}
|
2015-06-02 14:10:44 +00:00
|
|
|
schema:
|
|
|
|
type: object # empty json object
|
|
|
|
429:
|
|
|
|
description: This request was rate-limited.
|
|
|
|
schema:
|
2018-07-04 19:45:34 +00:00
|
|
|
"$ref": "definitions/errors/rate_limited.yaml"
|
2015-12-07 12:45:13 +00:00
|
|
|
tags:
|
|
|
|
- Presence
|
2015-06-02 14:10:44 +00:00
|
|
|
get:
|
|
|
|
summary: Get this user's presence state.
|
|
|
|
description: |-
|
|
|
|
Get the given user's presence state.
|
2017-08-02 23:19:34 +00:00
|
|
|
operationId: getPresence
|
2018-07-04 18:23:51 +00:00
|
|
|
security:
|
|
|
|
- accessToken: []
|
2015-06-02 14:10:44 +00:00
|
|
|
parameters:
|
|
|
|
- in: path
|
|
|
|
type: string
|
|
|
|
name: userId
|
|
|
|
description: The user whose presence state to get.
|
|
|
|
required: true
|
|
|
|
x-example: "@alice:example.com"
|
|
|
|
responses:
|
|
|
|
200:
|
|
|
|
description: The presence state for this user.
|
|
|
|
examples:
|
2017-09-26 16:53:28 +00:00
|
|
|
application/json: {
|
2015-06-02 14:10:44 +00:00
|
|
|
"presence": "unavailable",
|
2015-12-01 17:23:58 +00:00
|
|
|
"last_active_ago": 420845
|
2015-06-02 14:10:44 +00:00
|
|
|
}
|
|
|
|
schema:
|
|
|
|
type: object
|
|
|
|
properties:
|
|
|
|
presence:
|
|
|
|
type: string
|
2016-02-23 09:00:55 +00:00
|
|
|
enum: ["online", "offline", "unavailable"]
|
2015-06-02 14:10:44 +00:00
|
|
|
description: This user's presence.
|
|
|
|
last_active_ago:
|
|
|
|
type: integer
|
|
|
|
description: |-
|
|
|
|
The length of time in milliseconds since an action was performed
|
|
|
|
by this user.
|
|
|
|
status_msg:
|
2015-09-18 13:40:48 +00:00
|
|
|
type: [string, "null"]
|
2015-06-02 14:10:44 +00:00
|
|
|
description: The state message for this user if one was set.
|
2016-06-29 09:35:31 +00:00
|
|
|
currently_active:
|
|
|
|
type: boolean
|
|
|
|
description: "Whether the user is currently active"
|
|
|
|
required: ["presence"]
|
2015-06-02 14:10:44 +00:00
|
|
|
404:
|
|
|
|
description: |-
|
|
|
|
There is no presence state for this user. This user may not exist or
|
|
|
|
isn't exposing presence information to you.
|
2018-07-12 15:31:50 +00:00
|
|
|
schema:
|
|
|
|
"$ref": "definitions/errors/error.yaml"
|
2018-07-04 20:37:21 +00:00
|
|
|
403:
|
|
|
|
description: You are not allowed to see this user's presence status.
|
|
|
|
examples:
|
|
|
|
application/json: {
|
|
|
|
"errcode": "M_FORBIDDEN",
|
|
|
|
"error": "You are not allowed to see their presence"
|
|
|
|
}
|
|
|
|
schema:
|
2018-07-12 15:31:50 +00:00
|
|
|
"$ref": "definitions/errors/error.yaml"
|
2015-12-07 12:45:13 +00:00
|
|
|
tags:
|
|
|
|
- Presence
|