Document instance_id
field of /thirdparty/protocols
(#2051)
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
This commit is contained in:
parent
dcb39c603a
commit
c2ef38f0e5
9 changed files with 247 additions and 174 deletions
43
data/api/client-server/definitions/protocol.yaml
Normal file
43
data/api/client-server/definitions/protocol.yaml
Normal file
|
@ -0,0 +1,43 @@
|
|||
# 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.
|
||||
allOf:
|
||||
- $ref: ../../application-service/definitions/protocol_base.yaml
|
||||
- type: object
|
||||
properties:
|
||||
instances:
|
||||
description: |-
|
||||
A list of objects representing independent instances of configuration.
|
||||
For example, multiple networks on IRC if multiple are provided by the
|
||||
same application service.
|
||||
|
||||
The instances are modified by the homeserver from the response of
|
||||
[`GET /_matrix/app/v1/thirdparty/protocol/{protocol}`](/application-service-api/#get_matrixappv1thirdpartyprotocolprotocol)
|
||||
to include an `instance_id` to serve as a unique identifier for each
|
||||
instance on the homeserver.
|
||||
type: array
|
||||
items:
|
||||
allOf:
|
||||
- $ref: ../../application-service/definitions/protocol_instance.yaml
|
||||
- type: object
|
||||
properties:
|
||||
instance_id:
|
||||
type: string
|
||||
description: |-
|
||||
A unique identifier for this instance on the homeserver. This field is added
|
||||
to the response of [`GET /_matrix/app/v1/thirdparty/protocol/{protocol}`](/application-service-api/#get_matrixappv1thirdpartyprotocolprotocol)
|
||||
by the homeserver.
|
||||
|
||||
This is the identifier to use as the `third_party_instance_id` in a request to
|
||||
[`POST /_matrix/client/v3/publicRooms`](/client-server-api/#post_matrixclientv3publicrooms).
|
||||
example: "irc-freenode"
|
|
@ -233,6 +233,9 @@ paths:
|
|||
description: |-
|
||||
The specific third-party network/protocol to request from the
|
||||
homeserver. Can only be used if `include_all_networks` is false.
|
||||
|
||||
This is the `instance_id` of a `Protocol Instance` returned by
|
||||
[`GET /_matrix/client/v3/thirdparty/protocols`](/client-server-api/#get_matrixclientv3thirdpartyprotocols).
|
||||
example: irc
|
||||
example: {
|
||||
"limit": 10,
|
||||
|
@ -244,7 +247,7 @@ paths:
|
|||
]
|
||||
},
|
||||
"include_all_networks": false,
|
||||
"third_party_instance_id": "irc"
|
||||
"third_party_instance_id": "irc-freenode"
|
||||
}
|
||||
description: Options for which rooms to return.
|
||||
required: true
|
||||
|
|
|
@ -33,7 +33,65 @@ paths:
|
|||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: ../application-service/definitions/protocol_metadata.yaml
|
||||
type: object
|
||||
description: Dictionary of supported third-party protocols.
|
||||
additionalProperties:
|
||||
$ref: definitions/protocol.yaml
|
||||
example: {
|
||||
"irc": {
|
||||
"user_fields": ["network", "nickname"],
|
||||
"location_fields": ["network", "channel"],
|
||||
"icon": "mxc://example.org/aBcDeFgH",
|
||||
"field_types": {
|
||||
"network": {
|
||||
"regexp": "([a-z0-9]+\\.)*[a-z0-9]+",
|
||||
"placeholder": "irc.example.org"
|
||||
},
|
||||
"nickname": {
|
||||
"regexp": "[^\\s]+",
|
||||
"placeholder": "username"
|
||||
},
|
||||
"channel": {
|
||||
"regexp": "#[^\\s]+",
|
||||
"placeholder": "#foobar"
|
||||
}
|
||||
},
|
||||
"instances": [
|
||||
{
|
||||
"network_id": "freenode",
|
||||
"desc": "Freenode",
|
||||
"icon": "mxc://example.org/JkLmNoPq",
|
||||
"instance_id": "irc-freenode",
|
||||
"fields": {
|
||||
"network": "freenode.net"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
"gitter": {
|
||||
"user_fields": ["username"],
|
||||
"location_fields": ["room"],
|
||||
"field_types": {
|
||||
"username": {
|
||||
"regexp": "@[^\\s]+",
|
||||
"placeholder": "@username"
|
||||
},
|
||||
"room": {
|
||||
"regexp": "[^\\s]+\\/[^\\s]+",
|
||||
"placeholder": "matrix-org/matrix-doc"
|
||||
}
|
||||
},
|
||||
"instances": [
|
||||
{
|
||||
"network_id": "gitter",
|
||||
"desc": "Gitter",
|
||||
"icon": "mxc://example.org/zXyWvUt",
|
||||
"instance_id": "gitter-gitter",
|
||||
"fields": {}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
tags:
|
||||
- Third-party Lookup
|
||||
"/thirdparty/protocol/{protocol}":
|
||||
|
@ -59,7 +117,7 @@ paths:
|
|||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: ../application-service/definitions/protocol.yaml
|
||||
$ref: definitions/protocol.yaml
|
||||
"404":
|
||||
description: The protocol is unknown.
|
||||
content:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue