Skip to content

MailProvider

Defined in: src/provider/types.ts:34

Deliberately thin: one page, one batch. Iteration, batching, retry, and resumability live in shared machinery (paging.ts / batching.ts), so adapters only encode transport quirks.

THE NEVER-DELETE GUARANTEE: this interface has no delete/destroy methods and never will. archive() is the only sanctioned “removal” — it drops the Inbox label and keeps every other label. The worst any bug can do is mislabel or archive mail, never lose it.

readonly caps: ProviderCapabilities

Defined in: src/provider/types.ts:36


readonly kind: "jmap" | "mcp" | "memory"

Defined in: src/provider/types.ts:35

addLabels(emailIds, labelNames): Promise<void>

Defined in: src/provider/types.ts:51

One batch (caller chunks to <= caps.maxPageSize). Labels by name/path.

string[]

string[]

Promise<void>


archive(emailIds): Promise<void>

Defined in: src/provider/types.ts:53

Remove from Inbox, keep all other labels. Never removeLabels: ['Inbox'].

string[]

Promise<void>


connect(): Promise<void>

Defined in: src/provider/types.ts:39

JMAP: session discovery; MCP: initialize handshake. Idempotent.

Promise<void>


ensureLabels(names): Promise<Map<string, Label>>

Defined in: src/provider/types.ts:46

Idempotent bulk create of missing labels (names may be ‘Parent/Child’ paths). JMAP: single Mailbox/set with client ids c0,c1,… and modal-parent inference for bare names. Returns name -> Label for every requested name.

string[]

Promise<Map<string, Label>>


getEmail(id): Promise<EmailMeta>

Defined in: src/provider/types.ts:49

string

Promise<EmailMeta>


listLabels(): Promise<Label[]>

Defined in: src/provider/types.ts:40

Promise<Label[]>


searchEmails(query, page): Promise<SearchPage>

Defined in: src/provider/types.ts:48

One page. Adapters normalize array-vs-{items} response shapes.

SearchQuery

PageRequest

Promise<SearchPage>