Method ReadableScope
- Namespace
- MailFathom.Application.Emails.Mailboxes
- Assembly
- MailFathom.Application.dll
ReadableScope(IReadOnlyList<MailAccountSelector>, IReadOnlyList<MailFolderReference>, JunkMailInclusion)
Resolves what a request named into the scope a query runs with.
public MailboxScope ReadableScope(IReadOnlyList<MailAccountSelector> accountSelectors, IReadOnlyList<MailFolderReference> folders, JunkMailInclusion junkMail)
Parameters
accountSelectorsIReadOnlyList<MailAccountSelector>The text a request named accounts with, or empty for every served account.
foldersIReadOnlyList<MailFolderReference>The folders a request named, each by alias or by role, or empty for every folder.
junkMailJunkMailInclusionWhether the caller asked for the account's junk folder, which defaults to it being left out.
Returns
- MailboxScope
The scope a query runs with.
Remarks
An account may be named by its configured identifier or by the display name it is published under, and this is where the two become one identity. Resolution happens against the served accounts rather than at a protocol boundary, so text naming nothing is refused by the same rule and with the same failure as an identifier the deployment stopped serving — a caller cannot learn from the refusal which spelling it was holding.
An account the deployment does not serve is refused before anything is read, rather than narrowed away by a predicate: a narrowed predicate would answer with an empty result, and an empty result tells a caller that the name they used exists. The resolved identities are what the scope is built from, so the same account named two ways is one query with one continuation cursor.
A request that names no account is restricted to the served accounts rather than left unrestricted. Removing an account from configuration leaves its stored rows in place, so an absent account predicate would keep publishing mail from an account this deployment no longer serves — which is also why the resolved accounts, not the requested ones, take part in a continuation cursor's fingerprint.
The folders a tool may read are named here, once, rather than by each read model — which is what makes "no tool lists, searches, reads, or answers from it" a property of the system instead of a list of places somebody has to keep complete. It is stated as what is admitted rather than as what is withheld, because the store holds rows of folders configuration no longer names and no list of withheld names reaches those: a folder nobody mapped is a folder MailFathom does not have, and it stays out by not being admitted. A tool that read the mailbox some other way would bypass this, which is why the two reads that reach an email by its identifier ask the same configuration directly rather than building a scope.
The junk folder is withheld here too, and it is a different kind of decision from the one above: an operator did not withhold it, the default did, and a caller may ask for it back. Resolving both in one place is what keeps the override from being able to reveal a folder the operator withheld — a folder that is hidden *and* junk stays out under either answer, because the two lists narrow the query independently.
A folder named by the role it plays is turned into the folder of each account it means here, after the accounts
are settled and before anything is read, because a role means a different folder on each account in scope. One
role therefore narrows a multi-account read to each account's own folder rather than to whichever alias one
deployment happened to choose. A role no account in scope maps is refused instead of narrowed away, for the
reason an unserved account is: the caller asked for a folder that is not there, and an empty page would read as
a folder holding no mail. Naming role:Junk is narrowing rather than asking — the withholding above still
applies, so a read that names it and does not also ask for junk mail returns nothing.
Exceptions
- MailboxQueryFilterInvalidException
Thrown when either list names more values than its limit permits.
- MailAccountNotAccessibleException
Thrown when the request names an account this deployment does not serve.
- MailFolderRoleUnmappedException
Thrown when the request names a role no account in scope maps a folder with.
- ArgumentOutOfRangeException
Thrown when
junkMailis not a defined member.