From 1a0a26d7b35536334905519a3c7b9a7293e87d3d Mon Sep 17 00:00:00 2001 From: Yoshihiro OKUMURA Date: Fri, 26 May 2023 17:58:25 +0900 Subject: [PATCH] support 'recursive' flag to recursively delete folders. --- mdrsclient/api/folder.py | 5 +++-- mdrsclient/commands/rm.py | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/mdrsclient/api/folder.py b/mdrsclient/api/folder.py index f5b042d..d8a8783 100644 --- a/mdrsclient/api/folder.py +++ b/mdrsclient/api/folder.py @@ -60,11 +60,12 @@ class FolderApi(BaseApi): self._raise_response_error(response) return True - def destroy(self, id: str) -> bool: + def destroy(self, id: str, recursive: bool) -> bool: # print(self.__class__.__name__ + "::" + sys._getframe().f_code.co_name) url = self.ENTRYPOINT + id + "/" + params = {"recursive": recursive} token_check(self.connection) - response = self.connection.delete(url) + response = self.connection.delete(url, params=params) self._raise_response_error(response) return True diff --git a/mdrsclient/commands/rm.py b/mdrsclient/commands/rm.py index 621081f..99b2b70 100644 --- a/mdrsclient/commands/rm.py +++ b/mdrsclient/commands/rm.py @@ -36,4 +36,4 @@ class RmCommand(BaseCommand): if not args.recursive: raise IllegalArgumentException(f"Cannot remove `{r_path}`: Is a folder.") folder_api = FolderApi(connection) - folder_api.destroy(folder.id) + folder_api.destroy(folder.id, True)