Skip to main content

Notification

A sub namespace of Service, exclusive for notification operations

//accessing to service.notification methods
SW.UI.Notification.{methodName}

getAll

Description

This method can be used to get all notifications.

Method(s)

1   function getAll(params: {
2 skip: number,
3 take: number,
4 filter: string,
5 withAlreadyReadAlso: boolean
6 } = {
7 skip: 0,
8 take: 20,
9 filter: "",
10 withAlreadyReadAlso: true
11 }): Promise<NotificationPagedList>
ParameterTypeRequiredDefaultsDescription
skipnumberfalse0
takenumberfalse20
filterstringfalse""Search name
withAlreadyReadAlsobooleanfalsetrueGet allready read notifications

Basic Usage

SW.Service.Notification.getAll();

getGroupedByDocument

Description

This method can be used to get all notifications grouped by document.

Method(s)

1   function getGroupedByDocument(params: {
2 skip: number,
3 take: number
4 } = {
5 skip: 0,
6 take: 20
7 }): Promise<Notification[]>
ParameterTypeRequiredDefaultsDescription
skipnumbertrue0
takenumbertrue20

Basic Usage

SW.Service.Notification.getGroupedByDocument();

getUnreadCounter

Description

This method can be used to get the number of unread notifications.

Method(s)

1   function getUnreadCounter(): Promise<NotificationPagedList> 

Basic Usage

SW.Service.Notification.getUnreadCounter();

markAsRead

Description

This method can be used to mark notifications as read until a given date.

Method(s)

1   function markAsRead(untilDate: Date): Promise<any>
ParameterTypeRequiredDefaultsDescription
untilDateDatetrueMark as read until this date.

Basic Usage

SW.Service.Notification.markAsRead('Mon Feb 21 2022 10:00:00 GMT+0000 (Western European Standard Time)');

markAsReadByDocument

Description

This method can be used to mark notifications as read from a given document.

Method(s)

1   function markAsReadByDocument(objectId: string, objectType: string): Promise<any>
ParameterTypeRequiredDefaultsDescription
objectIdstringtrueDocument id
objectTypestringtrueDocument name

Basic Usage

SW.Service.Notification.markAsReadByDocument('jobId', 'job');

post

Description

This method can be used to send a new notification.

Method(s)

1   function post(text: string, documentTypeName: string, documentId: string, userIdsToNotify: string[]): Promise<any>
ParameterTypeRequiredDefaultsDescription
textstringtrueNotification text
documentTypeNamestringtrueDocument name
documentIdstringtrueDocument id
userIdsToNotifystring[]trueUsers to receive the notification

Basic Usage

SW.Service.Notification.post('New notification text', 'Deliverable', 'jobId', ['userId, userId']);