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 | /** |
| 8 | * A connection to an IMAP server that is authenticated for a user. |
| 9 | */ |
| 10 | interface ConnectionInterface extends \Countable |
| 11 | { |
| 12 | /** |
| 13 | * Get IMAP resource. |
| 14 | */ |
| 15 | public function getResource(): ImapResourceInterface; |
| 16 | |
| 17 | /** |
| 18 | * Delete all messages marked for deletion. |
| 19 | */ |
| 20 | public function expunge(): bool; |
| 21 | |
| 22 | /** |
| 23 | * Close connection. |
| 24 | */ |
| 25 | public function close(int $flag = 0): bool; |
| 26 | |
| 27 | /** |
| 28 | * Check if the connection is still active. |
| 29 | */ |
| 30 | public function ping(): bool; |
| 31 | |
| 32 | /** |
| 33 | * Get Mailbox quota. |
| 34 | */ |
| 35 | public function getQuota(string $root = 'INBOX'): array; |
| 36 | |
| 37 | /** |
| 38 | * Get a list of mailboxes (also known as folders). |
| 39 | * |
| 40 | * @return MailboxInterface[] |
| 41 | */ |
| 42 | public function getMailboxes(): array; |
| 43 | |
| 44 | /** |
| 45 | * Check that a mailbox with the given name exists. |
| 46 | * |
| 47 | * @param string $name Mailbox name |
| 48 | */ |
| 49 | public function hasMailbox(string $name): bool; |
| 50 | |
| 51 | /** |
| 52 | * Get a mailbox by its name. |
| 53 | * |
| 54 | * @param string $name Mailbox name |
| 55 | */ |
| 56 | public function getMailbox(string $name): MailboxInterface; |
| 57 | |
| 58 | /** |
| 59 | * Create mailbox. |
| 60 | */ |
| 61 | public function createMailbox(string $name): MailboxInterface; |
| 62 | |
| 63 | /** |
| 64 | * Delete mailbox. |
| 65 | */ |
| 66 | public function deleteMailbox(MailboxInterface $mailbox): void; |
| 67 | } |