Skip to content

feat(subscriptions): channel mode + reset (PR 7/7) - #519

Open
sarthak688 wants to merge 8 commits into
feat/subscriptions-publisher-updatesfrom
feat/subscriptions-mode-reset
Open

feat(subscriptions): channel mode + reset (PR 7/7)#519
sarthak688 wants to merge 8 commits into
feat/subscriptions-publisher-updatesfrom
feat/subscriptions-mode-reset

Conversation

@sarthak688

Copy link
Copy Markdown
Contributor

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

Layer Method Signature
Service subscriptions.updateMode() updateMode(tenantId: string, publisherId: string, mode: AllowedMode): Promise<SubscriptionUpdateModeResponse>
Service subscriptions.reset() reset(tenantId: string, publisherId: string): Promise<SubscriptionGetResponse>

Endpoints Called

Method HTTP Endpoint OAuth Scope
updateMode() POST notificationservice_/usersubscriptionservice/api/v1/UserSubscription/UpdateMode NotificationService
reset() POST notificationservice_/usersubscriptionservice/api/v1/UserSubscription/Reset NotificationService
  • updateMode activates/deactivates a single channel (Email/Slack/Teams) for a publisher. The mode argument is { name: NotificationMode, isActive: boolean }. Pair with getSupportedChannels first to avoid activating a channel that's disabled at the tenant level.
  • reset is special among the writes — it returns the publisher's post-reset subscription state (same shape as getAll), not an empty operation response. Useful for refreshing client state after a reset without an extra round-trip.

Example Usage

import { NotificationMode } from '@uipath/uipath-typescript/notifications';

// Activate email delivery for a publisher
await subscriptions.updateMode(tenantId, '<publisherId>', {
  name: NotificationMode.Email,
  isActive: true,
});

// Restore a publisher's subscriptions to defaults; response includes new state
const { publishers } = await subscriptions.reset(tenantId, '<publisherId>');

API Response vs SDK Response

Method SDK Response
updateMode { success: true, data: { publisherId, mode } }
reset { publishers: [...] } (same shape as getAll/getPublishers)

Verification

Check Status
npm run typecheck ✅ clean
npm run lint ✅ 0 warnings, 0 errors
npm run test:unit ✅ 1833 tests across 65 files (36 in notification suite — full PR 1→7 coverage)
npm run build dist/notifications/index.{mjs,cjs,d.ts} produced

Integration: reset round-trip — call reset on the first visible publisher, confirm the response includes that publisher. updateMode is unit-only because it needs an active Slack/Teams channel on the test tenant to exercise the full path.

Files

Area Files
Endpoint constants src/utils/constants/endpoints/notification.ts (UPDATE_MODE, RESET)
Models src/models/notification/subscriptions.models.ts (SubscriptionUpdateModeResponse + ServiceModel methods)
Service src/services/notification/subscriptions.ts
Unit tests tests/unit/services/notification/subscriptions.test.ts (+5 tests)
Integration tests tests/integration/shared/notification/subscriptions.integration.test.ts (+1 reset test)
Docs docs/oauth-scopes.md

End-of-Stack Summary

This PR closes the 7-PR stack onboarding the Notifications + Subscriptions services:

# Branch Methods PR
1 feat/notifications-sdk getAll #512
2 feat/notifications-mark-read markRead, markUnread, markAllRead #513
3 feat/notifications-delete deleteNotifications, deleteAll #514
4 feat/subscriptions-sdk getAll, getPublishers, getSupportedChannels #516
5 feat/subscriptions-topic-updates updateTopic, updateCategory #517
6 feat/subscriptions-publisher-updates updatePublisher, updateTopicGroup #518
7 feat/subscriptions-mode-reset (this PR) updateMode, reset

Total: 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

