from collections import namedtuple
-from .facade import ReturnMapping, Type
+from .facade import ReturnMapping, Type, TypeEncoder
from .import _client
+
__all__ = [
'Delta',
]
__patches__ = [
'ResourcesFacade',
+ 'AllWatcherFacade'
]
_params['resources'] = resources
reply = await self.rpc(msg)
return reply
+
+class AllWatcherFacade(Type):
+ """
+ Patch rpc method of allwatcher to add in 'id' stuff.
+
+ """
+ async def rpc(self, msg):
+ if not hasattr(self, 'Id'):
+ client = _client.ClientFacade.from_connection(self.connection)
+
+ result = await client.WatchAll()
+ self.Id = result.watcher_id
+
+ msg['Id'] = self.Id
+ result = await self.connection.rpc(msg, encoder=TypeEncoder)
+ return result