feat(circles): create_circle + add_member_to_circle (v0.7.0)

- acccreatefamily endpoint creates a new circle (returns numeric ID)
- accinvite endpoint invites new users by email (familyId, identifier, role, firstname)
- fw_client now detects a00.ex errors (was only checking a00.un before)
- New modules/circles.py with FamilyRoleTypeEnum constants
- SPEC.md updated with acccreatefamily, accinvite, accupdatefamily docs
- Note: circle deletion not supported by FW API (metadelete → "delete not supported")
- Note: accinvite only works for new (non-existing) FW accounts

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-16 17:59:20 +02:00
parent 498d5781c5
commit 2bc03e2165
8 changed files with 255 additions and 14 deletions
+11 -6
View File
@@ -185,12 +185,17 @@ class FamilyWallClient:
msg = f"API error from {endpoint!r}: {error_data}"
raise FamilyWallError(msg, response_data=body)
# Some endpoints (e.g. taskupdate2) return per-call errors nested under
# a00.un.un instead of top-level — detect and surface them.
# Some endpoints return per-call errors nested under a00.un.un or a00.ex.ex
# instead of top-level — detect and surface them.
a00 = body.get("a00", {})
if isinstance(a00, dict) and "un" in a00:
nested = a00["un"]
msg = f"API error from {endpoint!r}: {nested}"
raise FamilyWallError(msg, response_data=body)
if isinstance(a00, dict):
if "un" in a00:
nested = a00["un"]
msg = f"API error from {endpoint!r}: {nested}"
raise FamilyWallError(msg, response_data=body)
if "ex" in a00:
nested = a00["ex"]
msg = f"API error from {endpoint!r}: {nested}"
raise FamilyWallError(msg, response_data=body)
return body