diff --git a/api/client-server/v1/definitions/push_rule.json b/api/client-server/v1/definitions/push_rule.json new file mode 100644 index 000000000..4df93f67b --- /dev/null +++ b/api/client-server/v1/definitions/push_rule.json @@ -0,0 +1,20 @@ +{ + "type": "object", + "properties": { + "default": { + "type": "boolean" + }, + "enabled": { + "type": "boolean" + }, + "rule_id": { + "type": "string" + }, + "actions": { + "items": { + "type": ["object", "string"] + }, + "type": "array" + } + } +} \ No newline at end of file diff --git a/api/client-server/v1/definitions/push_rule.yaml b/api/client-server/v1/definitions/push_rule.yaml deleted file mode 100644 index be4791c8f..000000000 --- a/api/client-server/v1/definitions/push_rule.yaml +++ /dev/null @@ -1,12 +0,0 @@ -type: "object" -properties: - rule_id: - type: string - actions: - type: array - items: - type: string - default: - type: boolean - enabled: - type: boolean \ No newline at end of file diff --git a/api/client-server/v1/definitions/push_ruleset.json b/api/client-server/v1/definitions/push_ruleset.json new file mode 100644 index 000000000..e03727012 --- /dev/null +++ b/api/client-server/v1/definitions/push_ruleset.json @@ -0,0 +1,60 @@ +{ + "type": "object", + "properties": { + "content": { + "items": { + "type": "object", + "allOf": [ + { + "$ref": "push_rule.json" + } + ] + }, + "type": "array" + }, + "override": { + "items": { + "type": "object", + "allOf": [ + { + "$ref": "push_rule.json" + } + ] + }, + "type": "array" + }, + "sender": { + "items": { + "type": "object", + "allOf": [ + { + "$ref": "push_rule.json" + } + ] + }, + "type": "array" + }, + "underride": { + "items": { + "type": "object", + "allOf": [ + { + "$ref": "push_rule.json" + } + ] + }, + "type": "array" + }, + "room": { + "items": { + "type": "object", + "allOf": [ + { + "$ref": "push_rule.json" + } + ] + }, + "type": "array" + } + } +} \ No newline at end of file diff --git a/api/client-server/v1/definitions/push_ruleset.yaml b/api/client-server/v1/definitions/push_ruleset.yaml deleted file mode 100644 index 77653b98d..000000000 --- a/api/client-server/v1/definitions/push_ruleset.yaml +++ /dev/null @@ -1,27 +0,0 @@ -type: "object" -properties: - content: - type: array - items: - type: object - allOf: [ "$ref": "definitions/push_rule.yaml"] - override: - type: array - items: - type: object - allOf: [ "$ref": "definitions/push_rule.yaml"] - room: - type: array - items: - type: object - allOf: [ "$ref": "definitions/push_rule.yaml"] - sender: - type: array - items: - type: object - allOf: [ "$ref": "definitions/push_rule.yaml"] - underride: - type: array - items: - type: object - allOf: [ "$ref": "definitions/push_rule.yaml"] diff --git a/api/client-server/v1/pushrules.yaml b/api/client-server/v1/pushrules.yaml index 29a8b0cc2..17061b2df 100644 --- a/api/client-server/v1/pushrules.yaml +++ b/api/client-server/v1/pushrules.yaml @@ -30,6 +30,7 @@ paths: - accessToken: [] responses: 200: + description: All the push rulesets for this user. schema: type: object required: ["device", "global"] @@ -38,21 +39,20 @@ paths: type: object title: Devices description: A dictionary of devices. - patternProperties: - ".*": + additionalProperties: x-pattern: "$PROFILE_TAG" type: object description: The ruleset for this profile tag. title: Ruleset allOf: [ - "$ref": "definitions/push_ruleset.yaml" + "$ref": "definitions/push_ruleset.json" ] global: type: object description: The global ruleset. title: Ruleset allOf: [ - "$ref": "definitions/push_ruleset.yaml" + "$ref": "definitions/push_ruleset.json" ] examples: application/json: |- @@ -292,14 +292,11 @@ paths: } schema: type: object - required: ["enabled", "rule_id", "actions"] - properties: - enabled: - type: boolean - description: Whether this rule is active or not. - rule_id: - type: string - description: The rule ID from the path. + description: The push rule. + title: PushRule + allOf: [ + "$ref": "definitions/push_rule.json" + ] delete: summary: Delete a push rule. description: |- @@ -330,6 +327,14 @@ paths: x-example: "#spam:example.com" description: | The identifier for the rule. + responses: + 200: + description: The push rule was deleted. + examples: + application/json: |- + {} + schema: + type: object # empty json object put: summary: Add or change a push rule. description: |-