MPT-24263 add accounts account-users and services services - #388
Draft
jentyk wants to merge 1 commit into
Draft
Conversation
|
Warning Review limit reached
On-demand reviews are free for the next 24 days. After that, they cost $0.25 per reviewed file. Or wait 48 minutes for your next included review. View limit detailsLimit details: You’ve used all 5 included reviews currently available. Your 29 included PR review attempts over the past 7 days set your current allowance at 5 reviews per hour. Review configuration: ⚙️ Run configurationConfiguration used: Repository YAML (base), Organization UI (inherited) Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (6)
Comment |
The accounts group had no service for the top-level
/public/v1/accounts/account-users and /public/v1/accounts/services
endpoints, so both collections were unreachable from MPTClient and
AsyncMPTClient.
Add AccountUsersService and ServicesService (plus their async mirrors)
following the existing resource-service pattern, and expose them as
`account_users` and `services` properties on both Accounts and
AsyncAccounts.
Mixins are picked from what the OpenAPI spec documents for each
endpoint rather than assuming full CRUD: account-users supports
list, create, get, delete and the invite actions but no update, and
services is read-only with list and get.
The new module is account_users.py, distinct from the pre-existing
accounts_users.py, which serves the nested
/public/v1/accounts/accounts/{account_id}/users resource.
Streaming support for these endpoints is tracked separately in
MPT-24241 and is not part of this change.
MPT-24263
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
jentyk
force-pushed
the
feature/MPT-24263/add-accounts-account-users-services
branch
from
August 27, 2026 08:31
a30a3a0 to
69f1c19
Compare
|
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.



🤖 AI-generated PR — Please review carefully.
What was done
Two
accountscollection endpoints documented in the Marketplace OpenAPI spec had no clientservice, so they were unreachable from
MPTClient/AsyncMPTClient. This PR adds them./public/v1/accounts/account-usersmpt_api_client/resources/accounts/account_users.pyaccounts.account_usersAccountUsersService/AsyncAccountUsersService/public/v1/accounts/servicesmpt_api_client/resources/accounts/services.pyaccounts.servicesServicesService/AsyncServicesServiceEach module follows the existing resource-service pattern: a
Modelsubclass with thedocumented attributes, a shared
<Name>ServiceConfig(_endpoint,_model_class,_collection_key = "data"), and a sync service plus its async mirror. Both are exposed as@propertyonAccountsandAsyncAccounts.Mixin selection
Mixins were chosen from what the OpenAPI spec actually documents per endpoint, not from an
assumed CRUD shape:
account-users— spec hasGET/POSTon the collection,GET/DELETEon/{id}, andthe
accept-invite,resend-invite,send-new-inviteactions. So:CreateMixin,GetMixin,DeleteMixin,InvitableMixin,CollectionMixin.Deliberately no
UpdateMixin— the spec documents noPUT/PATCHon/{id}.services— spec hasGETon the collection and on/{id}only, so the service isread-only:
GetMixin,CollectionMixin.Naming
account_users.pyis a new module and is not the same resource as the pre-existingaccounts_users.py, whose endpoint is/public/v1/accounts/accounts/{account_id}/users(users nested under a specific account).
accounts_users.pyis untouched.The model in
services.pyis namedServiceIdentityrather thanServicebecausempt_api_client.http.Serviceis the service base class imported in the same module. The specitself calls the resource a "service identity" (
List service identities/Get service identity by ID).Out of scope
MPT-Streaming) support for these endpoints is tracked in MPT-24241./public/v1/accounts/account-users/{id}/groupsis a separate nested sub-collection endpointand is not one of the two endpoints named in MPT-24263, so no sub-service was added for it.
Documentation
No docs were changed, deliberately — this is not an omission. Neither
docs/usage.mdnordocs/architecture.mdenumerates individual services:usage.mdhas no service list, and theresource tree in
architecture.mdis group-granular with ellipses(
accounts/ # Account, Users, Buyers, Sellers, API Tokens, …), so the two new services arealready covered by the existing text.
Testing
make check-allpasses — ruff format, ruff, flake8/WPS, mypy,uv lock --check, and the fullunit suite (2386 passed). Both new modules report 100% coverage.
New unit tests:
tests/unit/resources/accounts/test_account_users.py— path, documented methods present,updateabsent.tests/unit/resources/accounts/test_services.py— path,getpresent, write methods absent.tests/unit/resources/accounts/test_accounts.py— both new services added to the sync andasync parametrized group-property lists.
Reachability was verified against a real client instance rather than assumed — each property
resolves to the expected class and
build_path()returns the spec path:No
pyproject.tomlchange was needed:mpt_api_client/resources/accounts/*.pyalready carriesWPS214/WPS235in the per-file ignores.MPT-24263