Skip to content

feat(notifications): delete flows (PR 3/7)#514

Open
sarthak688 wants to merge 2 commits into
feat/notifications-mark-readfrom
feat/notifications-delete
Open

feat(notifications): delete flows (PR 3/7)#514
sarthak688 wants to merge 2 commits into
feat/notifications-mark-readfrom
feat/notifications-delete

Conversation

@sarthak688

Copy link
Copy Markdown

PR 3/7 in the Notification SDK stack. Stacked on top of #513.

Adds the two delete methods. Both POST to the same DeleteBulk OData action endpoint; deleteAll uses the server-side deleteAll flag.

Methods Added

Layer Method Signature
Service notifications.deleteNotifications() deleteNotifications(tenantId: string, notificationIds: string[]): Promise<NotificationDeleteResponse>
Service notifications.deleteAll() deleteAll(tenantId: string): Promise<NotificationDeleteAllResponse>

Endpoint Called

Method HTTP Endpoint OAuth Scope
deleteNotifications() / deleteAll() POST notificationservice_/notificationserviceapi/odata/v1/NotificationEntry/UiPath.NotificationService.Api.DeleteBulk NotificationService
  • API spec misspelling preserved: the server expects the request body key as notifcationIds (sic), not notificationIds. The SDK preserves the typo to match the live API; the SDK's public surface uses the correct spelling.
  • deleteNotifications rejects empty arrays at the server with HTTP 400 — documented in JSDoc; the SDK doesn't add a client-side guard to avoid drift if the server relaxes that constraint.
  • deleteAll sends { notifcationIds: [], deleteAll: true } — the server deletes everything for the acting user regardless.

Example Usage

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

const notifications = new Notifications(sdk);
const tenantId = '<tenant-guid>';

await notifications.deleteNotifications(tenantId, ['<notificationId-1>', '<notificationId-2>']);
await notifications.deleteAll(tenantId);

API Response vs SDK Response

Method SDK Response
deleteNotifications { success: true, data: { notificationIds } }
deleteAll { success: true, data: { all: true } }

Verification

Check Status
npm run typecheck ✅ clean
npm run lint ✅ 0 warnings, 0 errors
npm run test:unit ✅ 14 tests in notification suite (up from 10)

No integration tests for the delete methods — they destructively mutate the inbox with no SDK-level undo and would be hostile to repeat-run CI. Covered by unit tests for SDK shape and by manual smoke tests for live behaviour.

Files

Area Files
Endpoint constants src/utils/constants/endpoints/notification.ts (DELETE_BULK)
Models src/models/notification/notifications.models.ts (response types + ServiceModel methods)
Service src/services/notification/notifications.ts
Unit tests tests/unit/services/notification/notifications.test.ts (+4 tests)
Integration tests tests/integration/shared/notification/notifications.integration.test.ts (note added explaining why no tests)
Docs docs/oauth-scopes.md

PR Stack

# Branch Status
1 feat/notifications-sdk #512
2 feat/notifications-mark-read #513
3 feat/notifications-delete (this PR)
4 feat/subscriptions-sdk upcoming
5 feat/subscriptions-topic-updates upcoming
6 feat/subscriptions-publisher-updates upcoming
7 feat/subscriptions-mode-reset upcoming

🤖 Generated with Claude Code

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>
@claude

claude Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

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

…s entries

Same treatment as PR #512 / #513 — tag deleteNotifications, deleteAll
@internal in models + service, drop their oauth-scopes entries.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Comment on lines +207 to +213
it('should propagate errors', async () => {
mockApiClient.post.mockRejectedValue(createMockError(TEST_CONSTANTS.ERROR_MESSAGE));

await expect(
notificationService.deleteNotifications(NOTIFICATION_TEST_CONSTANTS.TENANT_ID, [NOTIFICATION_TEST_CONSTANTS.NOTIFICATION_ID])
).rejects.toThrow(TEST_CONSTANTS.ERROR_MESSAGE);
});

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Per the testing conventions, entity-specific methods (those that operate on specific IDs) should use domain-specific error constants, not the generic TEST_CONSTANTS.ERROR_MESSAGE. Compare with the markRead error test (line 129) which correctly uses NOTIFICATION_TEST_CONSTANTS.ERROR_NOTIFICATION_NOT_FOUND.

Suggested change
it('should propagate errors', async () => {
mockApiClient.post.mockRejectedValue(createMockError(TEST_CONSTANTS.ERROR_MESSAGE));
await expect(
notificationService.deleteNotifications(NOTIFICATION_TEST_CONSTANTS.TENANT_ID, [NOTIFICATION_TEST_CONSTANTS.NOTIFICATION_ID])
).rejects.toThrow(TEST_CONSTANTS.ERROR_MESSAGE);
});
it('should propagate errors', async () => {
mockApiClient.post.mockRejectedValue(createMockError(NOTIFICATION_TEST_CONSTANTS.ERROR_NOTIFICATION_NOT_FOUND));
await expect(
notificationService.deleteNotifications(NOTIFICATION_TEST_CONSTANTS.TENANT_ID, [NOTIFICATION_TEST_CONSTANTS.NOTIFICATION_ID])
).rejects.toThrow(NOTIFICATION_TEST_CONSTANTS.ERROR_NOTIFICATION_NOT_FOUND);
});

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