SDK v1.7.3
Highlights
UserId is now a subtype of PersonId, reflecting that workspace users are internal persons in Affinity's data model. Code that receives a UserId (e.g., Note.creator_id) can now pass it directly to any API accepting PersonId — no casting required.
Changes
UserIdnow extendsPersonIdinstead ofIntId—isinstance(UserId(1), PersonId)is nowTrue. This is an intentional runtime behavior change: workspace users are internal persons in Affinity's data model. Code that usedisinstanceto distinguish users from persons should useperson.type == PersonType.INTERNALinstead.- Simplified internal casts that previously converted
UserId→int→PersonId
Documentation
- data-model.md: clarified that user IDs and person IDs share the same ID space
Quick Install
SDK only:
pip install affinity-sdkSDK + CLI:
pipx install "affinity-sdk[cli]"MCP Server for Claude Desktop (easiest - MCPB bundle):
- Install CLI:
pipx install "affinity-sdk[cli]" - (Optional) Pre-configure API key:
xaffinity config setup-key- If skipped, Claude Desktop will prompt for your API key during install
- Install xaffinity MCP in Claude Desktop (download and double-click)
Other MCP clients (Cursor, Windsurf, VS Code, etc.) require manual configuration - see MCP docs.