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>
Parameter | Type | Required | Defaults | Description |
---|---|---|---|---|
skip | number | false | 0 | |
take | number | false | 20 | |
filter | string | false | "" | Search name |
withAlreadyReadAlso | boolean | false | true | Get 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[]>
Parameter | Type | Required | Defaults | Description |
---|---|---|---|---|
skip | number | true | 0 | |
take | number | true | 20 |
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>
Parameter | Type | Required | Defaults | Description |
---|---|---|---|---|
untilDate | Date | true | Mark 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>
Parameter | Type | Required | Defaults | Description |
---|---|---|---|---|
objectId | string | true | Document id | |
objectType | string | true | Document 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>
Parameter | Type | Required | Defaults | Description |
---|---|---|---|---|
text | string | true | Notification text | |
documentTypeName | string | true | Document name | |
documentId | string | true | Document id | |
userIdsToNotify | string[] | true | Users to receive the notification |
Basic Usage
SW.Service.Notification.post('New notification text', 'Deliverable', 'jobId', ['userId, userId']);