From 16429c1d2b08424c2e402657c22f85ad318bf9b3 Mon Sep 17 00:00:00 2001 From: Alexander Piskun Date: Wed, 9 Oct 2024 19:14:53 +0300 Subject: [PATCH 1/4] added "webhooks.unregister_all" Signed-off-by: Alexander Piskun --- CHANGELOG.md | 6 ++++++ nc_py_api/_version.py | 2 +- nc_py_api/webhooks.py | 16 +++++++++++++++- 3 files changed, 22 insertions(+), 2 deletions(-) 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}") From 786261aefdc515497c88a28069c9a2cde443b1e2 Mon Sep 17 00:00:00 2001 From: Alexander Piskun Date: Wed, 9 Oct 2024 19:38:12 +0300 Subject: [PATCH 2/4] updated CHANGELOG and AUTHORS Signed-off-by: Alexander Piskun --- AUTHORS | 1 + CHANGELOG.md | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/AUTHORS b/AUTHORS index 27823323..451859a4 100644 --- a/AUTHORS +++ b/AUTHORS @@ -6,6 +6,7 @@ answer newbie questions, and generally made NC-Py-API that much better: Alexander Piskun CooperGerman Tobias Tschech + Scott Williams A big THANK YOU goes to: diff --git a/CHANGELOG.md b/CHANGELOG.md index 88b6f0c2..588424e6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,12 @@ All notable changes to this project will be documented in this file. ### Added -- New `webhooks.unregister_all` method. +- New `webhooks.unregister_all` method. #309 + +### Fixed + +- Files: `user` and `user_path` properties in `FSNode` when Nextcloud located in in sub-path. #297 Thanks to @vwbusguy +- `files.download_directory_as_zip` method now supports upcoming Nextcloud 31. #304 ## [0.17.1 - 2024-09-06] From 1cb2021dfd0fd1800f9b271acc972de52c771097 Mon Sep 17 00:00:00 2001 From: Alexander Piskun Date: Wed, 9 Oct 2024 19:38:36 +0300 Subject: [PATCH 3/4] removed tests for Nextcloud "master" branch Signed-off-by: Alexander Piskun --- .github/workflows/analysis-coverage.yml | 53 +++++-------------------- 1 file changed, 9 insertions(+), 44 deletions(-) diff --git a/.github/workflows/analysis-coverage.yml b/.github/workflows/analysis-coverage.yml index 9d7f9338..6019fe92 100644 --- a/.github/workflows/analysis-coverage.yml +++ b/.github/workflows/analysis-coverage.yml @@ -439,7 +439,7 @@ jobs: strategy: fail-fast: false matrix: - nextcloud: [ 'stable28', 'stable29', 'master' ] + nextcloud: [ 'stable28', 'stable29', 'stable30' ] timeout-minutes: 60 services: @@ -483,7 +483,6 @@ jobs: - name: Checkout Notes uses: actions/checkout@v4 - if: ${{ !startsWith(matrix.nextcloud, 'master') }} with: repository: nextcloud/notes ref: "main" @@ -491,7 +490,6 @@ jobs: - name: Checkout Files Locking uses: actions/checkout@v4 - if: ${{ !startsWith(matrix.nextcloud, 'master') }} with: repository: nextcloud/files_lock ref: ${{ matrix.nextcloud }} @@ -511,11 +509,9 @@ jobs: PHP_CLI_SERVER_WORKERS=2 php -S localhost:8080 & - name: Enable Files Locking - if: ${{ !startsWith(matrix.nextcloud, 'master') }} run: ./occ app:enable files_lock - name: Enable Notes - if: ${{ !startsWith(matrix.nextcloud, 'master') }} run: ./occ app:enable notes - name: Checkout NcPyApi @@ -528,7 +524,7 @@ jobs: run: python3 -m pip -v install ".[dev]" - name: Checkout AppAPI - if: ${{ matrix.nextcloud != 'master' }} + if: ${{ matrix.nextcloud != 'stable30' }} uses: actions/checkout@v4 with: path: apps/app_api @@ -536,7 +532,7 @@ jobs: ref: stable29 - name: Checkout AppAPI - if: ${{ matrix.nextcloud == 'master' }} + if: ${{ matrix.nextcloud == 'stable30' }} uses: actions/checkout@v4 with: path: apps/app_api @@ -555,20 +551,12 @@ jobs: kill -15 $(cat /tmp/_install.pid) timeout 3m tail --pid=$(cat /tmp/_install.pid) -f /dev/null - - name: Talk Branch Main - if: ${{ startsWith(matrix.nextcloud, 'master') }} - run: echo "TALK_BRANCH_NAME=main" >> $GITHUB_ENV - - - name: Talk Branch Other - if: ${{ !startsWith(matrix.nextcloud, 'master') }} - run: echo "TALK_BRANCH_NAME=${{ matrix.nextcloud }}" >> $GITHUB_ENV - - name: Checkout Talk uses: actions/checkout@v4 with: path: apps/spreed repository: nextcloud/spreed - ref: ${{ env.TALK_BRANCH_NAME }} + ref: ${{ matrix.nextcloud }} - name: Install Talk working-directory: apps/spreed @@ -627,7 +615,7 @@ jobs: strategy: fail-fast: false matrix: - nextcloud: [ 'stable28', 'stable29', 'master' ] + nextcloud: [ 'stable28', 'stable29', 'stable30' ] env: NC_dbname: nextcloud_abz DATABASE_PGSQL: 1 @@ -704,7 +692,7 @@ jobs: run: python3 -m pip -v install ".[dev]" - name: Checkout AppAPI - if: ${{ matrix.nextcloud != 'master' }} + if: ${{ matrix.nextcloud != 'stable30' }} uses: actions/checkout@v4 with: path: apps/app_api @@ -712,7 +700,7 @@ jobs: ref: stable29 - name: Checkout AppAPI - if: ${{ matrix.nextcloud == 'master' }} + if: ${{ matrix.nextcloud == 'stable30' }} uses: actions/checkout@v4 with: path: apps/app_api @@ -731,20 +719,12 @@ jobs: kill -15 $(cat /tmp/_install.pid) timeout 3m tail --pid=$(cat /tmp/_install.pid) -f /dev/null - - name: Talk Branch Main - if: ${{ startsWith(matrix.nextcloud, 'master') }} - run: echo "TALK_BRANCH_NAME=main" >> $GITHUB_ENV - - - name: Talk Branch Other - if: ${{ !startsWith(matrix.nextcloud, 'master') }} - run: echo "TALK_BRANCH_NAME=${{ matrix.nextcloud }}" >> $GITHUB_ENV - - name: Checkout Talk uses: actions/checkout@v4 with: path: apps/spreed repository: nextcloud/spreed - ref: ${{ env.TALK_BRANCH_NAME }} + ref: ${{ matrix.nextcloud }} - name: Install Talk working-directory: apps/spreed @@ -808,7 +788,7 @@ jobs: strategy: fail-fast: false matrix: - nextcloud: [ 'stable27', 'stable28', 'stable29', 'master' ] + nextcloud: [ 'stable27', 'stable28', 'stable29', 'stable30', 'master' ] env: NEXTCLOUD_URL: "http://localhost:8080/index.php" timeout-minutes: 60 @@ -884,21 +864,6 @@ jobs: working-directory: nc_py_api run: python3 -m pip -v install . pytest pytest-asyncio coverage pillow - - name: Talk Branch Main - if: ${{ startsWith(matrix.nextcloud, 'master') }} - run: echo "TALK_BRANCH_NAME=main" >> $GITHUB_ENV - - - name: Talk Branch Other - if: ${{ !startsWith(matrix.nextcloud, 'master') }} - run: echo "TALK_BRANCH_NAME=${{ matrix.nextcloud }}" >> $GITHUB_ENV - - - name: Checkout Talk - uses: actions/checkout@v4 - with: - path: apps/spreed - repository: nextcloud/spreed - ref: ${{ env.TALK_BRANCH_NAME }} - - name: Install Talk working-directory: apps/spreed run: make dev-setup From 5434342a11e866a28a1402f52efbf2364e3dd221 Mon Sep 17 00:00:00 2001 From: Alexander Piskun Date: Wed, 9 Oct 2024 19:49:28 +0300 Subject: [PATCH 4/4] removed tests for Nextcloud "master" branch (2) Signed-off-by: Alexander Piskun --- .github/workflows/analysis-coverage.yml | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/.github/workflows/analysis-coverage.yml b/.github/workflows/analysis-coverage.yml index 6019fe92..8022f3f3 100644 --- a/.github/workflows/analysis-coverage.yml +++ b/.github/workflows/analysis-coverage.yml @@ -537,6 +537,7 @@ jobs: with: path: apps/app_api repository: nextcloud/app_api + ref: stable30 - name: Install AppAPI run: | @@ -705,6 +706,7 @@ jobs: with: path: apps/app_api repository: nextcloud/app_api + ref: stable30 - name: Install AppAPI run: | @@ -864,13 +866,6 @@ jobs: working-directory: nc_py_api run: python3 -m pip -v install . pytest pytest-asyncio coverage pillow - - name: Install Talk - working-directory: apps/spreed - run: make dev-setup - - - name: Enable Talk - run: php occ app:enable spreed - - name: Generate coverage report working-directory: nc_py_api run: coverage run -m pytest && coverage xml -o coverage_sqlite_${{ matrix.nextcloud }}_client.xml