Repository navigation
feat: add team role management - #41
Merged
Merged
Conversation
- New methods on team: retrieve_role(role_id), create_role(body), update_role(role_id, body), delete_role(role_id, query=None) and duplicate_role(role_id, body). They use the team token and send no Idempotency-Key header. - delete_role() takes a DeleteTeamRoleQuery: pass replacement_role_id while the role is still assigned to members, invites or SCIM groups. Without it, no query parameter is sent. - create_role() and update_role() return the TeamRoleData with its description; a 409 raises ConflictError with the error code and a 422 raises ValidationError. - Remove the role operations from the coverage test's pending list. - Document the role methods in the README and test the requests, the token, the bodies with and without a description, the query with and without replacement_role_id, the role ID checks, the description value and null, and the 409 and 422 errors. Co-Authored-By: Claude <noreply@anthropic.com>
bjarn
added this pull request to stack #43
October 20, 2026 20:47
bjornftw
approved these changes
Oct 21, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changed
Non-breaking. Adds team role management as methods on
team, next to the existingteam.roles()list. Stacked on the team invites PR.team.retrieve_role(role_id)returns aTeamRoleData, now with itsdescription.team.create_role(body)creates a custom role (CreateTeamRoleData {name, description?, permissions}). It needs a plan with custom roles; permissions must include what they depend on, and names are unique within the team.team.update_role(role_id, body)replaces the name, description and permissions of a custom role. Built-in roles can't be changed.team.delete_role(role_id, query=None)deletes a custom role and returns aMessageResponse. While the role is still assigned to members, invites or SCIM groups, pass{"replacement_role_id": ...}(DeleteTeamRoleQuery), the role that receives those assignments. Without it, no query parameter is sent. Built-in roles can't be deleted.team.duplicate_role(role_id, body)copies a role under a new name (DuplicateTeamRoleData {name, description?}). Without a description, the copy keeps the source role's. The Owner role can't be duplicated.timeout; none takes an idempotency key. The optional query follows the SDK's existing pattern (domains.retrieve(domain_id, query)).409raisesConflictErrorwith the error code (for examplebuilt_in_role_immutable); a422raisesValidationError. Empty or..role IDs raiseLettermintConfigErrorbefore any request.Usage
Checks
Run locally at the tip of this branch:
python -m ruff check src tests scripts: all checks passedpython -m ruff format --check src tests scripts: 28 files already formattedpython -m mypy: no issues in 35 source filespython scripts/unasync.py --check: up to datepython scripts/generate.py --check: the generated files match the pinned spec, and the headers check that CI runs passespython -m pytest tests/ -qon Python 3.10, 3.11, 3.12, 3.13 and 3.14: 297 passed on eachpython -m build,python -m twine check --strict dist/*: passed; the wheel smoke import passesNot run locally
Nothing.
🤖 Generated with Claude Code