Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions docs/oauth-scopes.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,31 @@ The `ConversationalAgents` scope is required for real-time WebSocket sessions (`
| `getPolicyTraces()` | `Insights.RealTimeData Insights OR.Folders.Read` |
| `getOperationSummary()` | `Insights.RealTimeData Insights OR.Folders.Read` |

## Notifications

| Method | OAuth Scope |
|--------|-------------|
| `getAll()` | `NotificationService` |
| `markRead()` | `NotificationService` |
| `markUnread()` | `NotificationService` |
| `markAllRead()` | `NotificationService` |
| `deleteNotifications()` | `NotificationService` |
| `deleteAll()` | `NotificationService` |

## Subscriptions

| Method | OAuth Scope |
|--------|-------------|
| `getAll()` | `NotificationService` |
| `getPublishers()` | `NotificationService` |
| `getSupportedChannels()` | `NotificationService` |
| `updateTopic()` | `NotificationService` |
| `updateCategory()` | `NotificationService` |
| `updatePublisher()` | `NotificationService` |
| `updateTopicGroup()` | `NotificationService` |
| `updateMode()` | `NotificationService` |
| `reset()` | `NotificationService` |

## Processes

| Method | OAuth Scope |
Expand Down
1 change: 1 addition & 0 deletions docs/pagination.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,3 +137,4 @@ console.log(`Total count: ${allAssets.totalCount}`);
| Traces | `getById()` | ❌ No |
| Traces | `getSpansByIds()` | ❌ No |
| Governance | `getPolicyTraces()` | ✅ Yes |
| Notifications | `getAll()` | ✅ Yes |
3 changes: 3 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,9 @@ nav:
- Cases: api/interfaces/CasesServiceModel.md
- Case Instances: api/interfaces/CaseInstancesServiceModel.md
- Jobs: api/interfaces/JobServiceModel.md
- Notifications:
- Inbox: api/interfaces/NotificationServiceModel.md
- Subscriptions: api/interfaces/SubscriptionServiceModel.md
- Processes: api/interfaces/ProcessServiceModel.md
- Queues: api/interfaces/QueueServiceModel.md
- Tasks: api/interfaces/TaskServiceModel.md
Expand Down
10 changes: 10 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,16 @@
"types": "./dist/governance/index.d.ts",
"default": "./dist/governance/index.cjs"
}
},
"./notifications": {
"import": {
"types": "./dist/notifications/index.d.ts",
"default": "./dist/notifications/index.mjs"
},
"require": {
"types": "./dist/notifications/index.d.ts",
"default": "./dist/notifications/index.cjs"
}
}
},
"files": [
Expand Down
5 changes: 5 additions & 0 deletions rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,11 @@ const serviceEntries = [
name: 'governance',
input: 'src/services/governance/index.ts',
output: 'governance/index'
},
{
name: 'notifications',
input: 'src/services/notification/index.ts',
output: 'notifications/index'
}
];

Expand Down
8 changes: 8 additions & 0 deletions src/models/notification/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/**
* Notification & Subscription models barrel export.
*/

export * from './notifications.types';
export * from './notifications.models';
export * from './subscriptions.types';
export * from './subscriptions.models';
37 changes: 37 additions & 0 deletions src/models/notification/notifications.internal-types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/**
* Internal-only types for the Notification service.
*
* NOT exported from the public barrel (`src/models/notification/index.ts`).
*/

import type { NotificationGetResponse } from './notifications.types';

/**
* Raw notification entry shape as returned by `/odata/v1/NotificationEntry` — includes
* the internal/transport-layer fields the SDK drops before returning to consumers.
*/
export interface RawNotificationEntry extends NotificationGetResponse {
entityOrgName?: string | null;
entityTenantName?: string | null;
serviceRegistryName?: string | null;
messageTemplateKey?: string | null;
messageVersion?: number;
publicationId?: string;
correlationId?: string | null;
partitionKey?: string;
}

/**
* Fields stripped from each {@link RawNotificationEntry} before it is returned to the
* SDK consumer as a {@link NotificationGetResponse}.
*/
export const INTERNAL_NOTIFICATION_FIELDS: ReadonlyArray<keyof RawNotificationEntry> = [
'entityOrgName',
'entityTenantName',
'serviceRegistryName',
'messageTemplateKey',
'messageVersion',
'publicationId',
'correlationId',
'partitionKey',
];
183 changes: 183 additions & 0 deletions src/models/notification/notifications.models.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
/**
* Notification service model — public response shapes and the ServiceModel interface
* that drives generated API documentation.
*/

import type { OperationResponse } from '../common/types';
import type {
HasPaginationOptions,
NonPaginatedResponse,
PaginatedResponse,
} from '../../utils/pagination/types';

import type {
NotificationGetAllOptions,
NotificationGetResponse,
} from './notifications.types';

/**
* Response from `markRead()` / `markUnread()`.
*
* `notificationIds` echoes the IDs that were marked; `read` reflects the new state.
*/
export type NotificationUpdateReadResponse = OperationResponse<{
notificationIds: string[];
read: boolean;
}>;

/**
* Response from `markAllRead()`.
*/
export type NotificationMarkAllReadResponse = OperationResponse<{
all: true;
read: true;
}>;

/**
* Response from `deleteNotifications()`.
*
* `notificationIds` echoes the IDs that were deleted.
*/
export type NotificationDeleteResponse = OperationResponse<{
notificationIds: string[];
}>;

/**
* Response from `deleteAll()`.
*/
export type NotificationDeleteAllResponse = OperationResponse<{
all: true;
}>;

/**
* Public surface of the Notifications service. JSDoc on this interface drives
* the generated API reference documentation.
*
* Every method takes the tenant GUID as the first argument — the notification
* API identifies the acting tenant via the `X-UIPATH-Internal-TenantId` header
* and the SDK forwards `tenantId` into that header on each call.
*/
export interface NotificationServiceModel {
/**
* Lists notifications from the current user's inbox.
*
* Returns the full list when no pagination params are provided, or a paginated cursor result
* when any of `pageSize`/`cursor`/`jumpToPage` is supplied. Supports OData `filter` and
* `orderby` query options.
*
* @param tenantId - Tenant GUID (sent via `X-UIPATH-Internal-TenantId`)
* @param options - Optional OData query and pagination options
* @returns Array of notifications, or a paginated result when pagination params are supplied
* {@link NotificationGetResponse}
*
* @example Basic usage
* ```typescript
* import { Notifications } from '@uipath/uipath-typescript/notifications';
*
* const notifications = new Notifications(sdk);
* const all = await notifications.getAll('<tenantId>');
* ```
*
* @example Filter unread, most recent first
* ```typescript
* const unread = await notifications.getAll('<tenantId>', {
* filter: 'isRead eq false',
* orderby: 'publishedOn desc',
* });
* ```
*
* @example First page with pagination
* ```typescript
* const page1 = await notifications.getAll('<tenantId>', { pageSize: 20 });
* if (page1.hasNextPage) {
* const page2 = await notifications.getAll('<tenantId>', { cursor: page1.nextCursor });
* }
* ```
*/
getAll<T extends NotificationGetAllOptions = NotificationGetAllOptions>(
tenantId: string,
options?: T
): Promise<
T extends HasPaginationOptions<T>
? PaginatedResponse<NotificationGetResponse>
: NonPaginatedResponse<NotificationGetResponse>
>;

/**
* Marks the given notifications as read.
*
* @param tenantId - Tenant GUID (sent via `X-UIPATH-Internal-TenantId`)
* @param notificationIds - GUIDs of notifications to mark read
* @returns Operation result echoing the affected IDs and new read state
* {@link NotificationUpdateReadResponse}
*
* @example
* ```typescript
* await notifications.markRead('<tenantId>', ['<notificationId-1>', '<notificationId-2>']);
* ```
*/
markRead(tenantId: string, notificationIds: string[]): Promise<NotificationUpdateReadResponse>;

/**
* Marks the given notifications as unread.
*
* @param tenantId - Tenant GUID (sent via `X-UIPATH-Internal-TenantId`)
* @param notificationIds - GUIDs of notifications to mark unread
* @returns Operation result echoing the affected IDs and new read state
* {@link NotificationUpdateReadResponse}
*
* @example
* ```typescript
* await notifications.markUnread('<tenantId>', ['<notificationId>']);
* ```
*/
markUnread(tenantId: string, notificationIds: string[]): Promise<NotificationUpdateReadResponse>;

/**
* Marks all notifications in the current user's inbox as read.
*
* Uses the server-side `forceAllRead` flag — no per-notification IDs are sent.
*
* @param tenantId - Tenant GUID (sent via `X-UIPATH-Internal-TenantId`)
* @returns Operation result confirming the bulk update
* {@link NotificationMarkAllReadResponse}
*
* @example
* ```typescript
* await notifications.markAllRead('<tenantId>');
* ```
*/
markAllRead(tenantId: string): Promise<NotificationMarkAllReadResponse>;

/**
* Deletes the given notifications.
*
* @param tenantId - Tenant GUID (sent via `X-UIPATH-Internal-TenantId`)
* @param notificationIds - GUIDs of notifications to delete. Must be non-empty —
* the server rejects an empty array with HTTP 400.
* @returns Operation result echoing the deleted IDs
* {@link NotificationDeleteResponse}
*
* @example
* ```typescript
* await notifications.deleteNotifications('<tenantId>', ['<notificationId-1>', '<notificationId-2>']);
* ```
*/
deleteNotifications(tenantId: string, notificationIds: string[]): Promise<NotificationDeleteResponse>;

/**
* Deletes all notifications from the current user's inbox.
*
* Uses the server-side `deleteAll` flag — no per-notification IDs are sent.
*
* @param tenantId - Tenant GUID (sent via `X-UIPATH-Internal-TenantId`)
* @returns Operation result confirming the bulk delete
* {@link NotificationDeleteAllResponse}
*
* @example
* ```typescript
* await notifications.deleteAll('<tenantId>');
* ```
*/
deleteAll(tenantId: string): Promise<NotificationDeleteAllResponse>;
}
Loading
Loading