summary refs log tree commit diff
path: root/synapse/rest
diff options
context:
space:
mode:
authorPaul "LeoNerd" Evans <paul@matrix.org>2016-08-18 16:09:50 +0100
committerPaul "LeoNerd" Evans <paul@matrix.org>2016-08-18 16:09:50 +0100
commit06964c4a0adabf7d983cbd0d2c6d83eba6fcaf79 (patch)
treecd3eb6fb5c8c5558aba941ddc55a0cfff1dd0703 /synapse/rest
parentRemove TODO note about request fields being strings - they're always strings (diff)
downloadsynapse-06964c4a0adabf7d983cbd0d2c6d83eba6fcaf79.tar.xz
Copypasta the 3PU support code to also do 3PL
Diffstat (limited to 'synapse/rest')
-rw-r--r--synapse/rest/client/v2_alpha/thirdparty.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/synapse/rest/client/v2_alpha/thirdparty.py b/synapse/rest/client/v2_alpha/thirdparty.py
index bce104c545..eec08425e6 100644
--- a/synapse/rest/client/v2_alpha/thirdparty.py
+++ b/synapse/rest/client/v2_alpha/thirdparty.py
@@ -43,5 +43,25 @@ class ThirdPartyUserServlet(RestServlet):
         defer.returnValue((200, results))
 
 
+class ThirdPartyLocationServlet(RestServlet):
+    PATTERNS = client_v2_patterns("/3pl(/(?P<protocol>[^/]+))?$",
+                                  releases=())
+
+    def __init__(self, hs):
+        super(ThirdPartyLocationServlet, self).__init__()
+
+        self.appservice_handler = hs.get_application_service_handler()
+
+    @defer.inlineCallbacks
+    def on_GET(self, request, protocol):
+        fields = request.args
+        del fields["access_token"]
+
+        results = yield self.appservice_handler.query_3pl(protocol, fields)
+
+        defer.returnValue((200, results))
+
+
 def register_servlets(hs, http_server):
     ThirdPartyUserServlet(hs).register(http_server)
+    ThirdPartyLocationServlet(hs).register(http_server)