Skip to content

Replace per-field message fetch state with composable fetch items - #182

Merged
stevebauman merged 2 commits into
v2.0from
feature/v2-message-fetch-items
Sep 1, 2026
Merged

Replace per-field message fetch state with composable fetch items#182
stevebauman merged 2 commits into
v2.0from
feature/v2-message-fetch-items

Conversation

@stevebauman

@stevebauman stevebauman commented Sep 1, 2026

Copy link
Copy Markdown
Member

Message fetch selection currently requires a boolean property, state getter, fluent inclusion method, fluent exclusion method, and command-builder condition for every supported data item. This makes each new FETCH item expand the public query contract and spreads protocol knowledge across the query implementation.

This introduces a uniform MessageData API for composing requests through with(), without(), and only(). Fixed attributes are represented internally by enum values, while BODY sections are immutable objects that can be transformed with peek() without adding global query state or applying irrelevant options to other data items.

For example:

$folder->messages()->with(
    MessageData::flags(),
    MessageData::headers()->peek(),
);

All message data items implement the same FetchItem contract, so the query only needs to serialize the selected items. FETCH response parsing and message construction now live in FetchedMessageData, keeping MessageQuery focused on search, ordering, pagination, and execution.

@stevebauman
stevebauman merged commit d78b398 into v2.0 Sep 1, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant