Skip to content

MPT-24265 add notifications directories, footers and webhooks services - #386

Draft
jentyk wants to merge 1 commit into
mainfrom
feature/MPT-24265/add-notifications-services-directories-footers-webhooks
Draft

MPT-24265 add notifications directories, footers and webhooks services#386
jentyk wants to merge 1 commit into
mainfrom
feature/MPT-24265/add-notifications-services-directories-footers-webhooks

Conversation

@jentyk

@jentyk jentyk commented Aug 21, 2026

Copy link
Copy Markdown
Member

🤖 AI-generated PR — Please review carefully.

📚 Bottom of a two-PR stack. #389 (MPT-24266, templates and template variants) is stacked on this branch and will retarget to main once this merges. Merge this one first.

What

Adds sync and async services for three notifications collection endpoints that had no service class and were therefore unreachable from MPTClient / AsyncMPTClient:

Endpoint Service Mixins (per OpenAPI spec)
/public/v1/notifications/directories DirectoriesService / AsyncDirectoriesService GetMixin, CollectionMixin — spec documents only GET collection and GET {id}
/public/v1/notifications/footers FootersService / AsyncFootersService ManagedResourceMixin, CollectionMixinGET/POST collection, GET/PUT/DELETE {id}
/public/v1/notifications/webhooks WebhooksService / AsyncWebhooksService EnableMixin, DisableMixin, ManagedResourceMixin, CollectionMixin — managed plus POST {id}/enable and POST {id}/disable

Each module follows the existing notifications/contacts.py shape: a Model subclass carrying the resource attributes documented in the spec, a <Name>ServiceConfig, and the sync/async service pair. All three are registered as properties on both Notifications and AsyncNotifications.

Why the pyproject.toml change

Notifications sat at exactly 7 methods, which is wemake-python-styleguide's max_methods default, and mpt_api_client/resources/notifications/* was absent from [tool.flake8] per-file-ignores. Adding any service to the group trips WPS214, so the group now carries the same ignore every other 8+ method group (Catalog, Billing, Helpdesk, Accounts) already has.

The new entry is mpt_api_client/resources/notifications/*.py: WPS110 WPS214 WPS215:

  • WPS214 — the max-methods threshold described above.
  • WPS215 — previously inherited from the broader mpt_api_client/resources/* entry. A more specific per-file-ignores pattern replaces the broader one rather than extending it, so WPS215 has to be repeated or the pre-existing services in the group start failing. This matches how the accounts/billing/catalog entries are written.
  • WPS110 — for Footer.content, an API-mandated field name on the Footer model.

Scope

  • Streaming support for these endpoints is not in scope; it is tracked separately in MPT-24241.
  • No e2e tests, per the subtask scope.
  • Docs were deliberately not touched. docs/usage.md has no service list, and docs/architecture.md's resource tree is group-granular with ellipses (notifications/ # Messages, Batches, Subscribers, …), so new services are already absorbed by the existing text. Appending to that line would collide with sibling branches working on other resource groups for no reader benefit.

Testing

  • New unit test modules: tests/unit/resources/notifications/test_directories.py, test_footers.py, test_webhooks.py — endpoint paths, mixin presence (and absence of write mixins on the read-only directories service), model field mapping, and the webhook enable/disable actions for both sync and async.
  • All three services added to the parametrized property lists in tests/unit/resources/notifications/test_notifications.py.
  • make check-all passes (ruff format, ruff, flake8/WPS, mypy, uv lock --check, 2416 unit tests).
  • Reachability verified against a constructed client: every new property resolves and build_path() returns the expected /public/v1/... path, checked against the MPT OpenAPI spec.

MPT-24265

@coderabbitai

coderabbitai Bot commented Aug 21, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

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-24265

Generated by 🚫 dangerJS against b0e0c42

The /public/v1/notifications/directories, /public/v1/notifications/footers
and /public/v1/notifications/webhooks collection endpoints had no service
class, so they were unreachable from MPTClient and AsyncMPTClient. Add sync
and async services for all three and register them as properties on the
Notifications group.

Mixins follow what the OpenAPI spec documents per endpoint: directories are
read-only (GET collection and GET by id), footers are fully managed, and
webhooks are managed with enable/disable actions.

Adding any service to Notifications pushes the group class past
wemake-python-styleguide's max_methods default of 7, which it was sitting
exactly on, so mpt_api_client/resources/notifications/*.py needs a
per-file-ignores entry for WPS214, as every other group at 8+ methods
already has. The entry also repeats WPS215 (previously inherited from the
broader mpt_api_client/resources/* pattern, which a more specific entry
replaces rather than extends) and adds WPS110 for the API-mandated
Footer.content field name.

Streaming support for these endpoints is out of scope and tracked
separately in MPT-24241.

MPT-24265

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@jentyk
jentyk force-pushed the feature/MPT-24265/add-notifications-services-directories-footers-webhooks branch from 0b79d34 to b0e0c42 Compare August 27, 2026 08:34
@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