Deserialize api results back to Types
[osm/N2VC.git] / juju / client / connection.py
index 9a631ec..1a9e8e9 100644 (file)
@@ -55,14 +55,14 @@ class Connection:
             result = json.loads(result)
         return result
 
-    async def rpc(self, msg):
+    async def rpc(self, msg, encoder=None):
         self.__request_id__ += 1
         msg['RequestId'] = self.__request_id__
         if'Params' not in msg:
             msg['Params'] = {}
         if "Version" not in msg:
             msg['Version'] = self.facades[msg['Type']]
-        outgoing = json.dumps(msg, indent=2)
+        outgoing = json.dumps(msg, indent=2, cls=encoder)
         await self.ws.send(outgoing)
         result = await self.recv()
         log.debug("send %s got %s", msg, result)