feat(subscriptions): channel mode + reset (PR 7/7)#519
Open
sarthak688 wants to merge 2 commits into
Open
Conversation
Final two methods completing the Subscriptions service: - updateMode: activate/deactivate a notification channel (Email/Slack/Teams) for a publisher. Check getSupportedChannels first. - reset: restore a publisher's subscriptions to its defaults, returning the post-reset state. Adds UPDATE_MODE + RESET endpoints, SubscriptionUpdateModeResponse type, oauth-scopes entries, 5 new unit tests, and a reset integration test. This completes the 7-PR stack onboarding the Notification + Subscriptions services (15 methods total). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
|
✅ No issues found. Checked for bugs and CLAUDE.md compliance. |
…pes entries Final piece of the @internal treatment across the 7-PR stack. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
|
✅ No issues found. Checked for bugs and CLAUDE.md compliance. |
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.
PR 7/7 — final PR in the Notification SDK stack. Stacked on top of #518. Completes the 15-method onboarding.
Adds the last two Subscriptions methods: channel activation and restore-defaults.
Methods Added
subscriptions.updateMode()updateMode(tenantId: string, publisherId: string, mode: AllowedMode): Promise<SubscriptionUpdateModeResponse>subscriptions.reset()reset(tenantId: string, publisherId: string): Promise<SubscriptionGetResponse>Endpoints Called
updateMode()notificationservice_/usersubscriptionservice/api/v1/UserSubscription/UpdateModeNotificationServicereset()notificationservice_/usersubscriptionservice/api/v1/UserSubscription/ResetNotificationServiceupdateModeactivates/deactivates a single channel (Email/Slack/Teams) for a publisher. Themodeargument is{ name: NotificationMode, isActive: boolean }. Pair withgetSupportedChannelsfirst to avoid activating a channel that's disabled at the tenant level.resetis special among the writes — it returns the publisher's post-reset subscription state (same shape asgetAll), not an empty operation response. Useful for refreshing client state after a reset without an extra round-trip.Example Usage
API Response vs SDK Response
updateMode{ success: true, data: { publisherId, mode } }reset{ publishers: [...] }(same shape asgetAll/getPublishers)Verification
npm run typechecknpm run lintnpm run test:unitnpm run builddist/notifications/index.{mjs,cjs,d.ts}producedIntegration:
resetround-trip — call reset on the first visible publisher, confirm the response includes that publisher.updateModeis unit-only because it needs an active Slack/Teams channel on the test tenant to exercise the full path.Files
src/utils/constants/endpoints/notification.ts(UPDATE_MODE,RESET)src/models/notification/subscriptions.models.ts(SubscriptionUpdateModeResponse+ ServiceModel methods)src/services/notification/subscriptions.tstests/unit/services/notification/subscriptions.test.ts(+5 tests)tests/integration/shared/notification/subscriptions.integration.test.ts(+1 reset test)docs/oauth-scopes.mdEnd-of-Stack Summary
This PR closes the 7-PR stack onboarding the Notifications + Subscriptions services:
feat/notifications-sdkgetAllfeat/notifications-mark-readmarkRead,markUnread,markAllReadfeat/notifications-deletedeleteNotifications,deleteAllfeat/subscriptions-sdkgetAll,getPublishers,getSupportedChannelsfeat/subscriptions-topic-updatesupdateTopic,updateCategoryfeat/subscriptions-publisher-updatesupdatePublisher,updateTopicGroupfeat/subscriptions-mode-reset(this PR)updateMode,resetTotal: 15 methods, 36 unit tests, 11 integration tests across 7 reviewable PRs. Each PR builds on the previous one; merge top-down.
Replaces #500.
🤖 Generated with Claude Code