Class MailboxScope
- Namespace
- MailFathom.Application.Emails.Mailboxes
- Assembly
- MailFathom.Application.dll
Names the accounts and the folders of those accounts a mailbox query is restricted to.
public sealed record MailboxScope : IEquatable<MailboxScope>
- Inheritance
-
MailboxScope
- Implements
- Inherited Members
Remarks
This is what a query runs with rather than what a request asked for. Both differences are settled before the scope is built: an unnamed account list becomes the accounts this deployment serves, because a store holds rows for accounts an operator has since removed, and every folder a request named — by its alias or by the role it plays — becomes the folder of the account it means. A folder is therefore named here as an account and an alias together, never as an alias alone, so one account's junk folder cannot admit another account's folder that happens to share the name.
A request that names no folder is restricted to none: an empty folder list means every folder of the accounts in scope, which is every folder configuration admits rather than every folder the store holds rows for. An account in scope that appears in no pair while others do is the opposite case — it maps no folder the request named, and contributes nothing.
Both lists are deduplicated and ordered when the scope is created, so two requests that name the same accounts in a different order are one query with one continuation cursor. The cursor's filter fingerprint is computed from this normalized form, which is what stops a client from being handed a mismatch for reordering its own input.
Fields
- MaximumAccountIds
The greatest number of account identifiers one request may name.
- MaximumFolders
The greatest number of folders one request may name, counted the same way as MaximumAccountIds.
Properties
- AccountIds
Gets the accounts the query is restricted to, deduplicated and ordered, or empty when the request named none.
- IncludesJunkMail
Gets whether the caller asked for the junk folder's mail.
- NothingReadable
Gets the scope that names no account, no folder, and nothing readable, which is what a deployment serving no account resolves to.
- ReadableFolders
Gets the only folders a query built from this scope may return anything from, ordered, or empty when none may.
- SelectedFolders
Gets the folders the query is restricted to as account-and-alias pairs, deduplicated and ordered, or empty for every folder.
- WithheldJunkFolders
Gets the junk folders this read returns nothing from, ordered, or empty when the caller asked for junk or no account maps one.
Methods
- Create(IEnumerable<MailAccountId>?, IEnumerable<MailFolderIdentity>?)
Creates the scope a query runs with, from identities already resolved against configuration.