SaaS CMS has officially launched! Learn more now.

Interface IUserNotificationRepository

Class for listing UserNotificationMessages

Namespace: EPiServer.Notification
Assembly: EPiServer.dll
Version: 11.20.7
Syntax
public interface IUserNotificationRepository

Methods

GetUserNotificationAsync(INotificationUser, Int32, UserNotificationFormattingMode)

Gets a single UserNotificationMessage given its id.

Declaration
Task<UserNotificationMessage> GetUserNotificationAsync(INotificationUser user, int notificationId, UserNotificationFormattingMode formattingMode)
Parameters
Type Name Description
INotificationUser user

The recipient of the message.

System.Int32 notificationId

The id of the message.

UserNotificationFormattingMode formattingMode

The formatting mode of the result.

Returns
Type Description
System.Threading.Tasks.Task<UserNotificationMessage>

A message.

GetUserNotificationsAsync(UserNotificationsQuery, Int64, Int32, UserNotificationFormattingMode)

Gets a paged list of messages for a user.

Declaration
Task<PagedUserNotificationMessageResult> GetUserNotificationsAsync(UserNotificationsQuery query, long startIndex, int maxRows, UserNotificationFormattingMode formattingMode)
Parameters
Type Name Description
UserNotificationsQuery query

Query information

System.Int64 startIndex

The start index, used for paging

System.Int32 maxRows

The maximum number of rows returned

UserNotificationFormattingMode formattingMode

The formatting mode of the result.

Returns
Type Description
System.Threading.Tasks.Task<PagedUserNotificationMessageResult>

GetUserNotificationsCountAsync(UserNotificationsQuery)

Gets the total number of messages for a user.

Declaration
Task<int> GetUserNotificationsCountAsync(UserNotificationsQuery query)
Parameters
Type Name Description
UserNotificationsQuery query

Query information

Returns
Type Description
System.Threading.Tasks.Task<System.Int32>

MarkUserNotificationAsReadAsync(INotificationUser, Int32)

Marks a message as read.

Declaration
Task MarkUserNotificationAsReadAsync(INotificationUser user, int notificationId)
Parameters
Type Name Description
INotificationUser user

The recipient of the message.

System.Int32 notificationId

The message to mark as read.

Returns
Type Description
System.Threading.Tasks.Task

MarkUserNotificationsAsReadAsync(INotificationUser)

Marks all messages for a user as read.

Declaration
Task MarkUserNotificationsAsReadAsync(INotificationUser user)
Parameters
Type Name Description
INotificationUser user

The recipient of the message.

Returns
Type Description
System.Threading.Tasks.Task

MarkUserNotificationsAsReadAsync(INotificationUser, String)

Marks all messages for a user on a specific channel as read.

Declaration
Task MarkUserNotificationsAsReadAsync(INotificationUser user, string channelName)
Parameters
Type Name Description
INotificationUser user

The recipient of the message.

System.String channelName

The name of the channel.

Returns
Type Description
System.Threading.Tasks.Task

Events

UserNotificationMissing

Occurs when notification cannot be found by its id.

Declaration
event EventHandler<UserNotificationEventArgs> UserNotificationMissing
Event Type
Type Description
System.EventHandler<UserNotificationEventArgs>

UserNotificationRead

Occurs when a notification is marked as read.

Declaration
event EventHandler<UserNotificationEventArgs> UserNotificationRead
Event Type
Type Description
System.EventHandler<UserNotificationEventArgs>

UserNotificationReads

Occurs when the MarkUserNotificationAsRead method is called.

Declaration
event EventHandler<UserNotificationsEventArgs> UserNotificationReads
Event Type
Type Description
System.EventHandler<UserNotificationsEventArgs>

Extension Methods