Skip to content
This repository was archived by the owner on Apr 4, 2025. It is now read-only.

Commit d0785a0

Browse files
implement room delete v2 status in CLI
doesn't check whether both is used but that should be handled by the mutually exclusive thing
1 parent 6a1ccd1 commit d0785a0

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

synadm/cli/room.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"""
2020

2121
import click
22+
from click_option_group import RequiredMutuallyExclusiveOptionGroup, optgroup
2223

2324
from synadm import cli
2425

@@ -288,6 +289,36 @@ def delete(ctx, helper, room_id, new_room_user_id, room_name, message, block,
288289
click.echo("Abort.")
289290

290291

292+
@room.command(name="delete-status")
293+
@optgroup.group(
294+
"Query type", cls=RequiredMutuallyExclusiveOptionGroup,
295+
help="Query room deletion status via either Room ID or Deletion ID"
296+
)
297+
@optgroup.option(
298+
"--room-id", "-r", type=str,
299+
help="""The Room ID to query the deletion status for""")
300+
@optgroup.option(
301+
"--delete-id", "-d", type=str,
302+
help="""The Delete ID to query the deletion status for""")
303+
@click.pass_obj
304+
def delete_status(helper, room_id, delete_id):
305+
""" Get room deletion status via either the room ID or the delete ID.
306+
307+
This requires the usage of the Room Delete v2 API. If you used v1 of the
308+
Room Delete API, this is irrelevant.
309+
"""
310+
output = None
311+
if room_id:
312+
output = helper.api.room_delete_v2_status_by_room_id(
313+
room_id
314+
)
315+
if delete_id:
316+
output = helper.api.room_delete_v2_status_by_delete_id(
317+
delete_id
318+
)
319+
helper.output(output)
320+
321+
291322
@room.command(name="search")
292323
@click.argument("search-term", type=str)
293324
@click.option(

0 commit comments

Comments
 (0)