22
33namespace DirectoryTree \ImapEngine \Connection ;
44
5+ use DirectoryTree \ImapEngine \Collections \ResponseCollection ;
6+ use DirectoryTree \ImapEngine \Connection \Responses \TaggedResponse ;
7+
58interface ConnectionInterface
69{
710 /**
@@ -17,17 +20,17 @@ public function connected(): bool;
1720 /**
1821 * Login to a new session.
1922 */
20- public function login (string $ user , string $ password ): Response ;
23+ public function login (string $ user , string $ password ): TaggedResponse ;
2124
2225 /**
2326 * Logout of the current server session.
2427 */
25- public function logout (): Response ;
28+ public function logout (): ? TaggedResponse ;
2629
2730 /**
2831 * Authenticate the current session.
2932 */
30- public function authenticate (string $ user , string $ token ): Response ;
33+ public function authenticate (string $ user , string $ token ): TaggedResponse ;
3134
3235 /**
3336 * Send idle command.
@@ -42,84 +45,84 @@ public function done(): void;
4245 /**
4346 * Send noop command.
4447 */
45- public function noop (): Response ;
48+ public function noop (): ResponseCollection ;
4649
4750 /**
4851 * Apply session saved changes to the server.
4952 */
50- public function expunge (): Response ;
53+ public function expunge (): ResponseCollection ;
5154
5255 /**
5356 * Get an array of available capabilities.
5457 *
55- * @return Response containing a list of capabilities
58+ * @return ResponseCollection containing a list of capabilities
5659 */
57- public function capability (): Response ;
60+ public function capability (): ResponseCollection ;
5861
5962 /**
6063 * Execute a search request.
6164 *
62- * @return Response containing the message ids
65+ * @return ResponseCollection containing the message ids
6366 */
64- public function search (array $ params ): Response ;
67+ public function search (array $ params ): ResponseCollection ;
6568
6669 /**
6770 * Exchange identification information.
6871 *
6972 * @see https://datatracker.ietf.org/doc/html/rfc2971.
7073 */
71- public function id (?array $ ids = null ): Response ;
74+ public function id (?array $ ids = null ): ResponseCollection ;
7275
7376 /**
7477 * Fetch message UIDs using the given message numbers.
7578 */
76- public function uids (int |array $ msgns ): Response ;
79+ public function uids (int |array $ msgns ): ResponseCollection ;
7780
7881 /**
7982 * Fetch message contents.
8083 */
81- public function contents (int |array $ ids ): Response ;
84+ public function contents (int |array $ ids ): ResponseCollection ;
8285
8386 /**
8487 * Fetch message headers.
8588 */
86- public function headers (int |array $ ids ): Response ;
89+ public function headers (int |array $ ids ): ResponseCollection ;
8790
8891 /**
8992 * Fetch message flags.
9093 */
91- public function flags (int |array $ ids ): Response ;
94+ public function flags (int |array $ ids ): ResponseCollection ;
9295
9396 /**
9497 * Fetch message sizes.
9598 */
96- public function sizes (int |array $ ids ): Response ;
99+ public function sizes (int |array $ ids ): ResponseCollection ;
97100
98101 /**
99102 * Select the given folder.
100103 */
101- public function selectFolder (string $ folder ): Response ;
104+ public function selectFolder (string $ folder ): ResponseCollection ;
102105
103106 /**
104107 * Examine a given folder.
105108 */
106- public function examineFolder (string $ folder ): Response ;
109+ public function examineFolder (string $ folder ): ResponseCollection ;
107110
108111 /**
109112 * Get a list of available folders.
110113 *
111114 * @param string $reference mailbox reference for list
112115 * @param string $folder mailbox / folder name match with wildcards
113- * @return Response containing mailboxes that matched $folder as array(globalName => array('delim' => .., 'flags' => ..))
116+ * @return ResponseCollection containing mailboxes that matched $folder as array(globalName => array('delim' => .., 'flags' => ..))
114117 */
115- public function folders (string $ reference = '' , string $ folder = '* ' ): Response ;
118+ public function folders (string $ reference = '' , string $ folder = '* ' ): ResponseCollection ;
116119
117120 /**
118121 * Get the status of a given folder.
119122 *
120- * @return Response list of STATUS items
123+ * @return ResponseCollection list of STATUS items
121124 */
122- public function folderStatus (string $ folder , array $ arguments = ['MESSAGES ' , 'UNSEEN ' , 'RECENT ' , 'UIDNEXT ' , 'UIDVALIDITY ' ]): Response ;
125+ public function folderStatus (string $ folder , array $ arguments = ['MESSAGES ' , 'UNSEEN ' , 'RECENT ' , 'UIDNEXT ' , 'UIDVALIDITY ' ]): ResponseCollection ;
123126
124127 /**
125128 * Set message flags.
@@ -131,9 +134,9 @@ public function folderStatus(string $folder, array $arguments = ['MESSAGES', 'UN
131134 * @param string|null $mode '+' to add flags, '-' to remove flags, everything else sets the flags as given
132135 * @param bool $silent if false the return values are the new flags for the wanted messages
133136 * @param string|null $item command used to store a flag
134- * @return Response containing the new flags if $silent is false, else true or false depending on success
137+ * @return ResponseCollection containing the new flags if $silent is false, else true or false depending on success
135138 */
136- public function store (array |string $ flags , int $ from , ?int $ to = null , ?string $ mode = null , bool $ silent = true , ?string $ item = null ): Response ;
139+ public function store (array |string $ flags , int $ from , ?int $ to = null , ?string $ mode = null , bool $ silent = true , ?string $ item = null ): ResponseCollection ;
137140
138141 /**
139142 * Append a new message to given folder.
@@ -143,7 +146,7 @@ public function store(array|string $flags, int $from, ?int $to = null, ?string $
143146 * @param array|null $flags flags for new message
144147 * @param string|null $date date for new message
145148 */
146- public function appendMessage (string $ folder , string $ message , ?array $ flags = null , ?string $ date = null ): Response ;
149+ public function appendMessage (string $ folder , string $ message , ?array $ flags = null , ?string $ date = null ): ResponseCollection ;
147150
148151 /**
149152 * Copy message set from current folder to other folder.
@@ -152,16 +155,16 @@ public function appendMessage(string $folder, string $message, ?array $flags = n
152155 * @param int|null $to if null only one message ($from) is fetched, else it's the
153156 * last message, INF means last message available
154157 */
155- public function copyMessage (string $ folder , $ from , ?int $ to = null ): Response ;
158+ public function copyMessage (string $ folder , $ from , ?int $ to = null ): ResponseCollection ;
156159
157160 /**
158161 * Copy multiple messages to the target folder.
159162 *
160163 * @param array<string> $messages List of message identifiers
161164 * @param string $folder Destination folder
162- * @return Response Tokens if operation successful, false if an error occurred
165+ * @return ResponseCollection Tokens if operation successful, false if an error occurred
163166 */
164- public function copyManyMessages (array $ messages , string $ folder ): Response ;
167+ public function copyManyMessages (array $ messages , string $ folder ): ResponseCollection ;
165168
166169 /**
167170 * Move a message set from current folder to another folder.
@@ -170,50 +173,50 @@ public function copyManyMessages(array $messages, string $folder): Response;
170173 * @param int|null $to if null only one message ($from) is fetched, else it's the
171174 * last message, INF means last message available
172175 */
173- public function moveMessage (string $ folder , $ from , ?int $ to = null ): Response ;
176+ public function moveMessage (string $ folder , $ from , ?int $ to = null ): ResponseCollection ;
174177
175178 /**
176179 * Move multiple messages to the target folder.
177180 *
178181 * @param array<string> $messages List of message identifiers
179182 * @param string $folder Destination folder
180- * @return Response Tokens if operation successful, false if an error occurred
183+ * @return ResponseCollection Tokens if operation successful, false if an error occurred
181184 */
182- public function moveManyMessages (array $ messages , string $ folder ): Response ;
185+ public function moveManyMessages (array $ messages , string $ folder ): ResponseCollection ;
183186
184187 /**
185188 * Create a new folder.
186189 *
187190 * @param string $folder folder name
188191 */
189- public function createFolder (string $ folder ): Response ;
192+ public function createFolder (string $ folder ): ResponseCollection ;
190193
191194 /**
192195 * Rename an existing folder.
193196 *
194197 * @param string $oldPath old name
195198 * @param string $newPath new name
196199 */
197- public function renameFolder (string $ oldPath , string $ newPath ): Response ;
200+ public function renameFolder (string $ oldPath , string $ newPath ): ResponseCollection ;
198201
199202 /**
200203 * Delete a folder.
201204 *
202205 * @param string $folder folder name
203206 */
204- public function deleteFolder (string $ folder ): Response ;
207+ public function deleteFolder (string $ folder ): ResponseCollection ;
205208
206209 /**
207210 * Subscribe to a folder.
208211 *
209212 * @param string $folder folder name
210213 */
211- public function subscribeFolder (string $ folder ): Response ;
214+ public function subscribeFolder (string $ folder ): ResponseCollection ;
212215
213216 /**
214217 * Unsubscribe from a folder.
215218 *
216219 * @param string $folder folder name
217220 */
218- public function unsubscribeFolder (string $ folder ): Response ;
221+ public function unsubscribeFolder (string $ folder ): ResponseCollection ;
219222}
0 commit comments