generated from Nodarx/template
feat: implement download
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
@@ -6,8 +6,8 @@ namespace KTXM\ProviderImap\Client;
|
||||
|
||||
use KTXM\ProviderImap\Client\Command\CapabilityCommand;
|
||||
use KTXM\ProviderImap\Client\Command\CommandInterface;
|
||||
use KTXM\ProviderImap\Client\FetchTarget;
|
||||
use KTXM\ProviderImap\Client\Command\LoginCommand;
|
||||
use KTXM\ProviderImap\Client\Command\StatusCommand;
|
||||
use KTXM\ProviderImap\Client\Command\StartTlsCommand;
|
||||
use KTXM\ProviderImap\Client\Protocol\CommandExecutor;
|
||||
use KTXM\ProviderImap\Client\Protocol\ProtocolReader;
|
||||
@@ -87,6 +87,15 @@ final class Client implements ClientInterface
|
||||
return $this->executor->perform($command, $this->session);
|
||||
}
|
||||
|
||||
public function download(FetchTarget $target, string $section, int $chunkSize = 8192): \Generator
|
||||
{
|
||||
if ($this->session === null || $this->executor === null) {
|
||||
throw new ImapException('IMAP client is not connected.');
|
||||
}
|
||||
|
||||
return $this->executor->download($target, $section, $chunkSize, $this->session);
|
||||
}
|
||||
|
||||
public function session(): SessionContext
|
||||
{
|
||||
if ($this->session === null) {
|
||||
|
||||
Reference in New Issue
Block a user