Skip to content

MPT-24263 add accounts account-users and services services - #388

Draft
jentyk wants to merge 1 commit into
mainfrom
feature/MPT-24263/add-accounts-account-users-services
Draft

MPT-24263 add accounts account-users and services services#388
jentyk wants to merge 1 commit into
mainfrom
feature/MPT-24263/add-accounts-account-users-services

Conversation

@jentyk

@jentyk jentyk commented Aug 21, 2026

Copy link
Copy Markdown
Member

🤖 AI-generated PR — Please review carefully.

What was done

Two accounts collection endpoints documented in the Marketplace OpenAPI spec had no client
service, so they were unreachable from MPTClient / AsyncMPTClient. This PR adds them.

Endpoint Module Group property Service classes
/public/v1/accounts/account-users mpt_api_client/resources/accounts/account_users.py accounts.account_users AccountUsersService / AsyncAccountUsersService
/public/v1/accounts/services mpt_api_client/resources/accounts/services.py accounts.services ServicesService / AsyncServicesService

Each module follows the existing resource-service pattern: a Model subclass with the
documented attributes, a shared <Name>ServiceConfig (_endpoint, _model_class,
_collection_key = "data"), and a sync service plus its async mirror. Both are exposed as
@property on Accounts and AsyncAccounts.

Mixin selection

Mixins were chosen from what the OpenAPI spec actually documents per endpoint, not from an
assumed CRUD shape:

  • account-users — spec has GET/POST on the collection, GET/DELETE on /{id}, and
    the accept-invite, resend-invite, send-new-invite actions. So:
    CreateMixin, GetMixin, DeleteMixin, InvitableMixin, CollectionMixin.
    Deliberately no UpdateMixin — the spec documents no PUT/PATCH on /{id}.
  • services — spec has GET on the collection and on /{id} only, so the service is
    read-only: GetMixin, CollectionMixin.

Naming

account_users.py is a new module and is not the same resource as the pre-existing
accounts_users.py, whose endpoint is /public/v1/accounts/accounts/{account_id}/users
(users nested under a specific account). accounts_users.py is untouched.

The model in services.py is named ServiceIdentity rather than Service because
mpt_api_client.http.Service is the service base class imported in the same module. The spec
itself calls the resource a "service identity" (List service identities / Get service identity by ID).

Out of scope

  • Streaming (MPT-Streaming) support for these endpoints is tracked in MPT-24241.
  • /public/v1/accounts/account-users/{id}/groups is a separate nested sub-collection endpoint
    and is not one of the two endpoints named in MPT-24263, so no sub-service was added for it.
  • No e2e tests in this subtask.

Documentation

No docs were changed, deliberately — this is not an omission. Neither docs/usage.md nor
docs/architecture.md enumerates individual services: usage.md has no service list, and the
resource tree in architecture.md is group-granular with ellipses
(accounts/ # Account, Users, Buyers, Sellers, API Tokens, …), so the two new services are
already covered by the existing text.

Testing

make check-all passes — ruff format, ruff, flake8/WPS, mypy, uv lock --check, and the full
unit suite (2386 passed). Both new modules report 100% coverage.

New unit tests:

  • tests/unit/resources/accounts/test_account_users.py — path, documented methods present,
    update absent.
  • tests/unit/resources/accounts/test_services.py — path, get present, write methods absent.
  • tests/unit/resources/accounts/test_accounts.py — both new services added to the sync and
    async 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:

sync  accounts.account_users  -> AccountUsersService       /public/v1/accounts/account-users
sync  accounts.services       -> ServicesService           /public/v1/accounts/services
async accounts.account_users  -> AsyncAccountUsersService  /public/v1/accounts/account-users
async accounts.services       -> AsyncServicesService      /public/v1/accounts/services

No pyproject.toml change was needed: mpt_api_client/resources/accounts/*.py already carries
WPS214/WPS235 in the per-file ignores.

MPT-24263

@coderabbitai

coderabbitai Bot commented Aug 21, 2026

Copy link
Copy Markdown

Warning

Review limit reached

  • Run on-demand review

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 details

Limit 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.

Learn how review limits work.

Review configuration:

⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: CHILL

Plan: Pro

Run ID: ef5bbc95-2add-44aa-b90b-2fefbe3e5574

📥 Commits

Reviewing files that changed from the base of the PR and between 93e9552 and 69f1c19.

📒 Files selected for processing (6)
  • mpt_api_client/resources/accounts/account_users.py
  • mpt_api_client/resources/accounts/accounts.py
  • mpt_api_client/resources/accounts/services.py
  • tests/unit/resources/accounts/test_account_users.py
  • tests/unit/resources/accounts/test_accounts.py
  • tests/unit/resources/accounts/test_services.py

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Aug 21, 2026

Copy link
Copy Markdown

✅ Found Jira issue key in the title: MPT-24263

Generated by 🚫 dangerJS against 69f1c19

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
jentyk force-pushed the feature/MPT-24263/add-accounts-account-users-services branch from a30a3a0 to 69f1c19 Compare August 27, 2026 08:31
@sonarqubecloud

Copy link
Copy Markdown

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant