Merge pull request #1554 from turt2live/travis/general/appservice-directories
Application service room directories (and other third party network things)pull/1552/head
commit
97508d5dc5
@ -0,0 +1,267 @@
|
|||||||
|
# Copyright 2018 New Vector 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 Application Service API"
|
||||||
|
version: "1.0.0"
|
||||||
|
host: localhost:8008
|
||||||
|
schemes:
|
||||||
|
- https
|
||||||
|
- http
|
||||||
|
basePath: "/"
|
||||||
|
consumes:
|
||||||
|
- application/json
|
||||||
|
produces:
|
||||||
|
- application/json
|
||||||
|
paths:
|
||||||
|
"/_matrix/app/unstable/thirdparty/protocol/{protocol}":
|
||||||
|
get:
|
||||||
|
summary: Retrieve metadata about a specific protocol that the application service supports.
|
||||||
|
description: |-
|
||||||
|
This API is called by the homeserver when it wants to present clients
|
||||||
|
with specific information about the various third party networks that
|
||||||
|
an application service supports.
|
||||||
|
operationId: getProtocolMetadata
|
||||||
|
parameters:
|
||||||
|
- in: path
|
||||||
|
name: protocol
|
||||||
|
type: string
|
||||||
|
description: The protocol ID.
|
||||||
|
required: true
|
||||||
|
x-example: "irc"
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
description: The protocol was found and metadata returned.
|
||||||
|
schema:
|
||||||
|
$ref: definitions/protocol_metadata.yaml
|
||||||
|
401:
|
||||||
|
description: |-
|
||||||
|
The homeserver has not supplied credentials to the application service.
|
||||||
|
Optional error information can be included in the body of this response.
|
||||||
|
examples:
|
||||||
|
application/json: {
|
||||||
|
"errcode": "COM.EXAMPLE.MYAPPSERVICE_UNAUTHORIZED"
|
||||||
|
}
|
||||||
|
schema:
|
||||||
|
$ref: ../client-server/definitions/errors/error.yaml
|
||||||
|
403:
|
||||||
|
description: |-
|
||||||
|
The credentials supplied by the homeserver were rejected.
|
||||||
|
examples:
|
||||||
|
application/json: {
|
||||||
|
"errcode": "COM.EXAMPLE.MYAPPSERVICE_FORBIDDEN"
|
||||||
|
}
|
||||||
|
schema:
|
||||||
|
$ref: ../client-server/definitions/errors/error.yaml
|
||||||
|
404:
|
||||||
|
description: No protocol was found with the given path.
|
||||||
|
examples:
|
||||||
|
application/json: {
|
||||||
|
"errcode": "COM.EXAMPLE.MYAPPSERVICE_NOT_FOUND"
|
||||||
|
}
|
||||||
|
schema:
|
||||||
|
$ref: ../client-server/definitions/errors/error.yaml
|
||||||
|
"/_matrix/app/unstable/thirdparty/user/{protocol}":
|
||||||
|
get:
|
||||||
|
summary: Retrieve the Matrix User ID of a corresponding third party user.
|
||||||
|
description: |-
|
||||||
|
This API is called by the homeserver in order to retrieve a Matrix
|
||||||
|
User ID linked to a user on the third party network, given a set of
|
||||||
|
user parameters.
|
||||||
|
operationId: queryUserByProtocol
|
||||||
|
parameters:
|
||||||
|
- in: path
|
||||||
|
name: protocol
|
||||||
|
type: string
|
||||||
|
description: The protocol ID.
|
||||||
|
required: true
|
||||||
|
x-example: irc
|
||||||
|
- in: query
|
||||||
|
name: fields...
|
||||||
|
type: string
|
||||||
|
description: |-
|
||||||
|
One or more custom fields that are passed to the application
|
||||||
|
service to help identify the user.
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
description: The Matrix User IDs found with the given parameters.
|
||||||
|
schema:
|
||||||
|
$ref: definitions/user_batch.yaml
|
||||||
|
401:
|
||||||
|
description: |-
|
||||||
|
The homeserver has not supplied credentials to the application service.
|
||||||
|
Optional error information can be included in the body of this response.
|
||||||
|
examples:
|
||||||
|
application/json: {
|
||||||
|
"errcode": "COM.EXAMPLE.MYAPPSERVICE_UNAUTHORIZED"
|
||||||
|
}
|
||||||
|
schema:
|
||||||
|
$ref: ../client-server/definitions/errors/error.yaml
|
||||||
|
403:
|
||||||
|
description: |-
|
||||||
|
The credentials supplied by the homeserver were rejected.
|
||||||
|
examples:
|
||||||
|
application/json: {
|
||||||
|
"errcode": "COM.EXAMPLE.MYAPPSERVICE_FORBIDDEN"
|
||||||
|
}
|
||||||
|
schema:
|
||||||
|
$ref: ../client-server/definitions/errors/error.yaml
|
||||||
|
404:
|
||||||
|
description: No users were found with the given parameters.
|
||||||
|
examples:
|
||||||
|
application/json: {
|
||||||
|
"errcode": "COM.EXAMPLE.MYAPPSERVICE_NOT_FOUND"
|
||||||
|
}
|
||||||
|
schema:
|
||||||
|
$ref: ../client-server/definitions/errors/error.yaml
|
||||||
|
"/_matrix/app/unstable/thirdparty/location/{protocol}":
|
||||||
|
get:
|
||||||
|
summary: Retrieve Matrix-side portal rooms leading to a third party location.
|
||||||
|
description: |-
|
||||||
|
Retrieve a list of Matrix portal rooms that lead to the matched third party location.
|
||||||
|
operationId: queryLocationByProtocol
|
||||||
|
parameters:
|
||||||
|
- in: path
|
||||||
|
name: protocol
|
||||||
|
type: string
|
||||||
|
description: The protocol ID.
|
||||||
|
required: true
|
||||||
|
x-example: irc
|
||||||
|
- in: query
|
||||||
|
name: fields...
|
||||||
|
type: string
|
||||||
|
description: |-
|
||||||
|
One or more custom fields that are passed to the application
|
||||||
|
service to help identify the third party location.
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
description: At least one portal room was found.
|
||||||
|
schema:
|
||||||
|
$ref: definitions/location_batch.yaml
|
||||||
|
401:
|
||||||
|
description: |-
|
||||||
|
The homeserver has not supplied credentials to the application service.
|
||||||
|
Optional error information can be included in the body of this response.
|
||||||
|
examples:
|
||||||
|
application/json: {
|
||||||
|
"errcode": "COM.EXAMPLE.MYAPPSERVICE_UNAUTHORIZED"
|
||||||
|
}
|
||||||
|
schema:
|
||||||
|
$ref: ../client-server/definitions/errors/error.yaml
|
||||||
|
403:
|
||||||
|
description: |-
|
||||||
|
The credentials supplied by the homeserver were rejected.
|
||||||
|
examples:
|
||||||
|
application/json: {
|
||||||
|
"errcode": "COM.EXAMPLE.MYAPPSERVICE_FORBIDDEN"
|
||||||
|
}
|
||||||
|
schema:
|
||||||
|
$ref: ../client-server/definitions/errors/error.yaml
|
||||||
|
404:
|
||||||
|
description: No mappings were found with the given parameters.
|
||||||
|
examples:
|
||||||
|
application/json: {
|
||||||
|
"errcode": "COM.EXAMPLE.MYAPPSERVICE_NOT_FOUND"
|
||||||
|
}
|
||||||
|
schema:
|
||||||
|
$ref: ../client-server/definitions/errors/error.yaml
|
||||||
|
"/_matrix/app/unstable/thirdparty/location":
|
||||||
|
get:
|
||||||
|
summary: Reverse-lookup third party locations given a Matrix room alias.
|
||||||
|
description: |-
|
||||||
|
Retrieve an array of third party network locations from a Matrix room
|
||||||
|
alias.
|
||||||
|
operationId: queryLocationByAlias
|
||||||
|
parameters:
|
||||||
|
- in: query
|
||||||
|
name: alias
|
||||||
|
type: string
|
||||||
|
description: The Matrix room alias to look up.
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
description: |-
|
||||||
|
All found third party locations.
|
||||||
|
schema:
|
||||||
|
$ref: definitions/location_batch.yaml
|
||||||
|
401:
|
||||||
|
description: |-
|
||||||
|
The homeserver has not supplied credentials to the application service.
|
||||||
|
Optional error information can be included in the body of this response.
|
||||||
|
examples:
|
||||||
|
application/json: {
|
||||||
|
"errcode": "COM.EXAMPLE.MYAPPSERVICE_UNAUTHORIZED"
|
||||||
|
}
|
||||||
|
schema:
|
||||||
|
$ref: ../client-server/definitions/errors/error.yaml
|
||||||
|
403:
|
||||||
|
description: |-
|
||||||
|
The credentials supplied by the homeserver were rejected.
|
||||||
|
examples:
|
||||||
|
application/json: {
|
||||||
|
"errcode": "COM.EXAMPLE.MYAPPSERVICE_FORBIDDEN"
|
||||||
|
}
|
||||||
|
schema:
|
||||||
|
$ref: ../client-server/definitions/errors/error.yaml
|
||||||
|
404:
|
||||||
|
description: No mappings were found with the given parameters.
|
||||||
|
examples:
|
||||||
|
application/json: {
|
||||||
|
"errcode": "COM.EXAMPLE.MYAPPSERVICE_NOT_FOUND"
|
||||||
|
}
|
||||||
|
schema:
|
||||||
|
$ref: ../client-server/definitions/errors/error.yaml
|
||||||
|
"/_matrix/app/unstable/thirdparty/user":
|
||||||
|
get:
|
||||||
|
summary: Reverse-lookup third party users given a Matrix User ID.
|
||||||
|
description: |-
|
||||||
|
Retrieve an array of third party users from a Matrix User ID.
|
||||||
|
operationId: queryUserByID
|
||||||
|
parameters:
|
||||||
|
- in: query
|
||||||
|
name: userid
|
||||||
|
type: string
|
||||||
|
description: The Matrix User ID to look up.
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
description: |-
|
||||||
|
An array of third party users.
|
||||||
|
schema:
|
||||||
|
$ref: definitions/user_batch.yaml
|
||||||
|
401:
|
||||||
|
description: |-
|
||||||
|
The homeserver has not supplied credentials to the application service.
|
||||||
|
Optional error information can be included in the body of this response.
|
||||||
|
examples:
|
||||||
|
application/json: {
|
||||||
|
"errcode": "COM.EXAMPLE.MYAPPSERVICE_UNAUTHORIZED"
|
||||||
|
}
|
||||||
|
schema:
|
||||||
|
$ref: ../client-server/definitions/errors/error.yaml
|
||||||
|
403:
|
||||||
|
description: |-
|
||||||
|
The credentials supplied by the homeserver were rejected.
|
||||||
|
examples:
|
||||||
|
application/json: {
|
||||||
|
"errcode": "COM.EXAMPLE.MYAPPSERVICE_UNAUTHORIZED"
|
||||||
|
}
|
||||||
|
schema:
|
||||||
|
$ref: ../client-server/definitions/errors/error.yaml
|
||||||
|
404:
|
||||||
|
description: No mappings were found with the given parameters.
|
||||||
|
examples:
|
||||||
|
application/json: {
|
||||||
|
"errcode": "COM.EXAMPLE.MYAPPSERVICE_NOT_FOUND"
|
||||||
|
}
|
||||||
|
schema:
|
||||||
|
$ref: ../client-server/definitions/errors/error.yaml
|
@ -0,0 +1,87 @@
|
|||||||
|
# Copyright 2018 New Vector 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 Application Service Room Directory API"
|
||||||
|
version: "1.0.0"
|
||||||
|
host: localhost:8008
|
||||||
|
schemes:
|
||||||
|
- https
|
||||||
|
- http
|
||||||
|
basePath: /_matrix/client/%CLIENT_MAJOR_VERSION%
|
||||||
|
consumes:
|
||||||
|
- application/json
|
||||||
|
produces:
|
||||||
|
- application/json
|
||||||
|
securityDefinitions:
|
||||||
|
# Note: this is the same access_token definition used elsewhere in the client
|
||||||
|
# server API, however this expects an access token for an application service.
|
||||||
|
$ref: definitions/security.yaml
|
||||||
|
paths:
|
||||||
|
"/directory/list/appservice/{networkId}/{roomId}":
|
||||||
|
put:
|
||||||
|
summary: |-
|
||||||
|
Updates a room's visibility in the application service's room directory.
|
||||||
|
description: |-
|
||||||
|
Updates the visibility of a given room on the application service's room
|
||||||
|
directory.
|
||||||
|
|
||||||
|
This API is similar to the room directory visibility API used by clients
|
||||||
|
to update the homeserver's more general room directory.
|
||||||
|
|
||||||
|
This API requires the use of an application service access token (``as_token``)
|
||||||
|
instead of a typical client's access_token. This API cannot be invoked by
|
||||||
|
users who are not identified as application services.
|
||||||
|
operationId: updateAppserviceRoomDirectoryVsibility
|
||||||
|
parameters:
|
||||||
|
- in: path
|
||||||
|
type: string
|
||||||
|
name: networkId
|
||||||
|
description: |-
|
||||||
|
The protocol (network) ID to update the room list for. This would
|
||||||
|
have been provided by the application service as being listed as
|
||||||
|
a supported protocol.
|
||||||
|
required: true
|
||||||
|
x-example: "irc"
|
||||||
|
- in: path
|
||||||
|
type: string
|
||||||
|
name: roomId
|
||||||
|
description: The room ID to add to the directory.
|
||||||
|
required: true
|
||||||
|
x-example: "!somewhere:domain.com"
|
||||||
|
- in: body
|
||||||
|
name: body
|
||||||
|
schema:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
visibility:
|
||||||
|
type: enum
|
||||||
|
enum: ["public", "private"]
|
||||||
|
description: |-
|
||||||
|
Whether the room should be visible (public) in the directory
|
||||||
|
or not (private).
|
||||||
|
example: "public"
|
||||||
|
required: ['visibility']
|
||||||
|
security:
|
||||||
|
# again, this is the appservice's token - not a typical client's
|
||||||
|
- accessToken: []
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
description: The room's directory visibility has been updated.
|
||||||
|
schema:
|
||||||
|
type: object
|
||||||
|
examples:
|
||||||
|
application/json: {}
|
||||||
|
tags:
|
||||||
|
- Application service room directory management
|
@ -0,0 +1 @@
|
|||||||
|
Add third party network room directories, as provided by application services.
|
Loading…
Reference in New Issue