Skip to main content

NotificationApi

@icure/medical-device-sdk / NotificationApi

SDK API: NotificationApi

The NotificationApi interface provides methods to subscribe to notifications.

Table of contents​

Methods​

Methods​

createOrModifyNotification​

â–¸ createOrModifyNotification(notification, delegate?): Promise<undefined | Notification>

This method creates a Notification if the rev field is undefined, otherwise it updates an existing one.

Parameters​

NameTypeDescription
notificationNotificationthe Notification to create or modify.
delegate?stringthe id of the Healthcare Party to delegate.

Returns​

Promise<undefined | Notification>

a Promise containing the Notification or undefined if something goes wrong.

Defined in​

src/apis/NotificationApi.ts:16


deleteNotification​

â–¸ deleteNotification(notificationId): Promise<undefined | string>

This method deletes the Notification with the provided id.

Parameters​

NameTypeDescription
notificationIdstringthe id of the Notification to delete

Returns​

Promise<undefined | string>

a Promise containing the id of the Notification or undefined if something goes wrong.

Defined in​

src/apis/NotificationApi.ts:23


filterNotifications​

â–¸ filterNotifications(filter, nextNotificationId?, limit?): Promise<PaginatedListNotification>

Filters are complex selectors that are built by combining basic building blocks. This method returns a paginated list of Notification (with a cursor that lets you query the following items). Load notifications from the database by filtering them using the provided [filter].

Parameters​

NameTypeDescription
filterFilter<Notification>The Filter object that describes which condition(s) the elements which the ids should be returned must fulfill
nextNotificationId?stringThe id of the first notification in the next page
limit?numberThe number of patients to return in the queried page

Returns​

Promise<PaginatedListNotification>

a Promise containing the PaginatedList of Notification objects

Defined in​

src/apis/NotificationApi.ts:33


getNotification​

â–¸ getNotification(notificationId): Promise<undefined | Notification>

This method returns a Promise containing the Notification with the specified id.

Parameters​

NameTypeDescription
notificationIdstringthe id of the Notification to retrieve.

Returns​

Promise<undefined | Notification>

a Promise containing the Notification or undefined if something goes wrong.

Defined in​

src/apis/NotificationApi.ts:40


getPendingNotificationsAfter​

â–¸ getPendingNotificationsAfter(fromDate?): Promise<Notification[]>

Gets all the Notifications with status "pending" that the current dataOwner can access

Parameters​

NameTypeDescription
fromDate?number: Default value is now less 30 days

Returns​

Promise<Notification[]>

an Array of the Notifications matching those criteria

Defined in​

src/apis/NotificationApi.ts:48


subscribeToNotificationEvents​

â–¸ subscribeToNotificationEvents(eventTypes, filter, eventFired, options?): Promise<Connection>

Opens a WebSocket Connection in order to receive all the Notification corresponding to specific filter criteria.

Parameters​

NameTypeDescription
eventTypes("CREATE" | "UPDATE" | "DELETE")[]Type of event you would like to listen. It can be CREATE, UPDATE or DELETE
filterFilter<Notification>Filter criteria to filter to the notification you would like to receive
eventFired(dataSample: Notification) => Promise<void>Action applied each time you receive a notification through the WebSocket
options?ObjectOptions to configure the WebSocket. - keepAlive : How long to keep connection alive (ms); - lifetime : How long to keep the WebSocket alive (ms); - connectionMaxRetry : how many time retrying to reconnect to the iCure WebSocket; - connectionRetryIntervalInMs : How long base interval will be between two retry. The retry attempt is exponential and using a random value (connectionRetryIntervalMs * (random between 1 and 2))^nbAttempts)
options.connectionMaxRetry?number-
options.connectionRetryIntervalMs?number-

Returns​

Promise<Connection>

Defined in​

src/apis/NotificationApi.ts:69


updateNotificationStatus​

â–¸ updateNotificationStatus(notification, newStatus): Promise<undefined | Notification>

Updates the status of a Notification.

Parameters​

NameTypeDescription
notificationNotificationthe Notification to update
newStatusMaintenanceTaskStatusEnumthe new status

Returns​

Promise<undefined | Notification>

the updated Notification

Defined in​

src/apis/NotificationApi.ts:56