mirror of
https://github.com/matrix-org/matrix-spec
synced 2025-12-24 01:58:36 +01:00
Get profile tag keys displaying correctly.
This commit is contained in:
parent
f6da9d7760
commit
56ce432399
|
|
@ -25,7 +25,7 @@ paths:
|
||||||
Retrieve all push rulesets for this user. Clients can "drill-down" on
|
Retrieve all push rulesets for this user. Clients can "drill-down" on
|
||||||
the rulesets by suffixing a ``scope`` to this path e.g.
|
the rulesets by suffixing a ``scope`` to this path e.g.
|
||||||
``/pushrules/global/``. This will return a subset of this data under the
|
``/pushrules/global/``. This will return a subset of this data under the
|
||||||
specified key: in this case the ``global`` key.
|
specified key e.g. the ``global`` key.
|
||||||
security:
|
security:
|
||||||
- accessToken: []
|
- accessToken: []
|
||||||
responses:
|
responses:
|
||||||
|
|
@ -38,7 +38,7 @@ paths:
|
||||||
device:
|
device:
|
||||||
type: object
|
type: object
|
||||||
title: Devices
|
title: Devices
|
||||||
description: A dictionary of devices.
|
description: A dictionary of profile tags to rulesets.
|
||||||
additionalProperties:
|
additionalProperties:
|
||||||
x-pattern: "$PROFILE_TAG"
|
x-pattern: "$PROFILE_TAG"
|
||||||
type: object
|
type: object
|
||||||
|
|
|
||||||
|
|
@ -336,33 +336,6 @@ rules, the rule_id of the rule determines its behaviour.
|
||||||
|
|
||||||
Push Rules: API
|
Push Rules: API
|
||||||
~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~
|
||||||
Rules live under a hierarchy in the REST API that resembles::
|
|
||||||
|
|
||||||
$PREFIX/pushrules/<scope>/<kind>/<rule_id>
|
|
||||||
|
|
||||||
The component parts are as follows:
|
|
||||||
|
|
||||||
scope
|
|
||||||
Either 'global' or 'device/<profile_tag>' to specify global rules or
|
|
||||||
device rules for the given profile_tag.
|
|
||||||
kind
|
|
||||||
The kind of rule, i.e. 'override', 'underride', 'sender', 'room', 'content'.
|
|
||||||
rule_id
|
|
||||||
The identifier for the rule.
|
|
||||||
|
|
||||||
To add or change a rule, a client performs a PUT request to the appropriate URL.
|
|
||||||
When adding rules of a type that has an ordering, the client can add parameters
|
|
||||||
that define the priority of the rule:
|
|
||||||
|
|
||||||
before
|
|
||||||
Use 'before' with a rule_id as its value to make the new rule the next-more
|
|
||||||
important rule with respect to the given rule.
|
|
||||||
after
|
|
||||||
This makes the new rule the next-less important rule relative to the given
|
|
||||||
rule.
|
|
||||||
|
|
||||||
All requests to the push rules API also require an access_token as a query
|
|
||||||
parameter.
|
|
||||||
|
|
||||||
The content of the PUT request is a JSON object with a list of actions under the
|
The content of the PUT request is a JSON object with a list of actions under the
|
||||||
'actions' key and either conditions (under the 'conditions' key) or the
|
'actions' key and either conditions (under the 'conditions' key) or the
|
||||||
|
|
@ -391,60 +364,6 @@ To add a custom sound for notifications messages containing the word 'beer' in a
|
||||||
curl -X PUT -H "Content-Type: application/json" -d '{ "conditions": [{"kind": "event_match", "key": "content.body", "pattern": "beer" }, {"kind": "room_member_count", "is": "<=10"}], "actions" : ["notify", {"set_sound":"beeroclock.wav"}] }' "http://localhost:8008/_matrix/client/api/v1/pushrules/global/override/U2VlIHlvdSBpbiBUaGUgRHVrZQ?access_token=123456
|
curl -X PUT -H "Content-Type: application/json" -d '{ "conditions": [{"kind": "event_match", "key": "content.body", "pattern": "beer" }, {"kind": "room_member_count", "is": "<=10"}], "actions" : ["notify", {"set_sound":"beeroclock.wav"}] }' "http://localhost:8008/_matrix/client/api/v1/pushrules/global/override/U2VlIHlvdSBpbiBUaGUgRHVrZQ?access_token=123456
|
||||||
|
|
||||||
|
|
||||||
To delete rules, a client would just make a DELETE request to the same URL::
|
|
||||||
|
|
||||||
curl -X DELETE "http://localhost:8008/_matrix/client/api/v1/pushrules/global/room/%23spam%3Amatrix.org?access_token=123456"
|
|
||||||
|
|
||||||
|
|
||||||
Retrieving the current ruleset can be done either by fetching individual rules
|
|
||||||
using the scheme as specified above. This returns the rule in the same format as
|
|
||||||
would be given in the PUT API with the addition of a rule_id::
|
|
||||||
|
|
||||||
curl "http://localhost:8008/_matrix/client/api/v1/pushrules/global/room/%23spam%3Amatrix.org?access_token=123456"
|
|
||||||
|
|
||||||
Returns::
|
|
||||||
|
|
||||||
{
|
|
||||||
"actions": [
|
|
||||||
"dont_notify"
|
|
||||||
],
|
|
||||||
"rule_id": "#spam:matrix.org",
|
|
||||||
"enabled": true
|
|
||||||
}
|
|
||||||
|
|
||||||
Clients can also fetch broader sets of rules by removing path components.
|
|
||||||
Requesting the root level returns a structure as follows::
|
|
||||||
|
|
||||||
{
|
|
||||||
"device": {
|
|
||||||
"exampledevice": {
|
|
||||||
"content": [],
|
|
||||||
"override": [],
|
|
||||||
"room": [
|
|
||||||
{
|
|
||||||
"actions": [
|
|
||||||
"dont_notify"
|
|
||||||
],
|
|
||||||
"rule_id": "#spam:matrix.org",
|
|
||||||
"enabled", true
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"sender": [],
|
|
||||||
"underride": []
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"global": {
|
|
||||||
"content": [],
|
|
||||||
"override": [],
|
|
||||||
"room": [],
|
|
||||||
"sender": [],
|
|
||||||
"underride": []
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Adding patch components to the request drills down into this structure to filter
|
|
||||||
to only the requested set of rules.
|
|
||||||
|
|
||||||
Enabling and Disabling Rules
|
Enabling and Disabling Rules
|
||||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||||
Rules can be enabled or disabled with a PUT operation to the 'enabled' component
|
Rules can be enabled or disabled with a PUT operation to the 'enabled' component
|
||||||
|
|
|
||||||
|
|
@ -31,18 +31,18 @@ Response format:
|
||||||
{% for table in endpoint.res_tables -%}
|
{% for table in endpoint.res_tables -%}
|
||||||
{{"``"+table.title+"``" if table.title else "" }}
|
{{"``"+table.title+"``" if table.title else "" }}
|
||||||
|
|
||||||
======================= ================= ==========================================
|
======================= ========================= ==========================================
|
||||||
Param Type Description
|
Param Type Description
|
||||||
======================= ================= ==========================================
|
======================= ========================= ==========================================
|
||||||
{% for row in table.rows -%}
|
{% for row in table.rows -%}
|
||||||
{# -#}
|
{# -#}
|
||||||
{# Row type needs to prepend spaces to line up with the type column (20 ch) -#}
|
{# Row type needs to prepend spaces to line up with the type column (20 ch) -#}
|
||||||
{# Desc needs to prepend the required text (maybe) and prepend spaces too -#}
|
{# Desc needs to prepend the required text (maybe) and prepend spaces too -#}
|
||||||
{# It also needs to then wrap inside the desc col (42 ch width) -#}
|
{# It also needs to then wrap inside the desc col (42 ch width) -#}
|
||||||
{# -#}
|
{# -#}
|
||||||
{{row.key}}{{row.type|indent(24-row.key|length)}}{{row.desc|wrap(40,row.req_str | indent(18 - (row.type|length))) |indent_block(42)}}
|
{{row.key}}{{row.type|indent(24-row.key|length)}}{{row.desc|wrap(40,row.req_str | indent(26 - (row.type|length))) |indent_block(50)}}
|
||||||
{% endfor -%}
|
{% endfor -%}
|
||||||
======================= ================= ==========================================
|
======================= ========================= ==========================================
|
||||||
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
{% endif -%}
|
{% endif -%}
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,10 @@ def get_json_schema_object_fields(obj, enforce_title=False):
|
||||||
props[key_name]["additionalProperties"],
|
props[key_name]["additionalProperties"],
|
||||||
enforce_title=True
|
enforce_title=True
|
||||||
)
|
)
|
||||||
value_type = "{string: %s}" % nested_object[0]["title"]
|
key = props[key_name]["additionalProperties"].get(
|
||||||
|
"x-pattern", "string"
|
||||||
|
)
|
||||||
|
value_type = "{%s: %s}" % (key, nested_object[0]["title"])
|
||||||
if not nested_object[0].get("no-table"):
|
if not nested_object[0].get("no-table"):
|
||||||
tables += nested_object
|
tables += nested_object
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue