From 8a76094965635eb2afd501038ea3c09f88416ce2 Mon Sep 17 00:00:00 2001 From: David Baker Date: Mon, 11 Apr 2016 18:00:03 +0100 Subject: Add get endpoint for pushers As per https://github.com/matrix-org/matrix-doc/pull/308 --- synapse/storage/pusher.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'synapse/storage') diff --git a/synapse/storage/pusher.py b/synapse/storage/pusher.py index 19888a8e76..11feab72de 100644 --- a/synapse/storage/pusher.py +++ b/synapse/storage/pusher.py @@ -75,6 +75,25 @@ class PusherStore(SQLBaseStore): defer.returnValue(rows) + @defer.inlineCallbacks + def get_pushers_by_app_user_id(self, user_id): + def r(txn): + sql = ( + "SELECT * FROM pushers" + " WHERE user_name = ?" + ) + + txn.execute(sql, (user_id,)) + rows = self.cursor_to_dict(txn) + + return self._decode_pushers_rows(rows) + + result = yield self.runInteraction( + "get_pushers_by_user_id", r + ) + + defer.returnValue(result) + @defer.inlineCallbacks def get_all_pushers(self): def get_pushers(txn): -- cgit 1.5.1