feat: implement entity mutable interface

Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
2026-05-09 17:03:58 -04:00
parent d9bc526126
commit 086d7a1366
3 changed files with 134 additions and 38 deletions

View File

@@ -59,8 +59,6 @@ class RemoteMailService
public function __construct(
private readonly Client $client,
private readonly string $provider,
private readonly string|int $service,
) {}
/**
@@ -330,6 +328,31 @@ class RemoteMailService
return array_fill_keys($uids, true);
}
public function entityPatch(string $collection, array $flagsToAdd = [], array $flagsToRemove = [], int ...$uids): void
{
if (empty($uids)) {
return;
}
$this->client->perform(new SelectCommand($collection, false));
if (!empty($flagsToAdd)) {
$this->client->perform(new StoreCommand(
FetchTarget::uid(SequenceSet::items(...array_values($uids))),
$flagsToAdd,
'+',
));
}
if (!empty($flagsToRemove)) {
$this->client->perform(new StoreCommand(
FetchTarget::uid(SequenceSet::items(...array_values($uids))),
$flagsToRemove,
'-',
));
}
}
public function entityMove(string $targetCollection, string $sourceCollection, int ...$uids): array
{
if (empty($uids)) {