mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-08-08 20:22:11 -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
|
@ -26,8 +26,7 @@ from synapse.api.urls import CLIENT_API_PREFIX
|
|||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
def client_v2_patterns(path_regex, releases=(0,),
|
||||
unstable=True):
|
||||
def client_patterns(path_regex, releases=(0,), unstable=True, v1=False):
|
||||
"""Creates a regex compiled client path with the correct client path
|
||||
prefix.
|
||||
|
||||
|
@ -41,6 +40,9 @@ def client_v2_patterns(path_regex, releases=(0,),
|
|||
if unstable:
|
||||
unstable_prefix = CLIENT_API_PREFIX + "/unstable"
|
||||
patterns.append(re.compile("^" + unstable_prefix + path_regex))
|
||||
if v1:
|
||||
v1_prefix = CLIENT_API_PREFIX + "/api/v1"
|
||||
patterns.append(re.compile("^" + v1_prefix + path_regex))
|
||||
for release in releases:
|
||||
new_prefix = CLIENT_API_PREFIX + "/r%d" % (release,)
|
||||
patterns.append(re.compile("^" + new_prefix + path_regex))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue