refactor: service address
Signed-off-by: Sebastian Krupinski <krupinski01@gmail.com>
This commit is contained in:
@@ -50,8 +50,6 @@ class DefaultController extends ControllerAbstract {
|
||||
private const ERR_INVALID_TARGETS = 'Invalid parameter: targets must be an array';
|
||||
private const ERR_INVALID_DATA = 'Invalid parameter: data must be an array';
|
||||
|
||||
private const STREAM_FLUSH_INTERVAL = 1;
|
||||
|
||||
public function __construct(
|
||||
private readonly SessionTenant $tenantIdentity,
|
||||
private readonly SessionIdentity $userIdentity,
|
||||
@@ -162,7 +160,7 @@ class DefaultController extends ControllerAbstract {
|
||||
'entity.patch' => $this->entityPatch($tenantId, $userId, $data),
|
||||
'entity.move' => $this->entityMove($tenantId, $userId, $data),
|
||||
'entity.copy' => throw new InvalidArgumentException('Operation not implemented: ' . $operation),
|
||||
'entity.transmit' => $this->entityTransmit($tenantId, $userId, $data),
|
||||
'entity.submit' => $this->entitySubmit($tenantId, $userId, $data),
|
||||
'entity.download' => $this->entityDownload($tenantId, $userId, $data),
|
||||
|
||||
default => throw new InvalidArgumentException(self::ERR_INVALID_OPERATION . $operation)
|
||||
@@ -839,29 +837,21 @@ class DefaultController extends ControllerAbstract {
|
||||
return $this->mailManager->entityMove($tenantId, $userId, $target, ...$sources->all());
|
||||
}
|
||||
|
||||
private function entityTransmit(string $tenantId, string $userId, array $data): mixed {
|
||||
if (!isset($data['provider'])) {
|
||||
throw new InvalidArgumentException(self::ERR_MISSING_PROVIDER);
|
||||
private function entitySubmit(string $tenantId, string $userId, array $data): mixed {
|
||||
if (!isset($data['sender'])) {
|
||||
throw new InvalidArgumentException(self::ERR_MISSING_SENDER);
|
||||
}
|
||||
if (!is_string($data['provider'])) {
|
||||
throw new InvalidArgumentException(self::ERR_INVALID_PROVIDER);
|
||||
if (!is_string($data['sender'])) {
|
||||
throw new InvalidArgumentException(self::ERR_INVALID_SENDER);
|
||||
}
|
||||
if (!isset($data['service'])) {
|
||||
throw new InvalidArgumentException(self::ERR_MISSING_SERVICE);
|
||||
}
|
||||
if (!is_string($data['service'])) {
|
||||
throw new InvalidArgumentException(self::ERR_INVALID_SERVICE);
|
||||
}
|
||||
|
||||
$jobId = $this->mailManager->entityTransmit(
|
||||
|
||||
return $this->mailManager->entitySubmit(
|
||||
$tenantId,
|
||||
$userId,
|
||||
$data['provider'],
|
||||
$data['service'],
|
||||
$data['data']
|
||||
$data['sender'],
|
||||
$data['source'] ?? null,
|
||||
$data['message'] ?? null,
|
||||
);
|
||||
|
||||
return ['jobId' => $jobId];
|
||||
}
|
||||
|
||||
private function entityDownload(string $tenantId, string $userId, array $data): mixed {
|
||||
|
||||
Reference in New Issue
Block a user