support 'recursive' flag to recursively delete folders.

This commit is contained in:
Yoshihiro OKUMURA 2023-05-26 17:58:25 +09:00
parent 9ed9c4d0f2
commit 1a0a26d7b3
Signed by: orrisroot
GPG Key ID: 470AA444C92904B2
2 changed files with 4 additions and 3 deletions

View File

@ -60,11 +60,12 @@ class FolderApi(BaseApi):
self._raise_response_error(response) self._raise_response_error(response)
return True 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) # print(self.__class__.__name__ + "::" + sys._getframe().f_code.co_name)
url = self.ENTRYPOINT + id + "/" url = self.ENTRYPOINT + id + "/"
params = {"recursive": recursive}
token_check(self.connection) token_check(self.connection)
response = self.connection.delete(url) response = self.connection.delete(url, params=params)
self._raise_response_error(response) self._raise_response_error(response)
return True return True

View File

@ -36,4 +36,4 @@ class RmCommand(BaseCommand):
if not args.recursive: if not args.recursive:
raise IllegalArgumentException(f"Cannot remove `{r_path}`: Is a folder.") raise IllegalArgumentException(f"Cannot remove `{r_path}`: Is a folder.")
folder_api = FolderApi(connection) folder_api = FolderApi(connection)
folder_api.destroy(folder.id) folder_api.destroy(folder.id, True)