Support include=planName on List User Plans - #163
Open
adecounter wants to merge 2 commits into
Open
Conversation
GET /2.0/users/{userId}/plans gained an optional `include` query
parameter whose only accepted value is `planNames`. When requested, each
returned plan carries the name of its owning organization.
- `Users.list_user_plans` accepts an `include` kwarg, serialized
comma-separated by `prepare_request` like every other `include` param
in the SDK.
- `UserPlan` gains `plan_name`. It is optional: absent unless the
enrichment is requested, and absent for a plan whose owning
organization has no name, so it deserializes to None in both cases.
Mock tests cover the query parameter, a plan with a name, and a plan
without one. They depend on `planName` being added to the List User
Plans all-properties mapping in smartsheet-sdk-tests, which must merge
first.
📝 WalkthroughWalkthroughThe PR adds ChangesUser plan names
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related issues
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@tests/mock_api/users/test_list_user_plans.py`:
- Around line 67-76: Update both response tests, including the assertions around
the first and second user plans and the later assertion near line 99, to use
whole-object comparisons via response.to_dict() or each UserPlan.to_dict().
Build complete expected objects for every plan, including plan_name, while
preserving the existing expected values for all other fields.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: a662245a-ae39-4ad6-a313-3b945afc04af
📒 Files selected for processing (4)
CHANGELOG.mdsmartsheet/models/user_plan.pysmartsheet/users.pytests/mock_api/users/test_list_user_plans.py
The public API's include value is singular `planName`, matching the response field it controls. The gateway rewrites it to the downstream's plural spelling, so no SDK-side bridging is needed.
ggoranov-smar
approved these changes
Aug 10, 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.
Pull Request
Description
Adds support for the optional
includequery parameter on GET /2.0/users/{userId}/plans (List User Plans), and exposes the resultingplanNameon theUserPlanmodel asplan_name.Related Issue
Related Issue: #162
Type of Change
Environment Information
main)What Changes Were Made
Users.list_user_plansaccepts a newincludekeyword argument. The only value the API currently accepts isplanName, which matches the response field it controls. It is passed as a list and serialized comma-separated byprepare_request, exactly like every otherincludeparameter in the SDK, so it is forward-compatible if more values are added later.UserPlangains aplan_nameproperty, which carries the name of the plan's owning organization when the enrichment is requested.Files changed:
smartsheet/users.py-includekwarg plumbed intoquery_paramssmartsheet/models/user_plan.py- newplan_nameString field with getter/settertests/mock_api/users/test_list_user_plans.py- assertions for the query parameter and both populated/absentplan_nameCHANGELOG.md- two entries under UnreleasedWhy These Changes Were Made
Callers listing a user's plans typically want to display which organization each plan belongs to, which previously required a separate lookup per plan.
include=planNamelets the API return that name inline.plan_nameis deliberately optional and deserializes toNonein two distinct cases: when the enrichment was not requested, and when the owning organization has no name. Callers should treatNoneas "unknown" rather than "no organization".Testing
Full mock suite run against the shared WireMock mappings: 331 passed, 9 skipped (the 9 skips are pre-existing in
test_mock_serialization.pyand unrelated to this change).New/updated coverage in
tests/mock_api/users/test_list_user_plans.py:includeis present in the outgoing query string with the expected comma-separated valueplan_name == 'Acme Corporation'on the first plan of the all-properties responseplan_name is Noneon the second plan, which omits the fieldplan_name is Nonein the required-properties response, where the enrichment was not requestedThe mapping this relies on (
planNameon the List User Plans all-properties mapping) has been merged tosmartsheet-sdk-testsmainline, which is the ref CI clones, so these tests pass in CI without any additional coordination.Checklist
docs-source/- no change needed; the API and model docs are generated by autodoc from the docstrings, which are updated hereAdditional Notes
Backwards compatibility:
includedefaults toNone. When it is omitted the request is byte-identical to today's behavior - the parameter is not emitted at all, andplan_nameis simply absent from the deserialized model. No existing caller is affected.Staleness caveat: organization names are cached for roughly four hours downstream of this endpoint, so a recently renamed organization may briefly return its previous name. This is worth keeping in mind if you are using
plan_namein a UI right after a rename.Summary by CodeRabbit
New Features
plan_namefield.Documentation
Tests