From 3cb8185b1a93160b448ac36d92f85b93ad03ec4c Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Wed, 12 Jan 2022 16:19:10 +0000 Subject: [PATCH] prosodyclient: Add API to import XEP-0227 account data --- snikket_web/prosodyclient.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/snikket_web/prosodyclient.py b/snikket_web/prosodyclient.py index 6b530f1..f743f16 100644 --- a/snikket_web/prosodyclient.py +++ b/snikket_web/prosodyclient.py @@ -1138,6 +1138,20 @@ class ProsodyClient: return None return await resp.text() + @autosession + async def import_account_data( + self, + user_xml: str, + *, + session: aiohttp.ClientSession, + ) -> bool: + async with session.post( + self._xep227_endpoint("/import?stores=roster,vcard,pep"), + data=user_xml, + ) as resp: + self._raise_error_from_response(resp) + return True + @autosession async def revoke_token( self,