MPT-24265 add notifications directories, footers and webhooks services - #386
Draft
jentyk wants to merge 1 commit into
Draft
Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueComment |
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
force-pushed
the
feature/MPT-24265/add-notifications-services-directories-footers-webhooks
branch
from
August 27, 2026 08:34
0b79d34 to
b0e0c42
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
Adds sync and async services for three
notificationscollection endpoints that had no service class and were therefore unreachable fromMPTClient/AsyncMPTClient:/public/v1/notifications/directoriesDirectoriesService/AsyncDirectoriesServiceGetMixin,CollectionMixin— spec documents onlyGETcollection andGET {id}/public/v1/notifications/footersFootersService/AsyncFootersServiceManagedResourceMixin,CollectionMixin—GET/POSTcollection,GET/PUT/DELETE {id}/public/v1/notifications/webhooksWebhooksService/AsyncWebhooksServiceEnableMixin,DisableMixin,ManagedResourceMixin,CollectionMixin— managed plusPOST {id}/enableandPOST {id}/disableEach module follows the existing
notifications/contacts.pyshape: aModelsubclass carrying the resource attributes documented in the spec, a<Name>ServiceConfig, and the sync/async service pair. All three are registered as properties on bothNotificationsandAsyncNotifications.Why the
pyproject.tomlchangeNotificationssat at exactly 7 methods, which is wemake-python-styleguide'smax_methodsdefault, andmpt_api_client/resources/notifications/*was absent from[tool.flake8] per-file-ignores. Adding any service to the group tripsWPS214, 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 broadermpt_api_client/resources/*entry. A more specificper-file-ignorespattern replaces the broader one rather than extending it, soWPS215has to be repeated or the pre-existing services in the group start failing. This matches how the accounts/billing/catalog entries are written.WPS110— forFooter.content, an API-mandated field name on theFootermodel.Scope
docs/usage.mdhas no service list, anddocs/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
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 webhookenable/disableactions for both sync and async.tests/unit/resources/notifications/test_notifications.py.make check-allpasses (ruff format, ruff, flake8/WPS, mypy,uv lock --check, 2416 unit tests).build_path()returns the expected/public/v1/...path, checked against the MPT OpenAPI spec.MPT-24265