Add ergonomic aliases for control-plane methods#7
Open
njbrake wants to merge 1 commit into
Open
Conversation
The control-plane resources previously exposed only the OpenAPI-generator-derived method names (for example keys.create_key_v1_keys_post(...)), which leaked generator naming into the public management surface. The migrated SDK shell explicitly flagged friendlier aliases as a follow-up. Wrap each generated control-plane API (keys, users, budgets, pricing, usage) in a hand-written resource exposing ergonomic aliases (create, get, list, update, delete, plus get_usage / set / get_history). Aliases delegate to the generated methods and forward request options as kwargs. The generated core is untouched, so regeneration is unaffected, and the raw generated methods stay reachable via a `raw` accessor on each resource as an escape hatch. Fixes #107 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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
keys.create_key_v1_keys_post(...)), leaking generator naming into the public management surface. The migrated shell explicitly flagged friendlier aliases as a follow-up.keys,users,budgets,pricing,usage) now returns a hand-written wrapper exposing ergonomic aliases that delegate to the generated methods:keys:create,get,list,update,deleteusers:create,get,list,update,delete,get_usagebudgets:create,get,list,update,deletepricing:get,set,delete,get_history,listusage:listrawaccessor on each resource (e.g.keys.raw.create_key_v1_keys_post(...)) as an escape hatch._request_timeout,_headers, ...) through**kwargs.Test plan
ruff check .mypy src/tests/unit/test_control_plane_aliases.py): table-driven assertions that every alias forwards to the correct generated method with the right args, options pass through as kwargs, andrawexposes the generated API.rawescape hatch works end to end.Fixes #107
🤖 Generated with Claude Code