feat(outbound): add token/api-key upload and connection-status list methods#1591
Conversation
…ethods
Wrap the outbound-application management REST endpoints that the SDK didn't expose,
on mgmt.outbound_application (both sync and async clients):
- upload_user_api_key / upload_tenant_api_key (apikey-type apps)
- upload_user_token / upload_tenant_token + batch_upload_{user,tenant}_tokens (oauth-type migration)
- list_apps_with_user_token (connection-status read, replaces N fetch_token calls)
The shared _compose_oauth_upload_body helper lives on OutboundApplicationBase so both
the sync and async clients reuse it.
Closes descope/etc#16568
Closes descope/etc#16569
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
🐕 Review complete — View session on Shuni Portal 🐾 |
🐕 Suggested ReviewersThe reviewers were selected based on recent activity in relevant files, coverage of different aspects of the codebase, and familiarity with outbound application and API integrations.
Suggested by Shuni based on git history and PR context. Names are not @-mentioned to avoid notifying anyone — request a review from whoever fits best. |
There was a problem hiding this comment.
🐕 Shuni's Review
Wraps the outbound-application token/api-key upload and connection-status endpoints on both the sync and async management clients, reusing a shared _compose_oauth_upload_body helper.
No issues found — good bones! Thin REST wrappers that match the existing patterns, sync/async parity is exact, the helper's positional arg order (granted_by then verify_refresh) lines up with the call sites, and tests cover the new methods. Woof!
#1584 (renovate) bumped the python_version < '3.10' pin to pytest-asyncio==1.4.0, but 1.4.0 dropped Python 3.9 support, so `uv sync --locked` / `uv lock --check` became unsatisfiable for the 3.9 split and CI's install step failed on every PR. Revert that entry to ==1.2.0 (the last release supporting 3.9) and regenerate the lock. `uv sync --all-extras --locked` succeeds again. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
9e5b0ef to
4af723c
Compare
Coverage reportThe coverage rate went from
Diff Coverage details (click to unfold)descope/management/outbound_application_async.py
descope/management/outbound_application.py
descope/management/_outbound_application_base.py
descope/management/common.py
|
Description
The outbound-application management REST API already ships these endpoints, but the Python SDK didn't wrap them. This adds them to
mgmt.outbound_applicationon both the sync and async clients:Upload / migrate credentials (descope/etc#16568)
upload_user_api_key(app_id, user_id, api_key, tenant_id=None)/upload_tenant_api_key(app_id, tenant_id, api_key)— store a static API key on an apikey-type appupload_user_token(...)/upload_tenant_token(...)— migrate an existing OAuth token without re-running the flowbatch_upload_user_tokens(tokens)/batch_upload_tenant_tokens(tokens)— all-or-nothing batch (returns per-itemfailures)Connection-status read (descope/etc#16569)
list_apps_with_user_token(user_id, tenant_id=None)— the app IDs a user holds a valid token for; replaces callingfetch_tokenonce per app and sniffing a not-found error codeThe shared
_compose_oauth_upload_bodyhelper lives onOutboundApplicationBaseso sync and async reuse it. Request bodies match the backend proto messages field-for-field (API-key field isapiKey;verify_refreshis single-upload only).Verified locally: full suite 864 passed,
ruff checkclean,mypyclean.Incidental lock fix
main's lock was already unsatisfiable: #1584 (renovate) bumped thepython_version < '3.10'pin topytest-asyncio==1.4.0, but 1.4.0 dropped Python 3.9 support, souv sync --lockedfailed CI's install step on every PR. Reverted that entry to==1.2.0(last release supporting 3.9) and regenerateduv.lock;uv sync --all-extras --lockedsucceeds again.Must
tests/management/test_outbound_application.py)🤖 Generated with Claude Code