* SPDX-License-Identifier: AGPL-3.0-or-later */ namespace KTXM\ProviderImapMail\Service\Remote\Command; use Gricob\IMAP\Protocol\Command\Command; use Gricob\IMAP\Protocol\Command\Argument\ParenthesizedList; use Gricob\IMAP\Protocol\Command\Argument\SequenceSet; /** * Streaming single-message fetch command. * * Wraps gricob's UID FETCH for one or more UIDs with a configurable item list. * Used inside ImapClientWrapper::streamMessages() (one UID per call) and * ImapClientWrapper::fetchMessages() (variadic UIDs for bulk prefetch). * * Example: UID FETCH 42 (FLAGS ENVELOPE INTERNALDATE BODYSTRUCTURE BODY[]) */ final readonly class StreamFetchCommand extends Command { /** * @param int[] $uids One or more UIDs; formatted as "1,3,7" by SequenceSet * @param string[] $items IMAP fetch data items (e.g. 'FLAGS', 'ENVELOPE', 'BODY[]') */ public function __construct(array $uids, array $items) { parent::__construct( 'UID FETCH', new SequenceSet(...$uids), new ParenthesizedList($items), ); } }