jp (invitation): delete implementation

This commit is contained in:
Goffi 2020-08-13 23:46:18 +02:00
commit db286b98e4
2 changed files with 41 additions and 1 deletions

View file

@ -81,6 +81,19 @@ Slovak::
$ jp invitation modify -l sk okFec4gDz75My7iQAVTmsc
delete
======
Delete XMPP account created for an invitation and invitation data
example
-------
Delete invitation with id ``okFec4gDz75My7iQAVTmsc``::
$ jp invitation delete okFec4gDz75My7iQAVTmsc
list
====

View file

@ -213,6 +213,33 @@ class Get(base.CommandBase):
await self.output_data(invitation_data, jid_)
class Delete(base.CommandBase):
def __init__(self, host):
base.CommandBase.__init__(
self,
host,
"delete",
use_profile=False,
help=_("delete guest account"),
)
def add_parser_options(self):
self.parser.add_argument(
"id", help=_("invitation UUID")
)
async def start(self):
try:
await self.host.bridge.invitationDelete(
self.args.id,
)
except Exception as e:
self.disp(msg=_(f"can't delete guest account: {e}"), error=True)
self.host.quit(C.EXIT_BRIDGE_ERRBACK)
self.host.quit()
class Modify(base.CommandBase):
def __init__(self, host):
base.CommandBase.__init__(
@ -339,7 +366,7 @@ class List(base.CommandBase):
class Invitation(base.CommandBase):
subcommands = (Create, Get, Modify, List)
subcommands = (Create, Get, Delete, Modify, List)
def __init__(self, host):
super(Invitation, self).__init__(