diff --git a/CHANGELOG.md b/CHANGELOG.md index 6d40f3e3..88b6f0c2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ All notable changes to this project will be documented in this file. +## [0.18.0 - 2024-10-09] + +### Added + +- New `webhooks.unregister_all` method. + ## [0.17.1 - 2024-09-06] ### Added diff --git a/nc_py_api/_version.py b/nc_py_api/_version.py index 749f78f5..abaed9bd 100644 --- a/nc_py_api/_version.py +++ b/nc_py_api/_version.py @@ -1,3 +1,3 @@ """Version of nc_py_api.""" -__version__ = "0.17.1" +__version__ = "0.18.0.dev0" diff --git a/nc_py_api/webhooks.py b/nc_py_api/webhooks.py index dd124e32..16bbf1c3 100644 --- a/nc_py_api/webhooks.py +++ b/nc_py_api/webhooks.py @@ -3,7 +3,7 @@ import dataclasses from ._misc import clear_from_params_empty # , require_capabilities -from ._session import AsyncNcSessionBasic, NcSessionBasic +from ._session import AppConfig, AsyncNcSessionBasic, NcSessionBasic @dataclasses.dataclass @@ -140,6 +140,13 @@ def update( def unregister(self, webhook_id: int) -> bool: return self._session.ocs("DELETE", f"{self._ep_base}/{webhook_id}") + def unregister_all(self, appid: str = "") -> int: + if not appid and isinstance(self._session.cfg, AppConfig): + appid = self._session.cfg.app_name + else: + raise ValueError("The `appid` parameter cannot be empty for non-ExApp use.") + return self._session.ocs("DELETE", f"{self._ep_base}/byappid/{appid}") + class _AsyncWebhooksAPI: """The class provides the async application management API on the Nextcloud server.""" @@ -208,3 +215,10 @@ async def update( async def unregister(self, webhook_id: int) -> bool: return await self._session.ocs("DELETE", f"{self._ep_base}/{webhook_id}") + + async def unregister_all(self, appid: str = "") -> int: + if not appid and isinstance(self._session.cfg, AppConfig): + appid = self._session.cfg.app_name + else: + raise ValueError("The `appid` parameter cannot be empty for non-ExApp use.") + return await self._session.ocs("DELETE", f"{self._ep_base}/byappid/{appid}")