Table of Contents

Method ReadAttachmentPassagesAsync

Namespace
MailFathom.Application.Emails.AttachmentText
Assembly
MailFathom.Application.dll

ReadAttachmentPassagesAsync(StoredEmailId, AttachmentPassagePosition?, int, CancellationToken)

Reads one window of the passages cut from a message's attachments.

Task<IReadOnlyList<AttachmentPassage>> ReadAttachmentPassagesAsync(StoredEmailId emailId, AttachmentPassagePosition? resumeAfter, int windowSize, CancellationToken cancellationToken)

Parameters

emailId StoredEmailId

The message whose attachment passages are read.

resumeAfter AttachmentPassagePosition?

The passage to continue past, or null to start at the first one.

windowSize int

How many passages this read may return, which it never exceeds.

cancellationToken CancellationToken

Cancels the read.

Returns

Task<IReadOnlyList<AttachmentPassage>>

The passages ordered by attachment and then by their place inside it, or an empty list where none remain.

Remarks

Windowed rather than whole, because what one message's attachments hold is the sender's to decide: twenty attachments of two hundred thousand characters each is what the per-attachment ceilings already permit, and a caller wanting the passage a search matched should not load four million characters to serve it. The window and the cursor are on the port rather than left to its first caller so that the bound holds for every later one.

An empty answer covers every way a message can have no further attachment passage — none was ever read, every one of them was refused, the message carries no attachment at all, or the window has reached the end — because none of those is a state a caller acts on differently. What the reason was is on the attachment's own row, which is where a user asking why is answered.

Exceptions

ArgumentOutOfRangeException

Thrown when windowSize is not positive.