fix: address PR review feedback (round 8)

- Fix inconsistent error code in set_collective_emoji (400 → -32603)
- Allow clearing emoji via set_collective_emoji(emoji=None)
- Remove destructiveHint from trash operations (soft deletes are recoverable)
- Change delete_collective to idempotentHint=False (requires trash precondition)
- Add restore_collective and get_trashed_collectives tools
- Add unit tests for ValueError guard, clear-emoji path, and new tools
- Add integration test for full trash/restore/delete lifecycle
- Verify move_page returns new title in response message

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Chris Coutinho
2026-03-27 11:26:26 +01:00
co-authored by Claude Opus 4.6
parent 7224a2ebe3
commit cb16060b1b
6 changed files with 223 additions and 12 deletions
@@ -118,6 +118,26 @@ class CollectivesClient(BaseNextcloudClient):
)
self._unwrap_ocs(response.json())
# Trash (collectives)
async def get_trashed_collectives(self) -> list[dict[str, Any]]:
"""List trashed collectives."""
response = await self._make_request(
"GET", f"{API_BASE}/collectives/trash", headers=self._OCS_HEADERS
)
data = self._unwrap_ocs(response.json())
return data["collectives"]
async def restore_collective(self, collective_id: int) -> dict[str, Any]:
"""Restore a collective from trash."""
response = await self._make_request(
"PATCH",
f"{API_BASE}/collectives/trash/{collective_id}",
headers=self._OCS_HEADERS,
)
data = self._unwrap_ocs(response.json())
return data["collective"]
# Pages
async def get_pages(self, collective_id: int) -> list[dict[str, Any]]: