Table of Contents

Method Restore

Namespace
MailFathom.Domain.Notifications
Assembly
MailFathom.Domain.dll

Restore(NotificationId, UserId, NotificationKind, string, string, NotificationStatement?, string?, NotificationTarget, NotificationDeduplicationKey, DateTimeOffset, bool)

Restores a notification this deployment already kept, with the read state it was stored under.

public static Notification Restore(NotificationId id, UserId user, NotificationKind kind, string title, string body, NotificationStatement? statement, string? source, NotificationTarget target, NotificationDeduplicationKey deduplicationKey, DateTimeOffset occurredAt, bool isRead)

Parameters

id NotificationId

What addresses the notification.

user UserId

The user it happened to.

kind NotificationKind

What part of MailFathom it is about.

title string

The headline the row is drawn with.

body string

The second line the row is drawn with.

statement NotificationStatement

What the notification says as a condition and its numbers, or null where the row names no condition.

source string

What the source line names beyond the kind, or null where the kind is the whole of it.

target NotificationTarget

Where opening it leads.

deduplicationKey NotificationDeduplicationKey

The condition it was raised for.

occurredAt DateTimeOffset

When the thing it describes happened.

isRead bool

Whether the person has read it.

Returns

Notification

The notification as it stands.

Remarks

It validates exactly what Compose(NotificationId, UserId, NotificationKind, string, string, NotificationStatement?, string?, NotificationTarget, NotificationDeduplicationKey, DateTimeOffset) validates rather than trusting the store, because a row read back is input from outside this process however it got there: a hand-edited table and a migration that widened a column reach a reader the same way a producer does. The one thing it takes that composing does not is the read state, which is the store's to say and never a producer's.

Exceptions

ArgumentNullException

Thrown when target is null.

ArgumentException

Thrown when title or body is blank, when source is present and blank, when user names nobody, or when id or deduplicationKey is the struct default.

ArgumentOutOfRangeException

Thrown when kind is not a declared kind, or when a text exceeds the bound stated for it.