Skip to content

Commit ef519ae

Browse files
bigcat88pre-commit-ci[bot]Review
authored
feat: add Teams (Circles) async API (#403)
## Summary Closes #343 - Adds async-only `_AsyncTeamsAPI` module (`nc_py_api/teams.py`) for managing Nextcloud Teams (Circles) - Full CRUD: create, get_list, get_details, destroy, edit_name, edit_description, edit_config - Member management: add_member, add_members, remove_member, set_member_level, confirm_member, join, leave - Data classes: `Circle`, `Member` with typed properties - Enums: `MemberType`, `MemberLevel`, `CircleConfig` (IntFlag) - Registered on `_AsyncNextcloudBasic` — available on both `AsyncNextcloud` and `AsyncNextcloudApp` Following the async-only policy for new features — no sync variant. ## Test plan - [x] 17 async tests in `tests/actual_tests/teams_test.py` - [x] `test_teams_available` and `test_teams_create_destroy` run in both client and AppAPI modes (`anc` fixture) - [x] Circle CRUD: create, get_list, get_details, destroy, edit_name, edit_description, edit_config - [x] Member lifecycle: add_member, add_members (multi), remove_member, set_member_level - [x] Join/leave open circle flow - [x] Personal and local circle creation - [x] Error handling: destroy nonexistent circle raises `NextcloudException` - [x] Full suite: 613 passed, 6 skipped, 0 failures <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Added Teams (Circles) API: create, list, edit, delete teams; manage membership and roles; join/leave flows. * Exposed Teams-related types on the package public API. * **Tests** * Added comprehensive async integration tests covering lifecycle, membership, role changes, join/request/confirm flows, and config flags. * **Chores** * CI workflow updated to enable and configure the Circles app during test matrix runs. <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Review <review@local>
1 parent b202bd4 commit ef519ae

5 files changed

Lines changed: 736 additions & 0 deletions

File tree

.github/workflows/analysis-coverage.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,13 @@ jobs:
213213
ref: ${{ matrix.nextcloud }}
214214
path: apps/files_lock
215215

216+
- name: Checkout Circles
217+
uses: actions/checkout@v6
218+
with:
219+
repository: nextcloud/circles
220+
ref: ${{ matrix.nextcloud }}
221+
path: apps/circles
222+
216223
- name: Set up & run Nextcloud
217224
env:
218225
DB_PORT: 4444
@@ -224,6 +231,7 @@ jobs:
224231
./occ config:system:set loglevel --value=0 --type=integer
225232
./occ config:system:set debug --value=true --type=boolean
226233
./occ config:system:set ratelimit.protection.enabled --value=false --type=boolean
234+
./occ config:system:set overwrite.cli.url --value="http://localhost:8080"
227235
./occ app:enable notifications
228236
PHP_CLI_SERVER_WORKERS=2 php -S localhost:8080 &
229237
@@ -233,6 +241,9 @@ jobs:
233241
- name: Enable Notes
234242
run: ./occ app:enable notes
235243

244+
- name: Enable Circles
245+
run: php occ app:enable circles
246+
236247
- name: Checkout NcPyApi
237248
uses: actions/checkout@v6
238249
with:
@@ -379,6 +390,13 @@ jobs:
379390
ref: ${{ matrix.nextcloud }}
380391
path: apps/activity
381392

393+
- name: Checkout Circles
394+
uses: actions/checkout@v6
395+
with:
396+
repository: nextcloud/circles
397+
ref: ${{ matrix.nextcloud }}
398+
path: apps/circles
399+
382400
- name: Set up & run Nextcloud
383401
env:
384402
DB_PORT: 4444
@@ -390,10 +408,14 @@ jobs:
390408
./occ config:system:set loglevel --value=0 --type=integer
391409
./occ config:system:set debug --value=true --type=boolean
392410
./occ config:system:set ratelimit.protection.enabled --value=false --type=boolean
411+
./occ config:system:set overwrite.cli.url --value="http://localhost:8080"
393412
./occ app:enable notifications
394413
./occ app:enable activity
395414
PHP_CLI_SERVER_WORKERS=2 php -S localhost:8080 &
396415
416+
- name: Enable Circles
417+
run: php occ app:enable circles
418+
397419
- name: Checkout NcPyApi
398420
uses: actions/checkout@v6
399421
with:

nc_py_api/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,4 @@
1111
from .files import FilePermissions, FsNode, LockType, SystemTag
1212
from .files.sharing import ShareType
1313
from .nextcloud import AsyncNextcloud, AsyncNextcloudApp, Nextcloud, NextcloudApp
14+
from .teams import Circle, CircleConfig, Member, MemberLevel, MemberType

nc_py_api/nextcloud.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
from .loginflow_v2 import _AsyncLoginFlowV2API, _LoginFlowV2API
4040
from .notes import _AsyncNotesAPI
4141
from .notifications import _AsyncNotificationsAPI, _NotificationsAPI
42+
from .teams import _AsyncTeamsAPI
4243
from .user_status import _AsyncUserStatusAPI
4344
from .users import _AsyncUsersAPI, _UsersAPI
4445
from .users_groups import _AsyncUsersGroupsAPI, _UsersGroupsAPI
@@ -155,6 +156,8 @@ class _AsyncNextcloudBasic(ABC): # pylint: disable=too-many-instance-attributes
155156
"""Nextcloud API for managing user notifications"""
156157
talk: _AsyncTalkAPI
157158
"""Nextcloud Talk API"""
159+
teams: _AsyncTeamsAPI
160+
"""Nextcloud API for managing Teams (Circles)"""
158161
users: _AsyncUsersAPI
159162
"""Nextcloud API for managing users."""
160163
users_groups: _AsyncUsersGroupsAPI
@@ -176,6 +179,7 @@ def __init__(self, session: AsyncNcSessionBasic):
176179
self.notes = _AsyncNotesAPI(session)
177180
self.notifications = _AsyncNotificationsAPI(session)
178181
self.talk = _AsyncTalkAPI(session)
182+
self.teams = _AsyncTeamsAPI(session)
179183
self.users = _AsyncUsersAPI(session)
180184
self.users_groups = _AsyncUsersGroupsAPI(session)
181185
self.user_status = _AsyncUserStatusAPI(session)

0 commit comments

Comments
 (0)