You've already forked snikket-web-portal
prosodyclient: Add support for exporting a user's account data
This commit is contained in:
committed by
Jonas Schäfer
parent
f7429413cd
commit
e18f727db0
@@ -296,6 +296,9 @@ class ProsodyClient:
|
|||||||
def _public_v1_endpoint(self, subpath: str) -> str:
|
def _public_v1_endpoint(self, subpath: str) -> str:
|
||||||
return "{}/register_api{}".format(self._endpoint_base, subpath)
|
return "{}/register_api{}".format(self._endpoint_base, subpath)
|
||||||
|
|
||||||
|
def _xep227_endpoint(self, subpath: str) -> str:
|
||||||
|
return "{}/xep227{}".format(self._endpoint_base, subpath)
|
||||||
|
|
||||||
async def _oauth2_bearer_token(self,
|
async def _oauth2_bearer_token(self,
|
||||||
session: aiohttp.ClientSession,
|
session: aiohttp.ClientSession,
|
||||||
jid: str,
|
jid: str,
|
||||||
@@ -1121,6 +1124,18 @@ class ProsodyClient:
|
|||||||
) as resp:
|
) as resp:
|
||||||
self._raise_error_from_response(resp)
|
self._raise_error_from_response(resp)
|
||||||
|
|
||||||
|
@autosession
|
||||||
|
async def export_account_data(
|
||||||
|
self,
|
||||||
|
*,
|
||||||
|
session: aiohttp.ClientSession,
|
||||||
|
) -> str:
|
||||||
|
async with session.get(
|
||||||
|
self._xep227_endpoint("/export?stores=roster,vcard,pep"),
|
||||||
|
) as resp:
|
||||||
|
self._raise_error_from_response(resp)
|
||||||
|
return await resp.text()
|
||||||
|
|
||||||
@autosession
|
@autosession
|
||||||
async def revoke_token(
|
async def revoke_token(
|
||||||
self,
|
self,
|
||||||
|
|||||||
Reference in New Issue
Block a user