feat: implement message create and update

Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
2026-08-25 21:45:32 -04:00
parent 0e99bb0fd2
commit ab5871aad7
4 changed files with 206 additions and 5 deletions
+21
View File
@@ -11,6 +11,7 @@ namespace KTXM\ProviderImap\Providers;
use KTXM\ProviderImap\Client\Message;
use KTXF\Mail\Entity\EntityMutableAbstract;
use KTXF\Mail\Object\MessagePropertiesMutableInterface;
/**
* Mail Entity Resource Implementation
@@ -42,6 +43,26 @@ class EntityResource extends EntityMutableAbstract {
return $this;
}
/**
* Populate an entity returned by a create or replacement operation.
*/
public function fromMutation(
string $mailbox,
string|int $identifier,
MessagePropertiesMutableInterface $properties,
): static {
$this->data['collection'] = $mailbox;
$this->data['identifier'] = $identifier;
if ($properties instanceof MessageProperties) {
$this->setProperties($properties);
} else {
$this->getProperties()->jsonDeserialize($properties->jsonSerialize());
}
return $this;
}
/**
* @inheritDoc
*/