Table of Contents

Method Create

Namespace
MailFathom.Domain.Calendar
Assembly
MailFathom.Domain.dll

Create(CalendarEventId, CalendarEventTitle, DateTimeOffset, DateTimeOffset?, bool, IReadOnlyCollection<Reminder>, CalendarEventOrigin, StoredEmailId?, ImportedCalendarEventUid?, DateTimeOffset, DateTimeOffset)

Builds an event from what a writer supplied, enforcing every invariant the calendar rests on.

public static CalendarEvent Create(CalendarEventId id, CalendarEventTitle title, DateTimeOffset start, DateTimeOffset? end, bool isAllDay, IReadOnlyCollection<Reminder> reminders, CalendarEventOrigin origin, StoredEmailId? sourceMessage, ImportedCalendarEventUid? importedUid, DateTimeOffset recordedAt, DateTimeOffset amendedAt)

Parameters

id CalendarEventId

The identity this event keeps for as long as it is held.

title CalendarEventTitle

What the event is called.

start DateTimeOffset

When it begins.

end DateTimeOffset?

When it ends, or null when nothing said how long it lasts.

isAllDay bool

Whether the event is stated as a day rather than as a clock time.

reminders IReadOnlyCollection<Reminder>

The leads it is to be announced at, in any order and without repetition, or empty to announce nothing.

origin CalendarEventOrigin

Whether it is on the calendar or offered to it.

sourceMessage StoredEmailId?

The message it came out of, or null when no message named it.

importedUid ImportedCalendarEventUid?

The identifier the file it came from named it by, or null when none did.

recordedAt DateTimeOffset

When it was written here.

amendedAt DateTimeOffset

When it was last amended, which is recordedAt for a new event.

Returns

CalendarEvent

The event.

Remarks

An end at the same instant as the start is refused rather than kept as an event of no length: an entry naming both is naming a span, and one whose span is empty is a file or a reading that went wrong rather than something to draw. An event that genuinely has no length states no end at all.

Exceptions

ArgumentNullException

Thrown when reminders is null.

ArgumentOutOfRangeException

Thrown when origin names no declared value, when end is not after start, or when more than MaximumCount reminders are supplied.

ArgumentException

Thrown when id, title, or a supplied importedUid is the default of its type, when a proposal is supplied with importedUid, or when one lead is supplied twice.