Table of Contents

Method HasRecordAsync

Namespace
MailFathom.Application.Mail.Mutations
Assembly
MailFathom.Application.dll

HasRecordAsync(StoredEmailId, MailboxMutation, MailboxMutationOrigin, CancellationToken)

Reports whether one local email has ever had a mutation of a given kind asked for by a given kind of requester.

Task<bool> HasRecordAsync(StoredEmailId storedEmailId, MailboxMutation mutation, MailboxMutationOrigin origin, CancellationToken cancellationToken)

Parameters

storedEmailId StoredEmailId

The local email, which is the identity that survives the email being moved.

mutation MailboxMutation

The change asked for.

origin MailboxMutationOrigin

The kind of act that asked.

cancellationToken CancellationToken

Cancels the read.

Returns

Task<bool>

true when at least one such record exists, whatever stage it reached.

Remarks

It answers a question the idempotency identity deliberately cannot: whether this email was ever moved by this kind of requester, rather than whether one particular request has already been made. The identity is keyed to the occurrence and to what asked, so a message that has since moved is a new occurrence and a requester whose terms changed is a new requester — both of which ask afresh, which is right for a retry and wrong for deciding whether somebody has since undone the change.

Every stage counts, including an abandoned one. What the caller is establishing is that MailFathom has already acted on this email once, and a change that was attempted and given up on is still a change the owner may have seen and reversed.

Exceptions

ArgumentException

Thrown when mutation is unspecified.

ArgumentOutOfRangeException

Thrown when origin is not a declared origin.