feat: act_as_user_id service delegation (v0.5.0)#26
Open
artugro wants to merge 1 commit into
Open
Conversation
Adds an optional kwarg to both clients enabling service-level callers (wisdom-agents, any internal microservice) to operate on behalf of specific users. Closes #25. Shape - IntunoClient(api_key=..., *, act_as_user_id: UUID | str | None = None) - AsyncIntunoClient(... same ...) - When act_as_user_id is set: the client sends X-Service-Key + X-On-Behalf-Of instead of the normal X-API-Key / Bearer header. The backend (wisdom, #38) validates the service secret and attributes the request to the delegated user. - Mutually exclusive: in delegation mode the X-API-Key / Authorization header is not sent. Backward compatible: the existing constructor signature + behavior is unchanged for every caller that doesn't pass act_as_user_id. - src/intuno_sdk/client.py — _build_auth_headers switches on act_as_user_id; both client __init__ accept the new kwarg and expose it as self.act_as_user_id for introspection. - src/intuno_sdk/constants.py — SDK_VERSION → 0.5.0 - pyproject.toml — version → 0.5.0 - CHANGELOG.md — 0.5.0 entry with the pattern + example - tests/test_client.py — 4 new tests covering normal mode, delegation with UUID, delegation with string user_id, async delegation; all pre-existing 42 tests still pass. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
3 tasks
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.
Summary
Adds `act_as_user_id` kwarg to both clients so internal services (wisdom-agents, hosting multi-tenant entities) can operate on behalf of specific users without holding user-scoped API keys.
Closes: #25
Paired with:
What changes
Test plan
Usage
🤖 Generated with Claude Code