Method WithdrawAsync
- Namespace
- MailFathom.Application.Mail.Mutations
- Assembly
- MailFathom.Application.dll
WithdrawAsync(IPersistenceSession, IReadOnlyList<MailAccountId>, IReadOnlyList<MailboxMutationRecordId>, CancellationToken)
Withdraws the changes among those named on the caller's own accounts, wherever nothing has been asked of the mail server for one yet.
Task<IReadOnlyList<MailboxMutationRecord>> WithdrawAsync(IPersistenceSession session, IReadOnlyList<MailAccountId> accounts, IReadOnlyList<MailboxMutationRecordId> recordIds, CancellationToken cancellationToken)
Parameters
sessionIPersistenceSessionThe session the write joins.
accountsIReadOnlyList<MailAccountId>The accounts the caller is assigned, which are the accounts the records must belong to.
recordIdsIReadOnlyList<MailboxMutationRecordId>The records to withdraw.
cancellationTokenCancellationTokenCancels the write.
Returns
- Task<IReadOnlyList<MailboxMutationRecord>>
Each named record as it now stands, unchanged where the change had already been attempted, and absent where those accounts hold no such record.
Remarks
A record past IsWithdrawable is returned rather than refused, because the caller's question is what became of the change and "it had already gone out" is the answer to it. That also makes the call safe to repeat: withdrawing an already withdrawn record reports it withdrawn and writes nothing.
The call takes the whole set rather than one record, because a caller withdrawing what it submitted as a batch withdraws it as one, and the commit this joins retries as a whole — so a call per record would pay the round trip again on every attempt.
Exceptions
- ArgumentNullException
Thrown when
session,accountsorrecordIdsis null.