Method ReadPageAsync
- Namespace
- MailFathom.Application.Emails.Summaries
- Assembly
- MailFathom.Application.dll
ReadPageAsync(EmailTimelineFilter, EmailTimelinePosition?, int, CancellationToken)
Reads the emails a filter selects, beginning after a known timeline position.
Task<IReadOnlyList<EmailSummary>> ReadPageAsync(EmailTimelineFilter filter, EmailTimelinePosition? continueAfter, int limit, CancellationToken cancellationToken)
Parameters
filterEmailTimelineFilterWhich emails to return and from which end of the timeline to read them.
continueAfterEmailTimelinePosition?The position the previous page ended on, or null to start at the filter's leading end.
limitintThe greatest number of rows to return, at least one.
cancellationTokenCancellationTokenPropagates caller cancellation.
Returns
- Task<IReadOnlyList<EmailSummary>>
At most
limitsummaries, ordered by EmailTimelinePosition in the filter's direction and beginning strictly beyondcontinueAfter.
Remarks
The order is total, which is what makes paging over it contiguous: the caller may ask for the next page at any
time, and every row falls on exactly one side of continueAfter even when several emails share
a received timestamp or carry none. An implementation reproduces
ComparerFor(EmailTimelineDirection) rather than an order that merely resembles it.
The filter's scope names the accounts to read, and a use case resolves them before it calls. A scope naming none reaches every account the store holds rows for, which includes accounts a deployment has stopped serving; nothing here re-derives which those are.
Exceptions
- ArgumentNullException
Thrown when
filteris null.- ArgumentOutOfRangeException
Thrown when
limitis below one.