|
|
|
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:
|
|
|
|
"/transactions/{txnId}":
|
|
|
|
put:
|
|
|
|
summary: Send some events to the application service.
|
|
|
|
description: |-
|
|
|
|
This API is called by the HS when the HS wants to push an event (or
|
|
|
|
batch of events) to the AS.
|
|
|
|
parameters:
|
|
|
|
- in: path
|
|
|
|
name: txnId
|
|
|
|
type: string
|
|
|
|
description: |-
|
|
|
|
The transaction ID for this set of events. Homeservers generate
|
|
|
|
these IDs and they are used to ensure idempotency of requests.
|
|
|
|
required: true
|
|
|
|
x-example: "35"
|
|
|
|
- in: body
|
|
|
|
name: body
|
|
|
|
description: A list of events
|
|
|
|
schema:
|
|
|
|
type: object
|
|
|
|
example: |-
|
|
|
|
{
|
|
|
|
"events": [
|
|
|
|
{
|
|
|
|
"age": 32,
|
|
|
|
"content": {
|
|
|
|
"body": "incoming message",
|
|
|
|
"msgtype": "m.text"
|
|
|
|
},
|
|
|
|
"event_id": "$14328055551tzaee:localhost",
|
|
|
|
"origin_server_ts": 1432804485886,
|
|
|
|
"room_id": "!TmaZBKYIFrIPVGoUYp:localhost",
|
|
|
|
"type": "m.room.message",
|
|
|
|
"user_id": "@bob:localhost"
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"age": 1984,
|
|
|
|
"content": {
|
|
|
|
"body": "another incoming message",
|
|
|
|
"msgtype": "m.text"
|
|
|
|
},
|
|
|
|
"event_id": "$1228055551ffsef:localhost",
|
|
|
|
"origin_server_ts": 1432804485886,
|
|
|
|
"room_id": "!TmaZBKYIFrIPVGoUYp:localhost",
|
|
|
|
"type": "m.room.message",
|
|
|
|
"user_id": "@bob:localhost"
|
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
description: "Transaction informations"
|
|
|
|
properties:
|
|
|
|
events:
|
|
|
|
type: array
|
|
|
|
description: A list of events
|
|
|
|
items:
|
|
|
|
type: object
|
|
|
|
title: Event
|
|
|
|
required: ["events"]
|
|
|
|
responses:
|
|
|
|
200:
|
|
|
|
description: The transaction was processed successfully.
|
|
|
|
examples:
|
|
|
|
application/json: |-
|
|
|
|
{}
|
|
|
|
schema:
|
|
|
|
type: object
|
|
|
|
|
|
|
|
"/rooms/{roomAlias}":
|
|
|
|
get:
|
|
|
|
summary: Query if a room alias should exist on the application service.
|
|
|
|
description: |-
|
|
|
|
This endpoint is invoked by the homeserver on an application service to query
|
|
|
|
the existence of a given room alias. The homeserver will only query room
|
|
|
|
aliases inside the application service's ``aliases`` namespace. The
|
|
|
|
homeserver will send this request when it receives a request to join a
|
|
|
|
room alias within the application service's namespace.
|
|
|
|
parameters:
|
|
|
|
- in: path
|
|
|
|
name: roomAlias
|
|
|
|
type: string
|
|
|
|
description: The room alias being queried.
|
|
|
|
required: true
|
|
|
|
x-example: "#magicforest:example.com"
|
|
|
|
responses:
|
|
|
|
200:
|
|
|
|
description: |-
|
|
|
|
The application service indicates that this room alias exists. The
|
|
|
|
application service MUST have created a room and associated it with
|
|
|
|
the queried room alias using the client-server API. Additional
|
|
|
|
information about the room such as its name and topic can be set
|
|
|
|
before responding.
|
|
|
|
examples:
|
|
|
|
application/json: |-
|
|
|
|
{}
|
|
|
|
schema:
|
|
|
|
type: object
|
|
|
|
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": "ORG.MATRIX.MYAPPSERVICE_UNAUTHORIZED"
|
|
|
|
}
|
|
|
|
schema:
|
|
|
|
type: object
|
|
|
|
403:
|
|
|
|
description: |-
|
|
|
|
The credentials supplied by the homeserver were rejected.
|
|
|
|
examples:
|
|
|
|
application/json: |-
|
|
|
|
{
|
|
|
|
"errcode": "M_FORBIDDEN"
|
|
|
|
}
|
|
|
|
schema:
|
|
|
|
type: object
|
|
|
|
404:
|
|
|
|
description: |-
|
|
|
|
The application service indicates that this room alias does not exist.
|
|
|
|
Optional error information can be included in the body of this response.
|
|
|
|
examples:
|
|
|
|
application/json: |-
|
|
|
|
{
|
|
|
|
"errcode": "ORG.MATRIX.MYAPPSERVICE_NOT_FOUND"
|
|
|
|
}
|
|
|
|
schema:
|
|
|
|
type: object
|
|
|
|
"/users/{userId}":
|
|
|
|
get:
|
|
|
|
summary: Query if a user should exist on the application service.
|
|
|
|
description: |-
|
|
|
|
This endpoint is invoked by the homeserver on an application service to query
|
|
|
|
the existence of a given user ID. The homeserver will only query user IDs
|
|
|
|
inside the application service's ``users`` namespace. The homeserver will
|
|
|
|
send this request when it receives an *event* for an unknown user ID in
|
|
|
|
the application service's namespace.
|
|
|
|
parameters:
|
|
|
|
- in: path
|
|
|
|
name: userId
|
|
|
|
type: string
|
|
|
|
description: The user ID being queried.
|
|
|
|
required: true
|
|
|
|
x-example: "@alice:example.com"
|
|
|
|
responses:
|
|
|
|
200:
|
|
|
|
description: |-
|
|
|
|
The application service indicates that this user exists. The application
|
|
|
|
service MUST create the user using the client-server API.
|
|
|
|
examples:
|
|
|
|
application/json: |-
|
|
|
|
{}
|
|
|
|
schema:
|
|
|
|
type: object
|
|
|
|
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": "ORG.MATRIX.MYAPPSERVICE_UNAUTHORIZED"
|
|
|
|
}
|
|
|
|
schema:
|
|
|
|
type: object
|
|
|
|
403:
|
|
|
|
description: |-
|
|
|
|
The credentials supplied by the homeserver were rejected.
|
|
|
|
examples:
|
|
|
|
application/json: |-
|
|
|
|
{
|
|
|
|
"errcode": "M_FORBIDDEN"
|
|
|
|
}
|
|
|
|
schema:
|
|
|
|
type: object
|
|
|
|
404:
|
|
|
|
description: |-
|
|
|
|
The application service indicates that this user does not exist.
|
|
|
|
Optional error information can be included in the body of this response.
|
|
|
|
examples:
|
|
|
|
application/json: |-
|
|
|
|
{
|
|
|
|
"errcode": "ORG.MATRIX.MYAPPSERVICE_NOT_FOUND"
|
|
|
|
}
|
|
|
|
schema:
|
|
|
|
type: object
|
|
|
|
|