Skip to content

feat(auth): Users.User.update() sends the rename-only PATCH - #105

Merged
ngjunsiang merged 1 commit into
mainfrom
feat/users-update
Oct 9, 2026
Merged

ngjunsiang merged 1 commit into
mainfrom
feat/users-update

Conversation

@ngjunsiang

Copy link
Copy Markdown
Contributor

Adds Users.User.update(*, name: str) -> User to the auth users resource, mirroring the server's PATCH /users/{id} contract implemented in nyjc-computing/campus#873 (campus-cli#42):

  • sends PATCH (not PUT) to /auth/v1/users/{id}/ with exactly {"name": ...} — the server accepts name only (a user's id IS its email; identity fields stay fixed; activation runs through /activate)
  • returns the updated campus.model.User from the response resource

Tests: tests/unit/test_auth_users.py asserts the PATCH verb, exact body, path, and round-tripped model — same mock convention as test_auth_clients.py.

Full suite: poetry run pytest → 276 passed.

Part of the campus-cli#42 phase-2 client work (next: campus-cli campus user sub-app).

The campus server implements PATCH /users/{id} as rename-only
(nyjc-computing/campus-cli#42): a user's id IS its email, so identity
fields stay fixed and only {"name": ...} is accepted. Mirror it in
the SDK so campus-cli's user commands can call update() directly.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant