mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-03 03:54:52 -04:00
Unify v1 and v2 REST client APIs (#5226)
This commit is contained in:
parent
d828d1dc57
commit
2889b05554
43 changed files with 296 additions and 317 deletions
|
@ -21,22 +21,22 @@ from synapse.api.errors import (
|
|||
SynapseError,
|
||||
UnrecognizedRequestError,
|
||||
)
|
||||
from synapse.http.servlet import parse_json_value_from_request, parse_string
|
||||
from synapse.http.servlet import RestServlet, parse_json_value_from_request, parse_string
|
||||
from synapse.push.baserules import BASE_RULE_IDS
|
||||
from synapse.push.clientformat import format_push_rules_for_user
|
||||
from synapse.push.rulekinds import PRIORITY_CLASS_MAP
|
||||
from synapse.rest.client.v2_alpha._base import client_patterns
|
||||
from synapse.storage.push_rule import InconsistentRuleException, RuleNotFoundException
|
||||
|
||||
from .base import ClientV1RestServlet, client_path_patterns
|
||||
|
||||
|
||||
class PushRuleRestServlet(ClientV1RestServlet):
|
||||
PATTERNS = client_path_patterns("/(?P<path>pushrules/.*)$")
|
||||
class PushRuleRestServlet(RestServlet):
|
||||
PATTERNS = client_patterns("/(?P<path>pushrules/.*)$", v1=True)
|
||||
SLIGHTLY_PEDANTIC_TRAILING_SLASH_ERROR = (
|
||||
"Unrecognised request: You probably wanted a trailing slash")
|
||||
|
||||
def __init__(self, hs):
|
||||
super(PushRuleRestServlet, self).__init__(hs)
|
||||
super(PushRuleRestServlet, self).__init__()
|
||||
self.auth = hs.get_auth()
|
||||
self.store = hs.get_datastore()
|
||||
self.notifier = hs.get_notifier()
|
||||
self._is_worker = hs.config.worker_app is not None
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue