summary refs log tree commit diff
path: root/synapse/appservice/api.py
diff options
context:
space:
mode:
Diffstat (limited to 'synapse/appservice/api.py')
-rw-r--r--synapse/appservice/api.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/synapse/appservice/api.py b/synapse/appservice/api.py
index 07ec33b9a1..1de0e7240f 100644
--- a/synapse/appservice/api.py
+++ b/synapse/appservice/api.py
@@ -52,6 +52,13 @@ class ApplicationServiceApi(SimpleHttpClient):
     pushing.
     """
 
+    PROTOCOL_META = {
+        # TODO(paul): Declare kinds of metadata in here
+        "gitter": {
+            "user_fields": ["username"],
+        }
+    }
+
     def __init__(self, hs):
         super(ApplicationServiceApi, self).__init__(hs)
         self.clock = hs.get_clock()
@@ -132,6 +139,19 @@ class ApplicationServiceApi(SimpleHttpClient):
             defer.returnValue([])
 
     @defer.inlineCallbacks
+    def get_3pe_protocol(self, service, protocol):
+        # TODO: cache
+        uri = "%s/thirdparty/protocol/%s" % (service.url, urllib.quote(protocol))
+        try:
+            response = yield self.get_json(uri, {})
+            defer.returnValue(response)
+        except Exception as ex:
+            logger.warning("query_3pe_protocol to %s threw exception %s",
+                uri, ex
+            )
+            defer.returnValue({})
+
+    @defer.inlineCallbacks
     def push_bulk(self, service, events, txn_id=None):
         events = self._serialize(events)