changeset 3339:c560aae54f5f

jp (invitation): `delete` implementation
author Goffi <goffi@goffi.org>
date Thu, 13 Aug 2020 23:46:18 +0200
parents 203a491fcd86
children 2ad14b834730
files doc/jp/invitation.rst sat_frontends/jp/cmd_invitation.py
diffstat 2 files changed, 41 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/doc/jp/invitation.rst	Thu Aug 13 23:46:18 2020 +0200
+++ b/doc/jp/invitation.rst	Thu Aug 13 23:46:18 2020 +0200
@@ -81,6 +81,19 @@
   $ 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
 ====
 
--- a/sat_frontends/jp/cmd_invitation.py	Thu Aug 13 23:46:18 2020 +0200
+++ b/sat_frontends/jp/cmd_invitation.py	Thu Aug 13 23:46:18 2020 +0200
@@ -213,6 +213,33 @@
             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 Invitation(base.CommandBase):
-    subcommands = (Create, Get, Modify, List)
+    subcommands = (Create, Get, Delete, Modify, List)
 
     def __init__(self, host):
         super(Invitation, self).__init__(