deltachat_rpc_client: add webxdc API

This commit is contained in:
link2xt
2022-12-26 22:25:10 +00:00
parent 9734552da5
commit f92b8dcec0
3 changed files with 68 additions and 0 deletions

View File

@@ -1,3 +1,4 @@
import json
from typing import TYPE_CHECKING
from ._utils import AttrDict
@@ -47,3 +48,19 @@ class Message:
async def mark_seen(self) -> None:
"""Mark the message as seen."""
await self._rpc.markseen_msgs(self.account.id, [self.id])
async def send_webxdc_status_update(self, update: dict, description: str) -> None:
"""Send a webxdc status update. This message must be a webxdc."""
await self._rpc.send_webxdc_status_update(
self.account.id, self.id, json.dumps(update), description
)
async def get_webxdc_status_updates(self, last_known_serial: int = 0) -> list:
return json.loads(
await self._rpc.get_webxdc_status_updates(
self.account.id, self.id, last_known_serial
)
)
async def get_webxdc_info(self) -> dict:
return await self._rpc.get_webxdc_info(self.account.id, self.id)