sarthak688 and others added 7 commits June 12, 2026 11:52
Establishes the notification service module with the inbox listing
endpoint. Routes at the organization level via NOTIFICATION_BASE
(URL-traversal trick to bypass the tenant segment). tenantId is taken
as a positional argument and forwarded via X-UIPATH-Internal-TenantId.

Foundation included for follow-up PRs that add the remaining inbox and
subscription methods on top of this branch:
  - @uipath/uipath-typescript/notifications subpath in package.json + rollup
  - NOTIFICATION_BASE, NOTIFICATION_ENDPOINTS scaffold
  - test infra (NOTIFICATION_TEST_TENANT_ID env var, test-config,
    unified-setup registration, notification mock factories, constants)
  - oauth-scopes + pagination + mkdocs nav entries

Methods: getAll (paginated OData listing with $top/$skip/$count,
filter, orderby; transformFn drops 8 internal/transport fields).

Tests: 4 unit + 4 integration (skipped when NOTIFICATION_TEST_TENANT_ID
is not set).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…llRead)

Adds the three read-state mutation methods on top of the foundation
established in feat/notifications-sdk. All three POST to the
NotificationEntry.UpdateRead OData action; markAllRead uses the
server-side forceAllRead flag.

Adds UPDATE_READ endpoint constant and per-method telemetry decorators.

Tests: 6 additional unit tests + 2 integration tests (mark/unmark
round-trip + markAllRead).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds the two delete methods. Both POST to the NotificationEntry.DeleteBulk
OData action; deleteAll uses the server-side deleteAll flag.

Preserves the API spec's misspelling `notifcationIds` in the request body —
the server expects that exact (mistyped) key.

Tests: 4 additional unit tests. No integration tests — these destructively
mutate the inbox with no SDK-level undo.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Adds the SubscriptionService class alongside the existing
NotificationService. Both services live under
@uipath/uipath-typescript/notifications as discrete classes (no shared
state). Subscription endpoints route through the same notificationservice_
base via the URL-traversal trick.

Methods: getAll, getPublishers, getSupportedChannels — the three read-side
methods that return user subscription state and tenant channel availability.
Mutation methods land in follow-up PRs.

Adds SUBSCRIPTION_ENDPOINTS scaffold (3 read URLs), subscription model
types (SubscriptionPublisher, SubscriptionTopic, SubscriptionMode,
SupportedChannel, AllowedMode, options types), subscription test
infrastructure (mock factories), Subscriptions section in oauth-scopes
and mkdocs nav, and Subscriptions registration in unified-setup.

Tests: 8 unit + 4 integration.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…gory)

Adds the two topic/category-scoped subscription writes. Each entry in
the payload sets the subscription state for a single (topic, mode) or
(category, mode) pair.

UPDATE_TOPIC reuses the same URL as GET_ALL — POST vs GET differentiates.

Adds TopicSubscriptionUpdate and CategorySubscriptionUpdate types,
response types, oauth-scopes entries, and unit + integration tests
(updateTopic round-trip; updateCategory unit-only because it needs
richer tenant fixtures).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…er, updateTopicGroup)

Adds the two broader-scope subscription writes:
- updatePublisher: opt-in/out at the publisher level, optionally scoped
  to specific entities (folders, etc.)
- updateTopicGroup: scope a named topic group to a set of entities

API spec misspells the publisher key as `publisherID`; the SDK preserves
the typo at send time and keeps the public surface clean (`publisherId`).

Adds PublisherSubscriptionUpdate + TopicGroupSubscriptionUpdate types,
response types, oauth-scopes entries, 5 new unit tests, and an
updatePublisher round-trip integration test.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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>
@claude

claude Bot commented Jun 12, 2026

Copy link
Copy Markdown
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>
@claude

claude Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

✅ No issues found. Checked for bugs and CLAUDE.md compliance.

@sarthak688
sarthak688 force-pushed the feat/subscriptions-publisher-updates branch from 6544536 to 71115d6 Compare July 22, 2026 06:15
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