Matthias Andreas Benkard | b382b10 | 2021-01-02 15:32:21 +0100 | [diff] [blame] | 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Ddeboer\Imap; |
| 6 | |
| 7 | use DateTimeInterface; |
| 8 | use Ddeboer\Imap\Search\ConditionInterface; |
| 9 | |
| 10 | /** |
| 11 | * An IMAP mailbox (commonly referred to as a 'folder'). |
| 12 | */ |
| 13 | interface MailboxInterface extends \Countable, \IteratorAggregate |
| 14 | { |
| 15 | /** |
| 16 | * Get mailbox decoded name. |
| 17 | */ |
| 18 | public function getName(): string; |
| 19 | |
| 20 | /** |
| 21 | * Get mailbox encoded path. |
| 22 | */ |
| 23 | public function getEncodedName(): string; |
| 24 | |
| 25 | /** |
| 26 | * Get mailbox encoded full name. |
| 27 | */ |
| 28 | public function getFullEncodedName(): string; |
| 29 | |
| 30 | /** |
| 31 | * Get mailbox attributes. |
| 32 | */ |
| 33 | public function getAttributes(): int; |
| 34 | |
| 35 | /** |
| 36 | * Get mailbox delimiter. |
| 37 | */ |
| 38 | public function getDelimiter(): string; |
| 39 | |
| 40 | /** |
| 41 | * Get Mailbox status. |
| 42 | */ |
| 43 | public function getStatus(int $flags = null): \stdClass; |
| 44 | |
| 45 | /** |
| 46 | * Bulk Set Flag for Messages. |
| 47 | * |
| 48 | * @param string $flag \Seen, \Answered, \Flagged, \Deleted, and \Draft |
| 49 | * @param array|MessageIterator|string $numbers Message numbers |
| 50 | */ |
| 51 | public function setFlag(string $flag, $numbers): bool; |
| 52 | |
| 53 | /** |
| 54 | * Bulk Clear Flag for Messages. |
| 55 | * |
| 56 | * @param string $flag \Seen, \Answered, \Flagged, \Deleted, and \Draft |
| 57 | * @param array|MessageIterator|string $numbers Message numbers |
| 58 | */ |
| 59 | public function clearFlag(string $flag, $numbers): bool; |
| 60 | |
| 61 | /** |
| 62 | * Get message ids. |
| 63 | * |
| 64 | * @param ConditionInterface $search Search expression (optional) |
| 65 | */ |
| 66 | public function getMessages(ConditionInterface $search = null, int $sortCriteria = null, bool $descending = false, string $charset = null): MessageIteratorInterface; |
| 67 | |
| 68 | /** |
| 69 | * Get message iterator for a sequence. |
| 70 | * |
| 71 | * @param string $sequence Message numbers |
| 72 | */ |
| 73 | public function getMessageSequence(string $sequence): MessageIteratorInterface; |
| 74 | |
| 75 | /** |
| 76 | * Get a message by message number. |
| 77 | * |
| 78 | * @param int $number Message number |
| 79 | */ |
| 80 | public function getMessage(int $number): MessageInterface; |
| 81 | |
| 82 | /** |
| 83 | * Get messages in this mailbox. |
| 84 | */ |
| 85 | public function getIterator(): MessageIteratorInterface; |
| 86 | |
| 87 | /** |
| 88 | * Add a message to the mailbox. |
| 89 | */ |
| 90 | public function addMessage(string $message, string $options = null, DateTimeInterface $internalDate = null): bool; |
| 91 | |
| 92 | /** |
| 93 | * Returns a tree of threaded message for the current Mailbox. |
| 94 | */ |
| 95 | public function getThread(): array; |
| 96 | |
| 97 | /** |
| 98 | * Bulk move messages. |
| 99 | * |
| 100 | * @param array|MessageIterator|string $numbers Message numbers |
| 101 | * @param MailboxInterface $mailbox Destination Mailbox to move the messages to |
| 102 | * |
| 103 | * @throws \Ddeboer\Imap\Exception\MessageMoveException |
| 104 | */ |
| 105 | public function move($numbers, self $mailbox): void; |
| 106 | |
| 107 | /** |
| 108 | * Bulk copy messages. |
| 109 | * |
| 110 | * @param array|MessageIterator|string $numbers Message numbers |
| 111 | * @param MailboxInterface $mailbox Destination Mailbox to copy the messages to |
| 112 | * |
| 113 | * @throws \Ddeboer\Imap\Exception\MessageCopyException |
| 114 | */ |
| 115 | public function copy($numbers, self $mailbox): void; |
| 116 | } |