|
|
|
# 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.
|
|
|
|
openapi: 3.1.0
|
|
|
|
info:
|
|
|
|
title: Matrix Application Service API
|
|
|
|
version: 1.0.0
|
|
|
|
paths:
|
|
|
|
"/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
|
|
|
|
security:
|
|
|
|
- homeserverAccessToken: []
|
|
|
|
parameters:
|
|
|
|
- in: path
|
|
|
|
name: protocol
|
|
|
|
description: The protocol ID.
|
|
|
|
required: true
|
|
|
|
example: irc
|
|
|
|
schema:
|
|
|
|
type: string
|
|
|
|
responses:
|
|
|
|
"200":
|
|
|
|
description: The protocol was found and metadata returned.
|
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
|
|
|
$ref: definitions/protocol.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.
|
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
|
|
|
$ref: ../client-server/definitions/errors/error.yaml
|
|
|
|
examples:
|
|
|
|
response:
|
|
|
|
value: {
|
|
|
|
"errcode": "COM.EXAMPLE.MYAPPSERVICE_UNAUTHORIZED"
|
|
|
|
}
|
|
|
|
"403":
|
|
|
|
description: The credentials supplied by the homeserver were rejected.
|
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
|
|
|
$ref: ../client-server/definitions/errors/error.yaml
|
|
|
|
examples:
|
|
|
|
response:
|
|
|
|
value: {
|
|
|
|
"errcode": "COM.EXAMPLE.MYAPPSERVICE_FORBIDDEN"
|
|
|
|
}
|
|
|
|
"404":
|
|
|
|
description: No protocol was found with the given path.
|
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
|
|
|
$ref: ../client-server/definitions/errors/error.yaml
|
|
|
|
examples:
|
|
|
|
response:
|
|
|
|
value: {
|
|
|
|
"errcode": "COM.EXAMPLE.MYAPPSERVICE_NOT_FOUND"
|
|
|
|
}
|
|
|
|
"/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
|
|
|
|
security:
|
|
|
|
- homeserverAccessToken: []
|
|
|
|
parameters:
|
|
|
|
- in: path
|
|
|
|
name: protocol
|
|
|
|
description: The protocol ID.
|
|
|
|
required: true
|
|
|
|
example: irc
|
|
|
|
schema:
|
|
|
|
type: string
|
|
|
|
- in: query
|
|
|
|
name: fields
|
|
|
|
description: |-
|
|
|
|
One or more custom fields that are passed to the application
|
|
|
|
service to help identify the user.
|
|
|
|
schema:
|
|
|
|
type: object
|
|
|
|
additionalProperties:
|
|
|
|
type: string
|
|
|
|
responses:
|
|
|
|
"200":
|
|
|
|
description: The Matrix User IDs found with the given parameters.
|
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
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.
|
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
|
|
|
$ref: ../client-server/definitions/errors/error.yaml
|
|
|
|
examples:
|
|
|
|
response:
|
|
|
|
value: {
|
|
|
|
"errcode": "COM.EXAMPLE.MYAPPSERVICE_UNAUTHORIZED"
|
|
|
|
}
|
|
|
|
"403":
|
|
|
|
description: The credentials supplied by the homeserver were rejected.
|
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
|
|
|
$ref: ../client-server/definitions/errors/error.yaml
|
|
|
|
examples:
|
|
|
|
response:
|
|
|
|
value: {
|
|
|
|
"errcode": "COM.EXAMPLE.MYAPPSERVICE_FORBIDDEN"
|
|
|
|
}
|
|
|
|
"404":
|
|
|
|
description: No users were found with the given parameters.
|
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
|
|
|
$ref: ../client-server/definitions/errors/error.yaml
|
|
|
|
examples:
|
|
|
|
response:
|
|
|
|
value: {
|
|
|
|
"errcode": "COM.EXAMPLE.MYAPPSERVICE_NOT_FOUND"
|
|
|
|
}
|
|
|
|
"/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
|
|
|
|
security:
|
|
|
|
- homeserverAccessToken: []
|
|
|
|
parameters:
|
|
|
|
- in: path
|
|
|
|
name: protocol
|
|
|
|
description: The protocol ID.
|
|
|
|
required: true
|
|
|
|
example: irc
|
|
|
|
schema:
|
|
|
|
type: string
|
|
|
|
- in: query
|
|
|
|
name: fields
|
|
|
|
description: |-
|
|
|
|
One or more custom fields that are passed to the application
|
|
|
|
service to help identify the third-party location.
|
|
|
|
schema:
|
|
|
|
type: object
|
|
|
|
additionalProperties:
|
|
|
|
type: string
|
|
|
|
responses:
|
|
|
|
"200":
|
|
|
|
description: At least one portal room was found.
|
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
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.
|
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
|
|
|
$ref: ../client-server/definitions/errors/error.yaml
|
|
|
|
examples:
|
|
|
|
response:
|
|
|
|
value: {
|
|
|
|
"errcode": "COM.EXAMPLE.MYAPPSERVICE_UNAUTHORIZED"
|
|
|
|
}
|
|
|
|
"403":
|
|
|
|
description: The credentials supplied by the homeserver were rejected.
|
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
|
|
|
$ref: ../client-server/definitions/errors/error.yaml
|
|
|
|
examples:
|
|
|
|
response:
|
|
|
|
value: {
|
|
|
|
"errcode": "COM.EXAMPLE.MYAPPSERVICE_FORBIDDEN"
|
|
|
|
}
|
|
|
|
"404":
|
|
|
|
description: No mappings were found with the given parameters.
|
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
|
|
|
$ref: ../client-server/definitions/errors/error.yaml
|
|
|
|
examples:
|
|
|
|
response:
|
|
|
|
value: {
|
|
|
|
"errcode": "COM.EXAMPLE.MYAPPSERVICE_NOT_FOUND"
|
|
|
|
}
|
|
|
|
/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
|
|
|
|
security:
|
|
|
|
- homeserverAccessToken: []
|
|
|
|
parameters:
|
|
|
|
- in: query
|
|
|
|
name: alias
|
|
|
|
description: The Matrix room alias to look up.
|
|
|
|
schema:
|
|
|
|
type: string
|
|
|
|
responses:
|
|
|
|
"200":
|
|
|
|
description: All found third-party locations.
|
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
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.
|
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
|
|
|
$ref: ../client-server/definitions/errors/error.yaml
|
|
|
|
examples:
|
|
|
|
response:
|
|
|
|
value: {
|
|
|
|
"errcode": "COM.EXAMPLE.MYAPPSERVICE_UNAUTHORIZED"
|
|
|
|
}
|
|
|
|
"403":
|
|
|
|
description: The credentials supplied by the homeserver were rejected.
|
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
|
|
|
$ref: ../client-server/definitions/errors/error.yaml
|
|
|
|
examples:
|
|
|
|
response:
|
|
|
|
value: {
|
|
|
|
"errcode": "COM.EXAMPLE.MYAPPSERVICE_FORBIDDEN"
|
|
|
|
}
|
|
|
|
"404":
|
|
|
|
description: No mappings were found with the given parameters.
|
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
|
|
|
$ref: ../client-server/definitions/errors/error.yaml
|
|
|
|
examples:
|
|
|
|
response:
|
|
|
|
value: {
|
|
|
|
"errcode": "COM.EXAMPLE.MYAPPSERVICE_NOT_FOUND"
|
|
|
|
}
|
|
|
|
/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
|
|
|
|
security:
|
|
|
|
- homeserverAccessToken: []
|
|
|
|
parameters:
|
|
|
|
- in: query
|
|
|
|
name: userid
|
|
|
|
description: The Matrix User ID to look up.
|
|
|
|
schema:
|
|
|
|
type: string
|
|
|
|
responses:
|
|
|
|
"200":
|
|
|
|
description: An array of third-party users.
|
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
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.
|
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
|
|
|
$ref: ../client-server/definitions/errors/error.yaml
|
|
|
|
examples:
|
|
|
|
response:
|
|
|
|
value: {
|
|
|
|
"errcode": "COM.EXAMPLE.MYAPPSERVICE_UNAUTHORIZED"
|
|
|
|
}
|
|
|
|
"403":
|
|
|
|
description: The credentials supplied by the homeserver were rejected.
|
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
|
|
|
$ref: ../client-server/definitions/errors/error.yaml
|
|
|
|
examples:
|
|
|
|
response:
|
|
|
|
value: {
|
|
|
|
"errcode": "COM.EXAMPLE.MYAPPSERVICE_UNAUTHORIZED"
|
|
|
|
}
|
|
|
|
"404":
|
|
|
|
description: No mappings were found with the given parameters.
|
|
|
|
content:
|
|
|
|
application/json:
|
|
|
|
schema:
|
|
|
|
$ref: ../client-server/definitions/errors/error.yaml
|
|
|
|
examples:
|
|
|
|
response:
|
|
|
|
value: {
|
|
|
|
"errcode": "COM.EXAMPLE.MYAPPSERVICE_NOT_FOUND"
|
|
|
|
}
|
|
|
|
servers:
|
|
|
|
- url: "{protocol}://{hostname}{basePath}"
|
|
|
|
variables:
|
|
|
|
protocol:
|
|
|
|
enum:
|
|
|
|
- http
|
|
|
|
- https
|
|
|
|
default: https
|
|
|
|
hostname:
|
|
|
|
default: localhost:8008
|
|
|
|
basePath:
|
|
|
|
default: /_matrix/app/v1
|
|
|
|
components:
|
|
|
|
securitySchemes:
|
|
|
|
homeserverAccessToken:
|
|
|
|
$ref: definitions/security.yaml#/homeserverAccessToken
|