Compare commits
1 Commits
main
...
chore/down
| Author | SHA1 | Date | |
|---|---|---|---|
| db287117f5 |
20
composer.lock
generated
20
composer.lock
generated
@@ -4,7 +4,7 @@
|
|||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "85ac161c93851c4863257009fc596644",
|
"content-hash": "b14b010c422e222aeb1e33104e2a09ec",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "laravel/serializable-closure",
|
"name": "laravel/serializable-closure",
|
||||||
@@ -606,16 +606,16 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/console",
|
"name": "symfony/console",
|
||||||
"version": "v7.4.11",
|
"version": "v7.4.9",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/symfony/console.git",
|
"url": "https://github.com/symfony/console.git",
|
||||||
"reference": "ed0107e43ab452aa77ae99e005b95e56b556e075"
|
"reference": "d7d2b64a45a89d607865927b176fa51c33ddbb58"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/symfony/console/zipball/ed0107e43ab452aa77ae99e005b95e56b556e075",
|
"url": "https://api.github.com/repos/symfony/console/zipball/d7d2b64a45a89d607865927b176fa51c33ddbb58",
|
||||||
"reference": "ed0107e43ab452aa77ae99e005b95e56b556e075",
|
"reference": "d7d2b64a45a89d607865927b176fa51c33ddbb58",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
@@ -680,7 +680,7 @@
|
|||||||
"terminal"
|
"terminal"
|
||||||
],
|
],
|
||||||
"support": {
|
"support": {
|
||||||
"source": "https://github.com/symfony/console/tree/v7.4.11"
|
"source": "https://github.com/symfony/console/tree/v7.4.9"
|
||||||
},
|
},
|
||||||
"funding": [
|
"funding": [
|
||||||
{
|
{
|
||||||
@@ -700,7 +700,7 @@
|
|||||||
"type": "tidelift"
|
"type": "tidelift"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2026-05-13T12:04:42+00:00"
|
"time": "2026-04-22T15:21:55+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "symfony/deprecation-contracts",
|
"name": "symfony/deprecation-contracts",
|
||||||
@@ -3148,7 +3148,7 @@
|
|||||||
],
|
],
|
||||||
"aliases": [],
|
"aliases": [],
|
||||||
"minimum-stability": "stable",
|
"minimum-stability": "stable",
|
||||||
"stability-flags": {},
|
"stability-flags": [],
|
||||||
"prefer-stable": true,
|
"prefer-stable": true,
|
||||||
"prefer-lowest": false,
|
"prefer-lowest": false,
|
||||||
"platform": {
|
"platform": {
|
||||||
@@ -3156,6 +3156,6 @@
|
|||||||
"ext-ctype": "*",
|
"ext-ctype": "*",
|
||||||
"ext-iconv": "*"
|
"ext-iconv": "*"
|
||||||
},
|
},
|
||||||
"platform-dev": {},
|
"platform-dev": [],
|
||||||
"plugin-api-version": "2.9.0"
|
"plugin-api-version": "2.3.0"
|
||||||
}
|
}
|
||||||
|
|||||||
1163
package-lock.json
generated
1163
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
72
package.json
72
package.json
@@ -21,45 +21,45 @@
|
|||||||
"test:coverage": "vitest run --coverage --config tests/js/vitest.config.ts"
|
"test:coverage": "vitest run --coverage --config tests/js/vitest.config.ts"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@fontsource/inter": "^5.2.8",
|
"@fontsource/inter": "5.2.8",
|
||||||
"@fontsource/poppins": "^5.2.7",
|
"@fontsource/poppins": "5.2.7",
|
||||||
"@fontsource/public-sans": "^5.2.7",
|
"@fontsource/public-sans": "5.2.7",
|
||||||
"@fontsource/roboto": "^5.2.10",
|
"@fontsource/roboto": "5.2.10",
|
||||||
"@mdi/font": "^7.4.47",
|
"@mdi/font": "7.4.47",
|
||||||
"@tsconfig/node24": "^24.0.4",
|
"@tsconfig/node24": "24.0.4",
|
||||||
"@typescript-eslint/parser": "^8.59.3",
|
"@typescript-eslint/parser": "^8.55.0",
|
||||||
"@vue/compiler-sfc": "^3.5.34",
|
"@vue/compiler-sfc": "^3.5.33",
|
||||||
"dompurify": "^3.4.3",
|
"dompurify": "^3.4.1",
|
||||||
"pinia": "^3.0.4",
|
"pinia": "3.0.4",
|
||||||
"vee-validate": "^4.15.1",
|
"vee-validate": "^4.15.1",
|
||||||
"vite-plugin-vuetify": "^2.1.3",
|
"vite-plugin-vuetify": "2.1.3",
|
||||||
"vue": "^3.5.34",
|
"vue": "3.5.28",
|
||||||
"vue-router": "^5.0.7",
|
"vue-router": "5.0.6",
|
||||||
"vue3-perfect-scrollbar": "^2.0.0",
|
"vue3-perfect-scrollbar": "2.0.0",
|
||||||
"vuetify": "^4.0.7"
|
"vuetify": "4.0.6"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@eslint/js": "^10.0.1",
|
"@eslint/js": "^10.0.0",
|
||||||
"@types/dompurify": "^3.2.0",
|
"@types/dompurify": "^3.2.0",
|
||||||
"@types/node": "^25.8.0",
|
"@types/node": "25.6.0",
|
||||||
"@vitejs/plugin-vue": "^6.0.7",
|
"@vitejs/plugin-vue": "6.0.6",
|
||||||
"@vitest/coverage-v8": "^4.1.6",
|
"@vitest/coverage-v8": "^4.0.18",
|
||||||
"@vitest/ui": "^4.1.6",
|
"@vitest/ui": "^4.0.18",
|
||||||
"@vue/eslint-config-prettier": "^10.2.0",
|
"@vue/eslint-config-prettier": "10.2.0",
|
||||||
"@vue/test-utils": "^2.4.10",
|
"@vue/test-utils": "^2.4.8",
|
||||||
"@vue/tsconfig": "^0.9.1",
|
"@vue/tsconfig": "0.9.1",
|
||||||
"eslint": "^10.3.0",
|
"eslint": "^10.0.0",
|
||||||
"eslint-plugin-vue": "^10.9.1",
|
"eslint-plugin-vue": "10.9.1",
|
||||||
"jsdom": "^29.1.1",
|
"jsdom": "^29.0.0",
|
||||||
"prettier": "^3.8.3",
|
"prettier": "3.8.3",
|
||||||
"sass": "^1.99.0",
|
"sass": "1.99.0",
|
||||||
"sass-loader": "^16.0.8",
|
"sass-loader": "16.0.7",
|
||||||
"typescript": "^6.0.3",
|
"typescript": "6.0.3",
|
||||||
"typescript-eslint": "^8.59.3",
|
"typescript-eslint": "^8.59.0",
|
||||||
"vite": "^8.0.13",
|
"vite": "8.0.10",
|
||||||
"vite-plugin-static-copy": "^4.1.0",
|
"vite-plugin-static-copy": "^4.0.0",
|
||||||
"vitest": "^4.1.6",
|
"vitest": "^4.0.18",
|
||||||
"vue-cli-plugin-vuetify": "^2.5.8",
|
"vue-cli-plugin-vuetify": "2.5.8",
|
||||||
"vue-tsc": "^3.2.9"
|
"vue-tsc": "^3.2.7"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace KTXF\Mail\Collection;
|
namespace KTXF\Mail\Collection;
|
||||||
|
|
||||||
use KTXF\Resource\Identifier\CollectionIdentifier;
|
|
||||||
use KTXF\Resource\Provider\Node\NodeBaseAbstract;
|
use KTXF\Resource\Provider\Node\NodeBaseAbstract;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -21,13 +20,8 @@ use KTXF\Resource\Provider\Node\NodeBaseAbstract;
|
|||||||
*/
|
*/
|
||||||
abstract class CollectionBase extends NodeBaseAbstract implements CollectionBaseInterface {
|
abstract class CollectionBase extends NodeBaseAbstract implements CollectionBaseInterface {
|
||||||
|
|
||||||
protected string $type = 'mail.collection';
|
|
||||||
protected CollectionPropertiesBaseAbstract $properties;
|
protected CollectionPropertiesBaseAbstract $properties;
|
||||||
|
|
||||||
protected function nodeIdentifier(): CollectionIdentifier {
|
|
||||||
return new CollectionIdentifier($this->data[static::PROPERTY_PROVIDER], $this->data[static::PROPERTY_SERVICE], (string) $this->data[static::PROPERTY_IDENTIFIER]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace KTXF\Mail\Collection;
|
namespace KTXF\Mail\Collection;
|
||||||
|
|
||||||
use KTXF\Resource\Identifier\CollectionIdentifier;
|
|
||||||
use KTXF\Resource\Provider\Node\NodeMutableAbstract;
|
use KTXF\Resource\Provider\Node\NodeMutableAbstract;
|
||||||
use KTXF\Resource\Provider\Node\NodePropertiesMutableInterface;
|
use KTXF\Resource\Provider\Node\NodePropertiesMutableInterface;
|
||||||
|
|
||||||
@@ -24,10 +23,6 @@ abstract class CollectionMutableAbstract extends NodeMutableAbstract implements
|
|||||||
|
|
||||||
protected CollectionPropertiesMutableAbstract $properties;
|
protected CollectionPropertiesMutableAbstract $properties;
|
||||||
|
|
||||||
protected function nodeIdentifier(): CollectionIdentifier {
|
|
||||||
return new CollectionIdentifier($this->data[static::PROPERTY_PROVIDER], $this->data[static::PROPERTY_SERVICE], $this->data[static::PROPERTY_IDENTIFIER]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -20,47 +20,49 @@ use KTXF\Resource\Provider\Node\NodePropertiesBaseAbstract;
|
|||||||
*/
|
*/
|
||||||
abstract class CollectionPropertiesBaseAbstract extends NodePropertiesBaseAbstract implements CollectionPropertiesBaseInterface {
|
abstract class CollectionPropertiesBaseAbstract extends NodePropertiesBaseAbstract implements CollectionPropertiesBaseInterface {
|
||||||
|
|
||||||
|
public const JSON_TYPE = CollectionPropertiesBaseInterface::JSON_TYPE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function total(): int {
|
public function total(): int {
|
||||||
return $this->data[static::PROPERTY_TOTAL] ?? 0;
|
return $this->data['total'] ?? 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function unread(): int {
|
public function unread(): int {
|
||||||
return $this->data[static::PROPERTY_UNREAD] ?? 0;
|
return $this->data['unread'] ?? 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function getLabel(): string {
|
public function getLabel(): string {
|
||||||
return $this->data[static::PROPERTY_LABEL] ?? '';
|
return $this->data['label'] ?? '';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function getRole(): CollectionRoles {
|
public function getRole(): CollectionRoles {
|
||||||
return isset($this->data[static::PROPERTY_ROLE])
|
return isset($this->data['role'])
|
||||||
? ($this->data[static::PROPERTY_ROLE] instanceof CollectionRoles ? $this->data[static::PROPERTY_ROLE] : CollectionRoles::from($this->data[static::PROPERTY_ROLE]))
|
? ($this->data['role'] instanceof CollectionRoles ? $this->data['role'] : CollectionRoles::from($this->data['role']))
|
||||||
: CollectionRoles::None;
|
: CollectionRoles::Custom;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function getRank(): int {
|
public function getRank(): int {
|
||||||
return $this->data[static::PROPERTY_RANK] ?? 0;
|
return $this->data['rank'] ?? 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function getSubscription(): bool {
|
public function getSubscription(): bool {
|
||||||
return $this->data[static::PROPERTY_SUBSCRIPTION] ?? false;
|
return $this->data['subscribed'] ?? false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,12 +13,13 @@ use KTXF\Resource\Provider\Node\NodePropertiesBaseInterface;
|
|||||||
|
|
||||||
interface CollectionPropertiesBaseInterface extends NodePropertiesBaseInterface {
|
interface CollectionPropertiesBaseInterface extends NodePropertiesBaseInterface {
|
||||||
|
|
||||||
public const PROPERTY_TOTAL = 'total';
|
public const JSON_TYPE = 'mail.collection';
|
||||||
public const PROPERTY_UNREAD = 'unread';
|
public const JSON_PROPERTY_TOTAL = 'total';
|
||||||
public const PROPERTY_LABEL = 'label';
|
public const JSON_PROPERTY_UNREAD = 'unread';
|
||||||
public const PROPERTY_ROLE = 'role';
|
public const JSON_PROPERTY_LABEL = 'label';
|
||||||
public const PROPERTY_RANK = 'rank';
|
public const JSON_PROPERTY_ROLE = 'role';
|
||||||
public const PROPERTY_SUBSCRIPTION = 'subscription';
|
public const JSON_PROPERTY_RANK = 'rank';
|
||||||
|
public const JSON_PROPERTY_SUBSCRIPTION = 'subscription';
|
||||||
|
|
||||||
public function total(): int;
|
public function total(): int;
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,8 @@ use KTXF\Resource\Provider\Node\NodePropertiesMutableAbstract;
|
|||||||
*/
|
*/
|
||||||
abstract class CollectionPropertiesMutableAbstract extends CollectionPropertiesBaseAbstract implements CollectionPropertiesMutableInterface {
|
abstract class CollectionPropertiesMutableAbstract extends CollectionPropertiesBaseAbstract implements CollectionPropertiesMutableInterface {
|
||||||
|
|
||||||
|
public const JSON_TYPE = CollectionPropertiesBaseInterface::JSON_TYPE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
@@ -33,7 +35,7 @@ abstract class CollectionPropertiesMutableAbstract extends CollectionPropertiesB
|
|||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function setLabel(string $value): static {
|
public function setLabel(string $value): static {
|
||||||
$this->data[self::PROPERTY_LABEL] = $value;
|
$this->data['label'] = $value;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -41,7 +43,7 @@ abstract class CollectionPropertiesMutableAbstract extends CollectionPropertiesB
|
|||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function setRole(CollectionRoles $value): static {
|
public function setRole(CollectionRoles $value): static {
|
||||||
$this->data[self::PROPERTY_ROLE] = $value;
|
$this->data['role'] = $value;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -49,7 +51,7 @@ abstract class CollectionPropertiesMutableAbstract extends CollectionPropertiesB
|
|||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function setRank(int $value): static {
|
public function setRank(int $value): static {
|
||||||
$this->data[self::PROPERTY_RANK] = $value;
|
$this->data['rank'] = $value;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,7 +59,7 @@ abstract class CollectionPropertiesMutableAbstract extends CollectionPropertiesB
|
|||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function setSubscription(bool $value): static {
|
public function setSubscription(bool $value): static {
|
||||||
$this->data[self::PROPERTY_SUBSCRIPTION] = $value;
|
$this->data['subscription'] = $value;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,8 @@ use KTXF\Resource\Provider\Node\NodePropertiesMutableInterface;
|
|||||||
|
|
||||||
interface CollectionPropertiesMutableInterface extends CollectionPropertiesBaseInterface, NodePropertiesMutableInterface {
|
interface CollectionPropertiesMutableInterface extends CollectionPropertiesBaseInterface, NodePropertiesMutableInterface {
|
||||||
|
|
||||||
|
public const JSON_TYPE = CollectionPropertiesBaseInterface::JSON_TYPE;
|
||||||
|
|
||||||
public function setLabel(string $value);
|
public function setLabel(string $value);
|
||||||
|
|
||||||
public function setRole(CollectionRoles $value): static;
|
public function setRole(CollectionRoles $value): static;
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ declare(strict_types=1);
|
|||||||
namespace KTXF\Mail\Entity;
|
namespace KTXF\Mail\Entity;
|
||||||
|
|
||||||
use KTXF\Mail\Object\MessagePropertiesBaseInterface;
|
use KTXF\Mail\Object\MessagePropertiesBaseInterface;
|
||||||
use KTXF\Resource\Identifier\EntityIdentifier;
|
|
||||||
use KTXF\Resource\Provider\Node\NodeBaseAbstract;
|
use KTXF\Resource\Provider\Node\NodeBaseAbstract;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -22,13 +21,8 @@ use KTXF\Resource\Provider\Node\NodeBaseAbstract;
|
|||||||
*/
|
*/
|
||||||
abstract class EntityBaseAbstract extends NodeBaseAbstract implements EntityBaseInterface {
|
abstract class EntityBaseAbstract extends NodeBaseAbstract implements EntityBaseInterface {
|
||||||
|
|
||||||
protected string $type = 'mail.entity';
|
|
||||||
protected MessagePropertiesBaseInterface $properties;
|
protected MessagePropertiesBaseInterface $properties;
|
||||||
|
|
||||||
protected function nodeIdentifier(): EntityIdentifier {
|
|
||||||
return new EntityIdentifier($this->data[static::PROPERTY_PROVIDER], $this->data[static::PROPERTY_SERVICE], $this->data[static::PROPERTY_COLLECTION], $this->data[static::PROPERTY_IDENTIFIER]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -15,6 +15,8 @@ use KTXF\Resource\Provider\Node\NodeBaseInterface;
|
|||||||
|
|
||||||
interface EntityBaseInterface extends NodeBaseInterface {
|
interface EntityBaseInterface extends NodeBaseInterface {
|
||||||
|
|
||||||
|
public const JSON_TYPE = 'mail.entity';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the entity properties
|
* Gets the entity properties
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ declare(strict_types=1);
|
|||||||
namespace KTXF\Mail\Entity;
|
namespace KTXF\Mail\Entity;
|
||||||
|
|
||||||
use KTXF\Mail\Object\MessagePropertiesMutableInterface;
|
use KTXF\Mail\Object\MessagePropertiesMutableInterface;
|
||||||
use KTXF\Resource\Identifier\EntityIdentifier;
|
|
||||||
use KTXF\Resource\Provider\Node\NodeMutableAbstract;
|
use KTXF\Resource\Provider\Node\NodeMutableAbstract;
|
||||||
use KTXF\Resource\Provider\Node\NodePropertiesMutableInterface;
|
use KTXF\Resource\Provider\Node\NodePropertiesMutableInterface;
|
||||||
|
|
||||||
@@ -23,12 +22,9 @@ use KTXF\Resource\Provider\Node\NodePropertiesMutableInterface;
|
|||||||
*/
|
*/
|
||||||
abstract class EntityMutableAbstract extends NodeMutableAbstract implements EntityMutableInterface {
|
abstract class EntityMutableAbstract extends NodeMutableAbstract implements EntityMutableInterface {
|
||||||
|
|
||||||
protected string $type = 'mail.entity';
|
public const JSON_TYPE = EntityMutableInterface::JSON_TYPE;
|
||||||
protected MessagePropertiesMutableInterface $properties;
|
|
||||||
|
|
||||||
protected function nodeIdentifier(): EntityIdentifier {
|
protected MessagePropertiesMutableInterface $properties;
|
||||||
return new EntityIdentifier($this->data[static::PROPERTY_PROVIDER], $this->data[static::PROPERTY_SERVICE], (string) $this->data[static::PROPERTY_COLLECTION], (string) $this->data[static::PROPERTY_IDENTIFIER]);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ use KTXF\Resource\Provider\Node\NodeMutableInterface;
|
|||||||
*/
|
*/
|
||||||
interface EntityMutableInterface extends EntityBaseInterface, NodeMutableInterface {
|
interface EntityMutableInterface extends EntityBaseInterface, NodeMutableInterface {
|
||||||
|
|
||||||
|
public const JSON_TYPE = EntityBaseInterface::JSON_TYPE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the entity properties (mutable)
|
* Gets the entity properties (mutable)
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -21,161 +21,188 @@ use KTXF\Resource\Provider\Node\NodePropertiesBaseAbstract;
|
|||||||
*/
|
*/
|
||||||
abstract class MessagePropertiesBaseAbstract extends NodePropertiesBaseAbstract implements MessagePropertiesBaseInterface {
|
abstract class MessagePropertiesBaseAbstract extends NodePropertiesBaseAbstract implements MessagePropertiesBaseInterface {
|
||||||
|
|
||||||
protected string $type = 'mail.message';
|
public const JSON_TYPE = MessagePropertiesBaseInterface::JSON_TYPE;
|
||||||
|
|
||||||
/**
|
|
||||||
* @inheritDoc
|
|
||||||
*/
|
|
||||||
public function jsonSerialize(): array {
|
|
||||||
return $this->data;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @inheritDoc
|
|
||||||
*/
|
|
||||||
public function getSize(): ?int {
|
|
||||||
return $this->data[static::PROPERTY_SIZE] ?? null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function getHeaders(): array {
|
public function getHeaders(): array {
|
||||||
return $this->data[static::PROPERTY_HEADERS] ?? [];
|
return $this->data['headers'] ?? [];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function getHeader(string $name): string|array|null {
|
public function getHeader(string $name): string|array|null {
|
||||||
return $this->data[static::PROPERTY_HEADERS][$name] ?? null;
|
return $this->data['headers'][$name] ?? null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function getUrid(): ?string {
|
public function getUrid(): ?string {
|
||||||
return $this->data[static::PROPERTY_URID] ?? null;
|
return $this->data['urid'] ?? null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function getInReplyTo(): ?string {
|
public function getCreated(): ?DateTimeImmutable {
|
||||||
return $this->data[static::PROPERTY_IN_REPLY_TO] ?? null;
|
return $this->data['created'] ?? null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function getReferences(): array {
|
public function getModified(): ?DateTimeImmutable {
|
||||||
return $this->data[static::PROPERTY_REFERENCES] ?? [];
|
return $this->data['modified'] ?? null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function getDate(): ?DateTimeImmutable {
|
||||||
|
return $this->data['date'] ?? null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function getReceived(): ?DateTimeImmutable {
|
public function getReceived(): ?DateTimeImmutable {
|
||||||
return $this->data[static::PROPERTY_RECEIVED] ?? null;
|
return $this->data['received'] ?? null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function getSent(): ?DateTimeImmutable {
|
public function getSize(): ?int {
|
||||||
return $this->data[static::PROPERTY_SENT] ?? null;
|
return $this->data['size'] ?? null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function getSender(): ?AddressInterface {
|
public function getSender(): ?AddressInterface {
|
||||||
return $this->data[static::PROPERTY_SENDER] ?? null;
|
return $this->data['sender'] ?? null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function getFrom(): ?AddressInterface {
|
public function getFrom(): ?AddressInterface {
|
||||||
return $this->data[static::PROPERTY_FROM] ?? null;
|
return $this->data['from'] ?? null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function getReplyTo(): array {
|
public function getReplyTo(): array {
|
||||||
return $this->data[static::PROPERTY_REPLY_TO] ?? [];
|
return $this->data['replyTo'] ?? [];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function getTo(): array {
|
public function getTo(): array {
|
||||||
return $this->data[static::PROPERTY_TO] ?? [];
|
return $this->data['to'] ?? [];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function getCc(): array {
|
public function getCc(): array {
|
||||||
return $this->data[static::PROPERTY_CC] ?? [];
|
return $this->data['cc'] ?? [];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function getBcc(): array {
|
public function getBcc(): array {
|
||||||
return $this->data[static::PROPERTY_BCC] ?? [];
|
return $this->data['bcc'] ?? [];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function getInReplyTo(): ?string {
|
||||||
|
return $this->data['inReplyTo'] ?? null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function getReferences(): array {
|
||||||
|
return $this->data['references'] ?? [];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function getSubject(): string {
|
public function getSubject(): string {
|
||||||
return $this->data[static::PROPERTY_SUBJECT] ?? '';
|
return $this->data['subject'] ?? '';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function getBody(): ?MessagePartInterface {
|
public function getSnippet(): ?string {
|
||||||
return $this->data[static::PROPERTY_BODY] ?? null;
|
return $this->data['snippet'] ?? null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function hasBody(): bool {
|
public function getBodyText(): ?string {
|
||||||
return ($this->data[static::PROPERTY_BODY_TEXT_PLAIN] !== null && $this->data[static::PROPERTY_BODY_TEXT_PLAIN] !== '')
|
return $this->data['bodyText'] ?? null;
|
||||||
|| ($this->data[static::PROPERTY_BODY_TEXT_HTML] !== null && $this->data[static::PROPERTY_BODY_TEXT_HTML] !== '');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function getBodyTextPlain(): ?string {
|
public function getBodyTextCharset(): ?string {
|
||||||
return $this->data[static::PROPERTY_BODY_TEXT_PLAIN] ?? null;
|
return $this->data['bodyTextCharset'] ?? null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function getBodyTextHtml(): ?string {
|
public function getBodyTextSize(): ?int {
|
||||||
return $this->data[static::PROPERTY_BODY_TEXT_HTML] ?? null;
|
return $this->data['bodyTextSize'] ?? null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function getBodyHtml(): ?string {
|
||||||
|
return $this->data['bodyHtml'] ?? null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function getBodyHtmlCharset(): ?string {
|
||||||
|
return $this->data['bodyHtmlCharset'] ?? null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function getBodyHtmlSize(): ?int {
|
||||||
|
return $this->data['bodyHtmlSize'] ?? null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function getAttachments(): array {
|
public function getAttachments(): array {
|
||||||
return $this->data[static::PROPERTY_ATTACHMENTS] ?? [];
|
return $this->data['attachments'] ?? [];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function getFlags(): array {
|
public function getFlags(): array {
|
||||||
return $this->data[static::PROPERTY_FLAGS] ?? [
|
return $this->data['flags'] ?? [
|
||||||
'read' => false,
|
'read' => false,
|
||||||
'starred' => false,
|
'starred' => false,
|
||||||
'important' => false,
|
'important' => false,
|
||||||
@@ -191,7 +218,179 @@ abstract class MessagePropertiesBaseAbstract extends NodePropertiesBaseAbstract
|
|||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function getFlag(string $name): bool {
|
public function getFlag(string $name): bool {
|
||||||
return $this->data[static::PROPERTY_FLAGS][$name] ?? false;
|
return $this->data['flags'][$name] ?? false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets message labels
|
||||||
|
*
|
||||||
|
* @since 2025.05.01
|
||||||
|
*
|
||||||
|
* @return array<int, string>
|
||||||
|
*/
|
||||||
|
public function getLabels(): array {
|
||||||
|
return $this->data['labels'] ?? [];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets message tags
|
||||||
|
*
|
||||||
|
* @since 2025.05.01
|
||||||
|
*
|
||||||
|
* @return array<int, string>
|
||||||
|
*/
|
||||||
|
public function getTags(): array {
|
||||||
|
return $this->data['tags'] ?? [];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets message priority
|
||||||
|
*
|
||||||
|
* @since 2025.05.01
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getPriority(): string {
|
||||||
|
return $this->data['priority'] ?? 'normal';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets message sensitivity
|
||||||
|
*
|
||||||
|
* @since 2025.05.01
|
||||||
|
*
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getSensitivity(): string {
|
||||||
|
return $this->data['sensitivity'] ?? 'normal';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets encryption information
|
||||||
|
*
|
||||||
|
* @since 2025.05.01
|
||||||
|
*
|
||||||
|
* @return array{method: string|null, signed: bool, encrypted: bool}
|
||||||
|
*/
|
||||||
|
public function getEncryption(): array {
|
||||||
|
return $this->data['encryption'] ?? [
|
||||||
|
'method' => null,
|
||||||
|
'signed' => false,
|
||||||
|
'encrypted' => false,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if delivery receipt is requested
|
||||||
|
*
|
||||||
|
* @since 2025.05.01
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function isDeliveryReceipt(): bool {
|
||||||
|
return $this->data['deliveryReceipt'] ?? false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Checks if read receipt is requested
|
||||||
|
*
|
||||||
|
* @since 2025.05.01
|
||||||
|
*
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function isReadReceipt(): bool {
|
||||||
|
return $this->data['readReceipt'] ?? false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function hasRecipients(): bool {
|
||||||
|
return !empty($this->data['to']) || !empty($this->data['cc']) || !empty($this->data['bcc']);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function hasBody(): bool {
|
||||||
|
return ($this->data['bodyText'] !== null && $this->data['bodyText'] !== '')
|
||||||
|
|| ($this->data['bodyHtml'] !== null && $this->data['bodyHtml'] !== '');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function getBody(): ?MessagePartInterface {
|
||||||
|
return $this->data['body'] ?? null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function jsonSerialize(): array {
|
||||||
|
$data = [
|
||||||
|
self::JSON_PROPERTY_TYPE => self::JSON_TYPE,
|
||||||
|
self::JSON_PROPERTY_SCHEMA => $this->data['schema'] ?? 1,
|
||||||
|
];
|
||||||
|
|
||||||
|
if (!empty($this->data['headers'])) {
|
||||||
|
$data[self::JSON_PROPERTY_HEADERS] = $this->data['headers'];
|
||||||
|
}
|
||||||
|
if (isset($this->data['urid']) && $this->data['urid'] !== null) {
|
||||||
|
$data[self::JSON_PROPERTY_URID] = $this->data['urid'];
|
||||||
|
}
|
||||||
|
if (isset($this->data['date']) && $this->data['date'] !== null) {
|
||||||
|
$data[self::JSON_PROPERTY_DATE] = $this->data['date'] instanceof DateTimeImmutable
|
||||||
|
? $this->data['date']->format('c')
|
||||||
|
: $this->data['date'];
|
||||||
|
}
|
||||||
|
if (isset($this->data['received']) && $this->data['received'] !== null) {
|
||||||
|
$data[self::JSON_PROPERTY_RECEIVED] = $this->data['received'] instanceof DateTimeImmutable
|
||||||
|
? $this->data['received']->format('c')
|
||||||
|
: $this->data['received'];
|
||||||
|
}
|
||||||
|
if (isset($this->data['size']) && $this->data['size'] !== null) {
|
||||||
|
$data[self::JSON_PROPERTY_SIZE] = $this->data['size'];
|
||||||
|
}
|
||||||
|
if (isset($this->data['sender']) && $this->data['sender'] !== null) {
|
||||||
|
$data[self::JSON_PROPERTY_SENDER] = $this->data['sender'];
|
||||||
|
}
|
||||||
|
if (isset($this->data['from']) && $this->data['from'] !== null) {
|
||||||
|
$data[self::JSON_PROPERTY_FROM] = $this->data['from'];
|
||||||
|
}
|
||||||
|
if (!empty($this->data['replyTo'])) {
|
||||||
|
$data[self::JSON_PROPERTY_REPLY_TO] = $this->data['replyTo'];
|
||||||
|
}
|
||||||
|
if (!empty($this->data['to'])) {
|
||||||
|
$data[self::JSON_PROPERTY_TO] = $this->data['to'];
|
||||||
|
}
|
||||||
|
if (!empty($this->data['cc'])) {
|
||||||
|
$data[self::JSON_PROPERTY_CC] = $this->data['cc'];
|
||||||
|
}
|
||||||
|
if (!empty($this->data['bcc'])) {
|
||||||
|
$data[self::JSON_PROPERTY_BCC] = $this->data['bcc'];
|
||||||
|
}
|
||||||
|
if (isset($this->data['inReplyTo']) && $this->data['inReplyTo'] !== null) {
|
||||||
|
$data[self::JSON_PROPERTY_IN_REPLY_TO] = $this->data['inReplyTo'];
|
||||||
|
}
|
||||||
|
if (!empty($this->data['references'])) {
|
||||||
|
$data[self::JSON_PROPERTY_REFERENCES] = $this->data['references'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($this->data['snippet']) && $this->data['snippet'] !== null) {
|
||||||
|
$data[self::JSON_PROPERTY_SNIPPET] = $this->data['snippet'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($this->data['attachments'])) {
|
||||||
|
$data[self::JSON_PROPERTY_ATTACHMENTS] = $this->data['attachments'];
|
||||||
|
}
|
||||||
|
if (!empty($this->data['flags'])) {
|
||||||
|
$data[self::JSON_PROPERTY_FLAGS] = $this->data['flags'];
|
||||||
|
}
|
||||||
|
|
||||||
|
$data[self::JSON_PROPERTY_SUBJECT] = $this->data['subject'] ?? null;
|
||||||
|
$data[self::JSON_PROPERTY_BODY] = $this->data['body'] ?? null;
|
||||||
|
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,35 +19,26 @@ use KTXF\Resource\Provider\Node\NodePropertiesBaseInterface;
|
|||||||
*/
|
*/
|
||||||
interface MessagePropertiesBaseInterface extends NodePropertiesBaseInterface {
|
interface MessagePropertiesBaseInterface extends NodePropertiesBaseInterface {
|
||||||
|
|
||||||
public const PROPERTY_SIZE = 'size';
|
public const JSON_TYPE = 'mail.message';
|
||||||
public const PROPERTY_HEADERS = 'headers';
|
public const JSON_PROPERTY_HEADERS = 'headers';
|
||||||
public const PROPERTY_URID = 'urid'; // mime message ID or similar unique identifier
|
public const JSON_PROPERTY_URID = 'urid';
|
||||||
public const PROPERTY_IN_REPLY_TO = 'inReplyTo';
|
public const JSON_PROPERTY_DATE = 'date';
|
||||||
public const PROPERTY_REFERENCES = 'references';
|
public const JSON_PROPERTY_RECEIVED = 'received';
|
||||||
public const PROPERTY_RECEIVED = 'received';
|
public const JSON_PROPERTY_SIZE = 'size';
|
||||||
public const PROPERTY_SENT = 'sent';
|
public const JSON_PROPERTY_SENDER = 'sender';
|
||||||
public const PROPERTY_SENDER = 'sender';
|
public const JSON_PROPERTY_FROM = 'from';
|
||||||
public const PROPERTY_REPLY_TO = 'replyTo';
|
public const JSON_PROPERTY_REPLY_TO = 'replyTo';
|
||||||
public const PROPERTY_FROM = 'from';
|
public const JSON_PROPERTY_TO = 'to';
|
||||||
public const PROPERTY_TO = 'to';
|
public const JSON_PROPERTY_CC = 'cc';
|
||||||
public const PROPERTY_CC = 'cc';
|
public const JSON_PROPERTY_BCC = 'bcc';
|
||||||
public const PROPERTY_BCC = 'bcc';
|
public const JSON_PROPERTY_IN_REPLY_TO = 'inReplyTo';
|
||||||
public const PROPERTY_SUBJECT = 'subject';
|
public const JSON_PROPERTY_REFERENCES = 'references';
|
||||||
public const PROPERTY_BODY = 'body';
|
public const JSON_PROPERTY_SUBJECT = 'subject';
|
||||||
public const PROPERTY_BODY_TEXT_PLAIN = 'bodyTextPlain';
|
public const JSON_PROPERTY_SNIPPET = 'snippet';
|
||||||
public const PROPERTY_BODY_TEXT_HTML = 'bodyTextHtml';
|
public const JSON_PROPERTY_BODY = 'body';
|
||||||
public const PROPERTY_ATTACHMENTS = 'attachments';
|
public const JSON_PROPERTY_ATTACHMENTS = 'attachments';
|
||||||
public const PROPERTY_FLAGS = 'flags';
|
public const JSON_PROPERTY_FLAGS = 'flags';
|
||||||
public const PROPERTY_TAGS = 'tags';
|
public const JSON_PROPERTY_TAGS = 'tags';
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the message size in bytes
|
|
||||||
*
|
|
||||||
* @since 2025.05.01
|
|
||||||
*
|
|
||||||
* @return int|null
|
|
||||||
*/
|
|
||||||
public function getSize(): ?int;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets custom headers
|
* Gets custom headers
|
||||||
@@ -79,22 +70,13 @@ interface MessagePropertiesBaseInterface extends NodePropertiesBaseInterface {
|
|||||||
public function getUrid(): ?string;
|
public function getUrid(): ?string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the message ID this is replying to
|
* Gets the message date
|
||||||
*
|
*
|
||||||
* @since 2025.05.01
|
* @since 2025.05.01
|
||||||
*
|
*
|
||||||
* @return string|null
|
* @return DateTimeImmutable|null
|
||||||
*/
|
*/
|
||||||
public function getInReplyTo(): ?string;
|
public function getDate(): ?DateTimeImmutable;
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the references (message IDs in thread)
|
|
||||||
*
|
|
||||||
* @since 2025.05.01
|
|
||||||
*
|
|
||||||
* @return array<int,string>
|
|
||||||
*/
|
|
||||||
public function getReferences(): array;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the received date
|
* Gets the received date
|
||||||
@@ -106,13 +88,13 @@ interface MessagePropertiesBaseInterface extends NodePropertiesBaseInterface {
|
|||||||
public function getReceived(): ?DateTimeImmutable;
|
public function getReceived(): ?DateTimeImmutable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the sent date
|
* Gets the message size in bytes
|
||||||
*
|
*
|
||||||
* @since 2025.05.01
|
* @since 2025.05.01
|
||||||
*
|
*
|
||||||
* @return DateTimeImmutable|null
|
* @return int|null
|
||||||
*/
|
*/
|
||||||
public function getSent(): ?DateTimeImmutable;
|
public function getSize(): ?int;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the sender address (actual sender, may differ from From)
|
* Gets the sender address (actual sender, may differ from From)
|
||||||
@@ -167,6 +149,24 @@ interface MessagePropertiesBaseInterface extends NodePropertiesBaseInterface {
|
|||||||
*/
|
*/
|
||||||
public function getBcc(): array;
|
public function getBcc(): array;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the message ID this is replying to
|
||||||
|
*
|
||||||
|
* @since 2025.05.01
|
||||||
|
*
|
||||||
|
* @return string|null
|
||||||
|
*/
|
||||||
|
public function getInReplyTo(): ?string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the references (message IDs in thread)
|
||||||
|
*
|
||||||
|
* @since 2025.05.01
|
||||||
|
*
|
||||||
|
* @return array<int,string>
|
||||||
|
*/
|
||||||
|
public function getReferences(): array;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the message subject
|
* Gets the message subject
|
||||||
*
|
*
|
||||||
@@ -177,13 +177,13 @@ interface MessagePropertiesBaseInterface extends NodePropertiesBaseInterface {
|
|||||||
public function getSubject(): string;
|
public function getSubject(): string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the message body structure
|
* Gets the message snippet/preview
|
||||||
*
|
*
|
||||||
* @since 2025.05.01
|
* @since 2025.05.01
|
||||||
*
|
*
|
||||||
* @return MessagePartInterface|null The body structure or null if no body
|
* @return string|null
|
||||||
*/
|
*/
|
||||||
public function getBody(): ?MessagePartInterface;
|
public function getSnippet(): ?string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the message has any body content
|
* Checks if the message has any body content
|
||||||
@@ -194,6 +194,15 @@ interface MessagePropertiesBaseInterface extends NodePropertiesBaseInterface {
|
|||||||
*/
|
*/
|
||||||
public function hasBody(): bool;
|
public function hasBody(): bool;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the message body structure
|
||||||
|
*
|
||||||
|
* @since 2025.05.01
|
||||||
|
*
|
||||||
|
* @return MessagePartInterface|null The body structure or null if no body
|
||||||
|
*/
|
||||||
|
public function getBody(): ?MessagePartInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the plain text body content
|
* Gets the plain text body content
|
||||||
*
|
*
|
||||||
@@ -201,7 +210,7 @@ interface MessagePropertiesBaseInterface extends NodePropertiesBaseInterface {
|
|||||||
*
|
*
|
||||||
* @return string|null
|
* @return string|null
|
||||||
*/
|
*/
|
||||||
public function getBodyTextPlain(): ?string;
|
public function getBodyText(): ?string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the HTML body content
|
* Gets the HTML body content
|
||||||
@@ -210,7 +219,7 @@ interface MessagePropertiesBaseInterface extends NodePropertiesBaseInterface {
|
|||||||
*
|
*
|
||||||
* @return string|null
|
* @return string|null
|
||||||
*/
|
*/
|
||||||
public function getBodyTextHtml(): ?string;
|
public function getBodyHtml(): ?string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the attachments
|
* Gets the attachments
|
||||||
|
|||||||
@@ -20,7 +20,420 @@ use DateTimeImmutable;
|
|||||||
*/
|
*/
|
||||||
abstract class MessagePropertiesMutableAbstract extends MessagePropertiesBaseAbstract implements MessagePropertiesMutableInterface {
|
abstract class MessagePropertiesMutableAbstract extends MessagePropertiesBaseAbstract implements MessagePropertiesMutableInterface {
|
||||||
|
|
||||||
protected string $type = 'mail.message';
|
public const JSON_TYPE = MessagePropertiesBaseInterface::JSON_TYPE;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function setHeaders(array $value): static {
|
||||||
|
$this->data['headers'] = $value;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function setHeader(string $name, string|array $value): static {
|
||||||
|
$this->data['headers'][$name] = $value;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function setUrid(?string $value): static {
|
||||||
|
$this->data['urid'] = $value;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function setCreated(DateTimeImmutable $value): static {
|
||||||
|
$this->data['created'] = $value;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function setModified(DateTimeImmutable $value): static {
|
||||||
|
$this->data['modified'] = $value;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function setDate(DateTimeImmutable $value): static {
|
||||||
|
$this->data['date'] = $value;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function setReceived(?DateTimeImmutable $value): static {
|
||||||
|
$this->data['received'] = $value;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function setSize(?int $value): static {
|
||||||
|
$this->data['size'] = $value;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function setSender(?AddressInterface $value): static {
|
||||||
|
$this->data['sender'] = $value;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function setFrom(AddressInterface $value): static {
|
||||||
|
$this->data['from'] = $value;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function setReplyTo(AddressInterface ...$value): static {
|
||||||
|
$this->data['replyTo'] = $value;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function setTo(AddressInterface ...$value): static {
|
||||||
|
$this->data['to'] = $value;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function setCc(AddressInterface ...$value): static {
|
||||||
|
$this->data['cc'] = $value;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function setBcc(AddressInterface ...$value): static {
|
||||||
|
$this->data['bcc'] = $value;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function setInReplyTo(?string $value): static {
|
||||||
|
$this->data['inReplyTo'] = $value;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function setReferences(string ...$value): static {
|
||||||
|
$this->data['references'] = $value;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function setSubject(string $value): static {
|
||||||
|
$this->data['subject'] = $value;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function setSnippet(?string $value): static {
|
||||||
|
$this->data['snippet'] = $value;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function setBodyText(?string $value): static {
|
||||||
|
$this->data['bodyText'] = $value;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the plain text body charset
|
||||||
|
*
|
||||||
|
* @since 2025.05.01
|
||||||
|
*
|
||||||
|
* @param string $value
|
||||||
|
*
|
||||||
|
* @return static
|
||||||
|
*/
|
||||||
|
public function setBodyTextCharset(string $value): static {
|
||||||
|
$this->data['bodyTextCharset'] = $value;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the plain text body size
|
||||||
|
*
|
||||||
|
* @since 2025.05.01
|
||||||
|
*
|
||||||
|
* @param int $value
|
||||||
|
*
|
||||||
|
* @return static
|
||||||
|
*/
|
||||||
|
public function setBodyTextSize(int $value): static {
|
||||||
|
$this->data['bodyTextSize'] = $value;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function setBodyHtml(?string $value): static {
|
||||||
|
$this->data['bodyHtml'] = $value;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the HTML body charset
|
||||||
|
*
|
||||||
|
* @since 2025.05.01
|
||||||
|
*
|
||||||
|
* @param string $value
|
||||||
|
*
|
||||||
|
* @return static
|
||||||
|
*/
|
||||||
|
public function setBodyHtmlCharset(string $value): static {
|
||||||
|
$this->data['bodyHtmlCharset'] = $value;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the HTML body size
|
||||||
|
*
|
||||||
|
* @since 2025.05.01
|
||||||
|
*
|
||||||
|
* @param int $value
|
||||||
|
*
|
||||||
|
* @return static
|
||||||
|
*/
|
||||||
|
public function setBodyHtmlSize(int $value): static {
|
||||||
|
$this->data['bodyHtmlSize'] = $value;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function setAttachments(AttachmentInterface ...$value): static {
|
||||||
|
$this->data['attachments'] = $value;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function addAttachment(AttachmentInterface $value): static {
|
||||||
|
$this->data['attachments'][] = $value;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets message flags
|
||||||
|
*
|
||||||
|
* @since 2025.05.01
|
||||||
|
*
|
||||||
|
* @param array $value
|
||||||
|
*
|
||||||
|
* @return static
|
||||||
|
*/
|
||||||
|
public function setFlags(array $value): static {
|
||||||
|
if (!isset($this->data['flags'])) {
|
||||||
|
$this->data['flags'] = [
|
||||||
|
'read' => false,
|
||||||
|
'starred' => false,
|
||||||
|
'important' => false,
|
||||||
|
'answered' => false,
|
||||||
|
'forwarded' => false,
|
||||||
|
'draft' => false,
|
||||||
|
'deleted' => false,
|
||||||
|
'flagged' => false,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
$this->data['flags'] = array_merge($this->data['flags'], $value);
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function setFlag(string $name, bool $value): static {
|
||||||
|
if (!isset($this->data['flags'])) {
|
||||||
|
$this->data['flags'] = [
|
||||||
|
'read' => false,
|
||||||
|
'starred' => false,
|
||||||
|
'important' => false,
|
||||||
|
'answered' => false,
|
||||||
|
'forwarded' => false,
|
||||||
|
'draft' => false,
|
||||||
|
'deleted' => false,
|
||||||
|
'flagged' => false,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
if (array_key_exists($name, $this->data['flags'])) {
|
||||||
|
$this->data['flags'][$name] = $value;
|
||||||
|
}
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets message labels
|
||||||
|
*
|
||||||
|
* @since 2025.05.01
|
||||||
|
*
|
||||||
|
* @param string ...$value
|
||||||
|
*
|
||||||
|
* @return static
|
||||||
|
*/
|
||||||
|
public function setLabels(string ...$value): static {
|
||||||
|
$this->data['labels'] = $value;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a message label
|
||||||
|
*
|
||||||
|
* @since 2025.05.01
|
||||||
|
*
|
||||||
|
* @param string $value
|
||||||
|
*
|
||||||
|
* @return static
|
||||||
|
*/
|
||||||
|
public function addLabel(string $value): static {
|
||||||
|
$this->data['labels'][] = $value;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets message tags
|
||||||
|
*
|
||||||
|
* @since 2025.05.01
|
||||||
|
*
|
||||||
|
* @param string ...$value
|
||||||
|
*
|
||||||
|
* @return static
|
||||||
|
*/
|
||||||
|
public function setTags(string ...$value): static {
|
||||||
|
$this->data['tags'] = $value;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a message tag
|
||||||
|
*
|
||||||
|
* @since 2025.05.01
|
||||||
|
*
|
||||||
|
* @param string $value
|
||||||
|
*
|
||||||
|
* @return static
|
||||||
|
*/
|
||||||
|
public function addTag(string $value): static {
|
||||||
|
$this->data['tags'][] = $value;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets message priority
|
||||||
|
*
|
||||||
|
* @since 2025.05.01
|
||||||
|
*
|
||||||
|
* @param string $value
|
||||||
|
*
|
||||||
|
* @return static
|
||||||
|
*/
|
||||||
|
public function setPriority(string $value): static {
|
||||||
|
$this->data['priority'] = $value;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets message sensitivity
|
||||||
|
*
|
||||||
|
* @since 2025.05.01
|
||||||
|
*
|
||||||
|
* @param string $value
|
||||||
|
*
|
||||||
|
* @return static
|
||||||
|
*/
|
||||||
|
public function setSensitivity(string $value): static {
|
||||||
|
$this->data['sensitivity'] = $value;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets encryption information
|
||||||
|
*
|
||||||
|
* @since 2025.05.01
|
||||||
|
*
|
||||||
|
* @param array $value
|
||||||
|
*
|
||||||
|
* @return static
|
||||||
|
*/
|
||||||
|
public function setEncryption(array $value): static {
|
||||||
|
if (!isset($this->data['encryption'])) {
|
||||||
|
$this->data['encryption'] = [
|
||||||
|
'method' => null,
|
||||||
|
'signed' => false,
|
||||||
|
'encrypted' => false,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
$this->data['encryption'] = array_merge($this->data['encryption'], $value);
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets delivery receipt flag
|
||||||
|
*
|
||||||
|
* @since 2025.05.01
|
||||||
|
*
|
||||||
|
* @param bool $value
|
||||||
|
*
|
||||||
|
* @return static
|
||||||
|
*/
|
||||||
|
public function setDeliveryReceipt(bool $value): static {
|
||||||
|
$this->data['deliveryReceipt'] = $value;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets read receipt flag
|
||||||
|
*
|
||||||
|
* @since 2025.05.01
|
||||||
|
*
|
||||||
|
* @param bool $value
|
||||||
|
*
|
||||||
|
* @return static
|
||||||
|
*/
|
||||||
|
public function setReadReceipt(bool $value): static {
|
||||||
|
$this->data['readReceipt'] = $value;
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
@@ -39,213 +452,4 @@ abstract class MessagePropertiesMutableAbstract extends MessagePropertiesBaseAbs
|
|||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @inheritDoc
|
|
||||||
*/
|
|
||||||
public function setSize(?int $value): static {
|
|
||||||
$this->data[static::PROPERTY_SIZE] = $value;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @inheritDoc
|
|
||||||
*/
|
|
||||||
public function setHeaders(array $value): static {
|
|
||||||
$this->data[static::PROPERTY_HEADERS] = $value;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @inheritDoc
|
|
||||||
*/
|
|
||||||
public function setHeader(string $name, string|array $value): static {
|
|
||||||
$this->data[static::PROPERTY_HEADERS][$name] = $value;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @inheritDoc
|
|
||||||
*/
|
|
||||||
public function setUrid(?string $value): static {
|
|
||||||
$this->data[static::PROPERTY_URID] = $value;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @inheritDoc
|
|
||||||
*/
|
|
||||||
public function setInReplyTo(?string $value): static {
|
|
||||||
$this->data[static::PROPERTY_IN_REPLY_TO] = $value;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @inheritDoc
|
|
||||||
*/
|
|
||||||
public function setReferences(string ...$value): static {
|
|
||||||
$this->data[static::PROPERTY_REFERENCES] = $value;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @inheritDoc
|
|
||||||
*/
|
|
||||||
public function setReceived(?DateTimeImmutable $value): static {
|
|
||||||
$this->data[static::PROPERTY_RECEIVED] = $value;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @inheritDoc
|
|
||||||
*/
|
|
||||||
public function setSent(DateTimeImmutable $value): static {
|
|
||||||
$this->data[static::PROPERTY_SENT] = $value;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @inheritDoc
|
|
||||||
*/
|
|
||||||
public function setSender(?AddressInterface $value): static {
|
|
||||||
$this->data[static::PROPERTY_SENDER] = $value;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @inheritDoc
|
|
||||||
*/
|
|
||||||
public function setFrom(AddressInterface $value): static {
|
|
||||||
$this->data[static::PROPERTY_FROM] = $value;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @inheritDoc
|
|
||||||
*/
|
|
||||||
public function setReplyTo(AddressInterface ...$value): static {
|
|
||||||
$this->data[static::PROPERTY_REPLY_TO] = $value;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @inheritDoc
|
|
||||||
*/
|
|
||||||
public function setTo(AddressInterface ...$value): static {
|
|
||||||
$this->data[static::PROPERTY_TO] = $value;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @inheritDoc
|
|
||||||
*/
|
|
||||||
public function setCc(AddressInterface ...$value): static {
|
|
||||||
$this->data[static::PROPERTY_CC] = $value;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @inheritDoc
|
|
||||||
*/
|
|
||||||
public function setBcc(AddressInterface ...$value): static {
|
|
||||||
$this->data[static::PROPERTY_BCC] = $value;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @inheritDoc
|
|
||||||
*/
|
|
||||||
public function setSubject(string $value): static {
|
|
||||||
$this->data[static::PROPERTY_SUBJECT] = $value;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @inheritDoc
|
|
||||||
*/
|
|
||||||
public function setBody(?MessagePartInterface $value): static {
|
|
||||||
$this->data[static::PROPERTY_BODY] = $value;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @inheritDoc
|
|
||||||
*/
|
|
||||||
public function setBodyTextPlain(?string $value): static {
|
|
||||||
$this->data[static::PROPERTY_BODY_TEXT_PLAIN] = $value;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @inheritDoc
|
|
||||||
*/
|
|
||||||
public function setBodyTextHtml(?string $value): static {
|
|
||||||
$this->data[static::PROPERTY_BODY_TEXT_HTML] = $value;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @inheritDoc
|
|
||||||
*/
|
|
||||||
public function setAttachments(AttachmentInterface ...$value): static {
|
|
||||||
$this->data[static::PROPERTY_ATTACHMENTS] = $value;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @inheritDoc
|
|
||||||
*/
|
|
||||||
public function addAttachment(AttachmentInterface $value): static {
|
|
||||||
$this->data[static::PROPERTY_ATTACHMENTS][] = $value;
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets message flags
|
|
||||||
*
|
|
||||||
* @since 2025.05.01
|
|
||||||
*
|
|
||||||
* @param array $value
|
|
||||||
*
|
|
||||||
* @return static
|
|
||||||
*/
|
|
||||||
public function setFlags(array $value): static {
|
|
||||||
if (!isset($this->data[static::PROPERTY_FLAGS])) {
|
|
||||||
$this->data[static::PROPERTY_FLAGS] = [
|
|
||||||
'read' => false,
|
|
||||||
'starred' => false,
|
|
||||||
'important' => false,
|
|
||||||
'answered' => false,
|
|
||||||
'forwarded' => false,
|
|
||||||
'draft' => false,
|
|
||||||
'deleted' => false,
|
|
||||||
'flagged' => false,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
$this->data[static::PROPERTY_FLAGS] = array_merge($this->data[static::PROPERTY_FLAGS], $value);
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @inheritDoc
|
|
||||||
*/
|
|
||||||
public function setFlag(string $name, bool $value): static {
|
|
||||||
if (!isset($this->data[static::PROPERTY_FLAGS])) {
|
|
||||||
$this->data[static::PROPERTY_FLAGS] = [
|
|
||||||
'read' => false,
|
|
||||||
'starred' => false,
|
|
||||||
'important' => false,
|
|
||||||
'answered' => false,
|
|
||||||
'forwarded' => false,
|
|
||||||
'draft' => false,
|
|
||||||
'deleted' => false,
|
|
||||||
'flagged' => false,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
if (array_key_exists($name, $this->data[static::PROPERTY_FLAGS])) {
|
|
||||||
$this->data[static::PROPERTY_FLAGS][$name] = $value;
|
|
||||||
}
|
|
||||||
return $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,16 +19,7 @@ use KTXF\Resource\Provider\Node\NodePropertiesMutableInterface;
|
|||||||
*/
|
*/
|
||||||
interface MessagePropertiesMutableInterface extends MessagePropertiesBaseInterface, NodePropertiesMutableInterface {
|
interface MessagePropertiesMutableInterface extends MessagePropertiesBaseInterface, NodePropertiesMutableInterface {
|
||||||
|
|
||||||
/**
|
public const JSON_TYPE = MessagePropertiesBaseInterface::JSON_TYPE;
|
||||||
* Sets the message size in bytes
|
|
||||||
*
|
|
||||||
* @since 2025.05.01
|
|
||||||
*
|
|
||||||
* @param int|null $value
|
|
||||||
*
|
|
||||||
* @return self
|
|
||||||
*/
|
|
||||||
public function setSize(?int $value): static;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets custom headers
|
* Sets custom headers
|
||||||
@@ -65,26 +56,15 @@ interface MessagePropertiesMutableInterface extends MessagePropertiesBaseInterfa
|
|||||||
public function setUrid(?string $value): static;
|
public function setUrid(?string $value): static;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the message ID this is replying to
|
* Sets the message date
|
||||||
*
|
*
|
||||||
* @since 2025.05.01
|
* @since 2025.05.01
|
||||||
*
|
*
|
||||||
* @param string|null $value
|
* @param DateTimeImmutable $value
|
||||||
*
|
*
|
||||||
* @return self
|
* @return self
|
||||||
*/
|
*/
|
||||||
public function setInReplyTo(?string $value): static;
|
public function setDate(DateTimeImmutable $value): static;
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets the references (message IDs in thread)
|
|
||||||
*
|
|
||||||
* @since 2025.05.01
|
|
||||||
*
|
|
||||||
* @param string ...$value
|
|
||||||
*
|
|
||||||
* @return self
|
|
||||||
*/
|
|
||||||
public function setReferences(string ...$value): static;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the received date
|
* Sets the received date
|
||||||
@@ -98,15 +78,15 @@ interface MessagePropertiesMutableInterface extends MessagePropertiesBaseInterfa
|
|||||||
public function setReceived(?DateTimeImmutable $value): static;
|
public function setReceived(?DateTimeImmutable $value): static;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the message date
|
* Sets the message size in bytes
|
||||||
*
|
*
|
||||||
* @since 2025.05.01
|
* @since 2025.05.01
|
||||||
*
|
*
|
||||||
* @param DateTimeImmutable $value
|
* @param int|null $value
|
||||||
*
|
*
|
||||||
* @return self
|
* @return self
|
||||||
*/
|
*/
|
||||||
public function setSent(DateTimeImmutable $value): static;
|
public function setSize(?int $value): static;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the sender address (actual sender, may differ from From)
|
* Sets the sender address (actual sender, may differ from From)
|
||||||
@@ -174,6 +154,28 @@ interface MessagePropertiesMutableInterface extends MessagePropertiesBaseInterfa
|
|||||||
*/
|
*/
|
||||||
public function setBcc(AddressInterface ...$value): static;
|
public function setBcc(AddressInterface ...$value): static;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the message ID this is replying to
|
||||||
|
*
|
||||||
|
* @since 2025.05.01
|
||||||
|
*
|
||||||
|
* @param string|null $value
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
*/
|
||||||
|
public function setInReplyTo(?string $value): static;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the references (message IDs in thread)
|
||||||
|
*
|
||||||
|
* @since 2025.05.01
|
||||||
|
*
|
||||||
|
* @param string ...$value
|
||||||
|
*
|
||||||
|
* @return self
|
||||||
|
*/
|
||||||
|
public function setReferences(string ...$value): static;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the message subject
|
* Sets the message subject
|
||||||
*
|
*
|
||||||
@@ -186,15 +188,15 @@ interface MessagePropertiesMutableInterface extends MessagePropertiesBaseInterfa
|
|||||||
public function setSubject(string $value): static;
|
public function setSubject(string $value): static;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the message body
|
* Sets the message snippet/preview
|
||||||
*
|
*
|
||||||
* @since 2025.05.01
|
* @since 2025.05.01
|
||||||
*
|
*
|
||||||
* @param MessagePartInterface|null $value
|
* @param string|null $value
|
||||||
*
|
*
|
||||||
* @return self
|
* @return self
|
||||||
*/
|
*/
|
||||||
public function setBody(?MessagePartInterface $value): static;
|
public function setSnippet(?string $value): static;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the plain text body content
|
* Sets the plain text body content
|
||||||
@@ -205,7 +207,7 @@ interface MessagePropertiesMutableInterface extends MessagePropertiesBaseInterfa
|
|||||||
*
|
*
|
||||||
* @return self
|
* @return self
|
||||||
*/
|
*/
|
||||||
public function setBodyTextPlain(?string $value): static;
|
public function setBodyText(?string $value): static;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the HTML body content
|
* Sets the HTML body content
|
||||||
@@ -216,7 +218,7 @@ interface MessagePropertiesMutableInterface extends MessagePropertiesBaseInterfa
|
|||||||
*
|
*
|
||||||
* @return self
|
* @return self
|
||||||
*/
|
*/
|
||||||
public function setBodyTextHtml(?string $value): static;
|
public function setBodyHtml(?string $value): static;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the attachments
|
* Sets the attachments
|
||||||
@@ -239,25 +241,12 @@ interface MessagePropertiesMutableInterface extends MessagePropertiesBaseInterfa
|
|||||||
* @return self
|
* @return self
|
||||||
*/
|
*/
|
||||||
public function addAttachment(AttachmentInterface $value): static;
|
public function addAttachment(AttachmentInterface $value): static;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets message flags
|
* Sets message tags
|
||||||
*
|
*
|
||||||
* @since 2025.05.01
|
* @since 2025.05.01
|
||||||
*
|
*
|
||||||
* @param array $value
|
* @param array{read: bool, starred: bool, important: bool, answered: bool, forwarded: bool, draft: bool, deleted: bool, flagged: bool} $value
|
||||||
*
|
|
||||||
* @return self
|
|
||||||
*/
|
|
||||||
public function setFlags(array $value): static;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets message flags
|
|
||||||
*
|
|
||||||
* @since 2025.05.01
|
|
||||||
*
|
|
||||||
* @param string $label
|
|
||||||
* @param bool $value
|
|
||||||
*
|
*
|
||||||
* @return self
|
* @return self
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -26,9 +26,7 @@ use KTXF\Resource\Provider\ResourceServiceLocationInterface;
|
|||||||
*
|
*
|
||||||
* @since 2025.05.01
|
* @since 2025.05.01
|
||||||
*/
|
*/
|
||||||
interface ProviderServiceDiscoverInterface {
|
interface ProviderServiceDiscoverInterface extends ProviderBaseInterface {
|
||||||
|
|
||||||
public const CAPABILITY_SERVICE_DISCOVER = 'ServiceDiscover';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Attempts to discover service configuration using provider-specific methods.
|
* Attempts to discover service configuration using provider-specific methods.
|
||||||
|
|||||||
@@ -25,7 +25,9 @@ use KTXF\Resource\Provider\ResourceProviderServiceMutateInterface;
|
|||||||
* @method string serviceModify(string $tenantId, ?string $userId, ServiceMutableInterface $service) Modify a mail service configuration
|
* @method string serviceModify(string $tenantId, ?string $userId, ServiceMutableInterface $service) Modify a mail service configuration
|
||||||
* @method bool serviceDestroy(string $tenantId, ?string $userId, ServiceMutableInterface $service) Delete a mail service configuration
|
* @method bool serviceDestroy(string $tenantId, ?string $userId, ServiceMutableInterface $service) Delete a mail service configuration
|
||||||
*/
|
*/
|
||||||
interface ProviderServiceMutateInterface extends ResourceProviderServiceMutateInterface {
|
interface ProviderServiceMutateInterface extends ProviderBaseInterface, ResourceProviderServiceMutateInterface {
|
||||||
|
|
||||||
|
public const JSON_TYPE = ProviderBaseInterface::JSON_TYPE;
|
||||||
|
|
||||||
// Methods inherited from ResourceProviderServiceMutateInterface
|
// Methods inherited from ResourceProviderServiceMutateInterface
|
||||||
// Implementations should return/accept ServiceMutableInterface instances
|
// Implementations should return/accept ServiceMutableInterface instances
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ declare(strict_types=1);
|
|||||||
namespace KTXF\Mail\Provider;
|
namespace KTXF\Mail\Provider;
|
||||||
|
|
||||||
use KTXF\Mail\Service\ServiceBaseInterface;
|
use KTXF\Mail\Service\ServiceBaseInterface;
|
||||||
use KTXF\Mail\Service\ServiceMutableInterface;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mail Provider Service Test Interface
|
* Mail Provider Service Test Interface
|
||||||
@@ -26,9 +25,7 @@ use KTXF\Mail\Service\ServiceMutableInterface;
|
|||||||
*
|
*
|
||||||
* @since 2025.05.01
|
* @since 2025.05.01
|
||||||
*/
|
*/
|
||||||
interface ProviderServiceTestInterface {
|
interface ProviderServiceTestInterface extends ProviderBaseInterface {
|
||||||
|
|
||||||
public const CAPABILITY_SERVICE_TEST = 'ServiceTest';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test a service connection
|
* Test a service connection
|
||||||
@@ -42,7 +39,7 @@ interface ProviderServiceTestInterface {
|
|||||||
*
|
*
|
||||||
* @since 2025.05.01
|
* @since 2025.05.01
|
||||||
*
|
*
|
||||||
* @param ServiceBaseInterface|ServiceMutableInterface $service Service to test (can be fresh/unsaved or existing)
|
* @param ServiceBaseInterface $service Service to test (can be fresh/unsaved or existing)
|
||||||
* @param array $options Provider-specific test options:
|
* @param array $options Provider-specific test options:
|
||||||
* - 'timeout' => int (seconds, default: 10)
|
* - 'timeout' => int (seconds, default: 10)
|
||||||
* - 'verify_ssl' => bool (default: true)
|
* - 'verify_ssl' => bool (default: true)
|
||||||
@@ -75,6 +72,6 @@ interface ProviderServiceTestInterface {
|
|||||||
* ]
|
* ]
|
||||||
* ]
|
* ]
|
||||||
*/
|
*/
|
||||||
public function serviceTest(ServiceBaseInterface|ServiceMutableInterface $service, array $options = []): array;
|
public function serviceTest(ServiceBaseInterface $service, array $options = []): array;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,10 +12,8 @@ namespace KTXF\Mail\Service;
|
|||||||
use Generator;
|
use Generator;
|
||||||
use KTXF\Mail\Collection\CollectionBaseInterface;
|
use KTXF\Mail\Collection\CollectionBaseInterface;
|
||||||
use KTXF\Mail\Object\AddressInterface;
|
use KTXF\Mail\Object\AddressInterface;
|
||||||
use KTXF\Resource\BinaryResource;
|
|
||||||
use KTXF\Resource\Delta\Delta;
|
use KTXF\Resource\Delta\Delta;
|
||||||
use KTXF\Resource\Filter\IFilter;
|
use KTXF\Resource\Filter\IFilter;
|
||||||
use KTXF\Resource\Identifier\EntityIdentifierInterface;
|
|
||||||
use KTXF\Resource\Provider\ResourceServiceBaseInterface;
|
use KTXF\Resource\Provider\ResourceServiceBaseInterface;
|
||||||
use KTXF\Resource\Range\IRange;
|
use KTXF\Resource\Range\IRange;
|
||||||
use KTXF\Resource\Range\RangeType;
|
use KTXF\Resource\Range\RangeType;
|
||||||
@@ -168,9 +166,9 @@ interface ServiceBaseInterface extends ResourceServiceBaseInterface {
|
|||||||
* @param IRange|null $range Optional pagination
|
* @param IRange|null $range Optional pagination
|
||||||
* @param array|null $properties Optional message properties to fetch
|
* @param array|null $properties Optional message properties to fetch
|
||||||
*
|
*
|
||||||
* @return array<string,EntityBaseInterface> Messages indexed by Urn
|
* @return array<string|int,EntityBaseInterface> Messages indexed by ID
|
||||||
*/
|
*/
|
||||||
public function entityListBulk(string|int $collection, ?IFilter $filter = null, ?ISort $sort = null, ?IRange $range = null, ?array $properties = null): array;
|
public function entityList(string|int $collection, ?IFilter $filter = null, ?ISort $sort = null, ?IRange $range = null, ?array $properties = null): array;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Lists messages in a collection
|
* Lists messages in a collection
|
||||||
@@ -246,33 +244,11 @@ interface ServiceBaseInterface extends ResourceServiceBaseInterface {
|
|||||||
*
|
*
|
||||||
* @since 2025.05.01
|
* @since 2025.05.01
|
||||||
*
|
*
|
||||||
* @param EntityIdentifierInterface ...$identifiers Message identifiers to fetch
|
* @param string|int $collection Collection ID
|
||||||
|
* @param string|int ...$identifiers Message IDs to fetch
|
||||||
*
|
*
|
||||||
* @return array<string,EntityBaseInterface> Messages indexed by Urn
|
* @return array<string|int,EntityBaseInterface> Messages indexed by ID
|
||||||
*/
|
*/
|
||||||
public function entityFetchBulk(EntityIdentifierInterface ...$identifiers): array;
|
public function entityFetch(string|int $collection, string|int ...$identifiers): array;
|
||||||
|
|
||||||
/**
|
|
||||||
* Fetches one or more entities
|
|
||||||
*
|
|
||||||
* @since 2025.05.01
|
|
||||||
*
|
|
||||||
* @param EntityIdentifierInterface ...$identifiers Message identifiers to fetch
|
|
||||||
*
|
|
||||||
* @return Generator<string,EntityBaseInterface> Yields messages one by one
|
|
||||||
*/
|
|
||||||
public function entityFetchStream(EntityIdentifierInterface ...$identifiers): Generator;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Downloads a message or part of a message
|
|
||||||
*
|
|
||||||
* @since 2025.05.01
|
|
||||||
*
|
|
||||||
* @param EntityIdentifierInterface $target Message identifier
|
|
||||||
* @param array|null $part Optional part to download
|
|
||||||
*
|
|
||||||
* @return BinaryResource
|
|
||||||
*/
|
|
||||||
public function entityDownload(EntityIdentifierInterface $target, array|null $part): BinaryResource;
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,8 +11,6 @@ namespace KTXF\Mail\Service;
|
|||||||
|
|
||||||
use KTXF\Mail\Collection\CollectionBaseInterface;
|
use KTXF\Mail\Collection\CollectionBaseInterface;
|
||||||
use KTXF\Mail\Collection\CollectionMutableInterface;
|
use KTXF\Mail\Collection\CollectionMutableInterface;
|
||||||
use KTXF\Mail\Collection\CollectionPropertiesBaseInterface;
|
|
||||||
use KTXF\Resource\Identifier\CollectionIdentifier;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mail Service Collection Mutable Interface
|
* Mail Service Collection Mutable Interface
|
||||||
@@ -22,7 +20,7 @@ use KTXF\Resource\Identifier\CollectionIdentifier;
|
|||||||
*
|
*
|
||||||
* @since 2025.05.01
|
* @since 2025.05.01
|
||||||
*/
|
*/
|
||||||
interface ServiceCollectionMutableInterface {
|
interface ServiceCollectionMutableInterface extends ServiceBaseInterface {
|
||||||
|
|
||||||
public const CAPABILITY_COLLECTION_CREATE = 'CollectionCreate';
|
public const CAPABILITY_COLLECTION_CREATE = 'CollectionCreate';
|
||||||
public const CAPABILITY_COLLECTION_UPDATE = 'CollectionUpdate';
|
public const CAPABILITY_COLLECTION_UPDATE = 'CollectionUpdate';
|
||||||
@@ -43,48 +41,48 @@ interface ServiceCollectionMutableInterface {
|
|||||||
*
|
*
|
||||||
* @since 2025.05.01
|
* @since 2025.05.01
|
||||||
*
|
*
|
||||||
* @param CollectionIdentifier $target Target collection identifier (parent)
|
* @param string|int|null $location Parent collection ID (null for root)
|
||||||
* @param CollectionPropertiesBaseInterface $properties Collection properties
|
* @param CollectionMutableInterface $collection Collection to create
|
||||||
* @param array $options Protocol-specific options
|
* @param array $options Protocol-specific options
|
||||||
*
|
*
|
||||||
* @return CollectionBaseInterface Created collection with assigned ID
|
* @return CollectionBaseInterface Created collection with assigned ID
|
||||||
*/
|
*/
|
||||||
public function collectionCreate(CollectionIdentifier|null $target, CollectionPropertiesBaseInterface $properties, array $options = []): CollectionBaseInterface;
|
public function collectionCreate(string|int|null $location, CollectionMutableInterface $collection, array $options = []): CollectionBaseInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates an existing collection
|
* Updates an existing collection
|
||||||
*
|
*
|
||||||
* @since 2025.05.01
|
* @since 2025.05.01
|
||||||
*
|
*
|
||||||
* @param CollectionIdentifier $target Target collection identifier
|
* @param string|int $identifier Collection ID
|
||||||
* @param CollectionPropertiesBaseInterface $properties Updated collection data
|
* @param CollectionMutableInterface $collection Updated collection data
|
||||||
*
|
*
|
||||||
* @return CollectionBaseInterface Updated collection
|
* @return CollectionBaseInterface Updated collection
|
||||||
*/
|
*/
|
||||||
public function collectionUpdate(CollectionIdentifier $target, CollectionPropertiesBaseInterface $properties): CollectionBaseInterface;
|
public function collectionUpdate(string|int $identifier, CollectionMutableInterface $collection): CollectionBaseInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes a collection
|
* Deletes a collection
|
||||||
*
|
*
|
||||||
* @since 2025.05.01
|
* @since 2025.05.01
|
||||||
*
|
*
|
||||||
* @param CollectionIdentifier $target Target collection identifier
|
* @param string|int $identifier Collection ID
|
||||||
* @param bool $force Force deletion even if not empty
|
* @param bool $force Force deletion even if not empty
|
||||||
*
|
*
|
||||||
* @return CollectionBaseInterface|true Collection object on soft delete, true on hard delete
|
* @return CollectionBaseInterface|true Collection object on soft delete, true on hard delete
|
||||||
*/
|
*/
|
||||||
public function collectionDelete(CollectionIdentifier $target, bool $force = false): CollectionBaseInterface | true;
|
public function collectionDelete(string|int $identifier, bool $force = false): CollectionBaseInterface | true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Moves a collection to a new parent
|
* Moves a collection to a new parent
|
||||||
*
|
*
|
||||||
* @since 2025.05.01
|
* @since 2025.05.01
|
||||||
*
|
*
|
||||||
* @param CollectionIdentifier $source Source collection identifier
|
* @param string|int $identifier Collection ID
|
||||||
* @param CollectionIdentifier $target Target collection identifier
|
* @param string|int|null $targetLocation New parent ID (null for root)
|
||||||
*
|
*
|
||||||
* @return CollectionBaseInterface Moved collection
|
* @return CollectionBaseInterface Moved collection
|
||||||
*/
|
*/
|
||||||
public function collectionMove(CollectionIdentifier $target, CollectionIdentifier $source): CollectionBaseInterface;
|
public function collectionMove(string|int $identifier, string|int|null $targetLocation): CollectionBaseInterface;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,12 +12,15 @@ namespace KTXF\Mail\Service;
|
|||||||
use KTXF\Resource\Provider\ResourceServiceConfigureInterface;
|
use KTXF\Resource\Provider\ResourceServiceConfigureInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mail Service Configurable Interface
|
* Mail Service Mutable Interface
|
||||||
*
|
*
|
||||||
* Extends base service interface with setter methods for mutable properties.
|
* Extends base service interface with setter methods for mutable properties.
|
||||||
* Used for service configuration and updates.
|
* Used for service configuration and updates.
|
||||||
*
|
*
|
||||||
* @since 2025.05.01
|
* @since 2025.05.01
|
||||||
*/
|
*/
|
||||||
interface ServiceConfigurableInterface extends ResourceServiceConfigureInterface {
|
interface ServiceConfigurableInterface extends ServiceMutableInterface, ResourceServiceConfigureInterface {
|
||||||
|
|
||||||
|
public const JSON_TYPE = ServiceBaseInterface::JSON_TYPE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,9 +11,6 @@ namespace KTXF\Mail\Service;
|
|||||||
|
|
||||||
use KTXF\Mail\Entity\EntityBaseInterface;
|
use KTXF\Mail\Entity\EntityBaseInterface;
|
||||||
use KTXF\Mail\Entity\EntityMutableInterface;
|
use KTXF\Mail\Entity\EntityMutableInterface;
|
||||||
use KTXF\Mail\Object\MessagePropertiesMutableInterface;
|
|
||||||
use KTXF\Resource\Identifier\CollectionIdentifier;
|
|
||||||
use KTXF\Resource\Identifier\EntityIdentifier;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mail Service Entity Mutable Interface
|
* Mail Service Entity Mutable Interface
|
||||||
@@ -23,12 +20,11 @@ use KTXF\Resource\Identifier\EntityIdentifier;
|
|||||||
*
|
*
|
||||||
* @since 2025.05.01
|
* @since 2025.05.01
|
||||||
*/
|
*/
|
||||||
interface ServiceEntityMutableInterface {
|
interface ServiceEntityMutableInterface extends ServiceBaseInterface {
|
||||||
|
|
||||||
public const CAPABILITY_ENTITY_CREATE = 'EntityCreate';
|
public const CAPABILITY_ENTITY_CREATE = 'EntityCreate';
|
||||||
public const CAPABILITY_ENTITY_MODIFY = 'EntityModify';
|
public const CAPABILITY_ENTITY_MODIFY = 'EntityModify';
|
||||||
public const CAPABILITY_ENTITY_DELETE = 'EntityDelete';
|
public const CAPABILITY_ENTITY_DELETE = 'EntityDelete';
|
||||||
public const CAPABILITY_ENTITY_PATCH = 'EntityPatch';
|
|
||||||
public const CAPABILITY_ENTITY_COPY = 'EntityCopy';
|
public const CAPABILITY_ENTITY_COPY = 'EntityCopy';
|
||||||
public const CAPABILITY_ENTITY_MOVE = 'EntityMove';
|
public const CAPABILITY_ENTITY_MOVE = 'EntityMove';
|
||||||
|
|
||||||
@@ -46,70 +42,37 @@ interface ServiceEntityMutableInterface {
|
|||||||
*
|
*
|
||||||
* @since 2025.05.01
|
* @since 2025.05.01
|
||||||
*
|
*
|
||||||
* @param CollectionIdentifier $target Target collection identifier
|
* @param string|int $collection collection identifier
|
||||||
* @param MessagePropertiesMutableInterface $properties Entity properties
|
* @param EntityMutableInterface $entity Entity data
|
||||||
* @param array $options Additional options
|
* @param array $options additional options
|
||||||
*
|
*
|
||||||
* @return EntityBaseInterface Created entity
|
* @return EntityBaseInterface Created entity
|
||||||
*/
|
*/
|
||||||
public function entityCreate(CollectionIdentifier $target, MessagePropertiesMutableInterface $properties, array $options = []): EntityBaseInterface;
|
public function entityCreate(string|int $collection, EntityMutableInterface $entity, array $options = []): EntityBaseInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Modifies an existing entity
|
* Modifies an existing entity
|
||||||
*
|
*
|
||||||
* @since 2025.05.01
|
* @since 2025.05.01
|
||||||
*
|
*
|
||||||
* @param EntityIdentifier $target Target entity identifier
|
* @param string|int $collection Collection identifier
|
||||||
* @param MessagePropertiesMutableInterface $properties Entity properties to update
|
* @param string|int $identifier Entity identifier
|
||||||
|
* @param EntityMutableInterface $entity Entity data
|
||||||
*
|
*
|
||||||
* @return EntityBaseInterface Modified entity
|
* @return EntityBaseInterface Modified entity
|
||||||
*/
|
*/
|
||||||
public function entityModify(EntityIdentifier $target, MessagePropertiesMutableInterface $properties): EntityBaseInterface;
|
public function entityModify(string|int $collection, string|int $identifier, EntityMutableInterface $entity): EntityBaseInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes entities
|
* Deletes entities
|
||||||
*
|
*
|
||||||
* @since 2026.04.01
|
* @since 2026.04.01
|
||||||
*
|
*
|
||||||
* @param EntityIdentifier ...$targets Source entities to delete
|
* @param EntityIdentifier ...$identifiers Source entities to delete
|
||||||
*
|
*
|
||||||
* @return array<string, array{
|
* @return array<string|int,bool|string> Results keyed by entity identifier (true on success, error string on failure)
|
||||||
* disposition: 'moved'|'deleted'|'error',
|
|
||||||
* destination: ?CollectionIdentifier,
|
|
||||||
* mutation: EntityIdentifier
|
|
||||||
* }> Results keyed by source entity identifier
|
|
||||||
*/
|
*/
|
||||||
public function entityDelete(EntityIdentifier ...$targets): array;
|
public function entityDelete(EntityIdentifier ...$identifiers): array;
|
||||||
|
|
||||||
/**
|
|
||||||
* Patches an existing entity(ies) with partial data
|
|
||||||
*
|
|
||||||
* @since 2025.05.01
|
|
||||||
*
|
|
||||||
* @param MessagePropertiesMutableInterface $properties Partial entity properties
|
|
||||||
* @param EntityIdentifier ...$targets Source entities to patch
|
|
||||||
*
|
|
||||||
* @return array<string, array{
|
|
||||||
* disposition: 'patched'|'error'
|
|
||||||
* }> Results keyed by source entity identifier
|
|
||||||
*/
|
|
||||||
public function entityPatch(MessagePropertiesMutableInterface $properties, EntityIdentifier ...$targets): array;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Moves entities to another collection
|
|
||||||
*
|
|
||||||
* @since 2025.05.01
|
|
||||||
*
|
|
||||||
* @param CollectionIdentifier $target Target collection identifier
|
|
||||||
* @param EntityIdentifier ...$sources Source entities to move
|
|
||||||
*
|
|
||||||
* @return array<string, array{
|
|
||||||
* disposition: 'moved'|'error',
|
|
||||||
* destination: ?CollectionIdentifier,
|
|
||||||
* mutation: EntityIdentifier
|
|
||||||
* }> Results keyed by source entity identifier
|
|
||||||
*/
|
|
||||||
public function entityMove(CollectionIdentifier $target, EntityIdentifier ...$sources): array;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copies entities to another collection
|
* Copies entities to another collection
|
||||||
@@ -117,14 +80,22 @@ interface ServiceEntityMutableInterface {
|
|||||||
* @since 2025.05.01
|
* @since 2025.05.01
|
||||||
*
|
*
|
||||||
* @param CollectionIdentifier $target Target collection identifier
|
* @param CollectionIdentifier $target Target collection identifier
|
||||||
* @param EntityIdentifier ...$sources Source entities to copy
|
* @param EntityIdentifier ...$identifiers Source entities to copy
|
||||||
*
|
*
|
||||||
* @return array<string, array{
|
* @return array<string|int,bool> List of copied entity identifiers
|
||||||
* disposition: 'copied'|'error',
|
|
||||||
* destination: ?CollectionIdentifier,
|
|
||||||
* mutation: EntityIdentifier
|
|
||||||
* }> Results keyed by source entity identifier
|
|
||||||
*/
|
*/
|
||||||
public function entityCopy(CollectionIdentifier $target, EntityIdentifier ...$sources): array;
|
public function entityCopy(CollectionIdentifier $target, EntityIdentifier ...$identifiers): array;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Moves entities to another collection
|
||||||
|
*
|
||||||
|
* @since 2025.05.01
|
||||||
|
*
|
||||||
|
* @param CollectionIdentifier $target Target collection identifier
|
||||||
|
* @param EntityIdentifier ...$identifiers Source entities to move
|
||||||
|
*
|
||||||
|
* @return array<string|int,bool> List of moved entity identifiers
|
||||||
|
*/
|
||||||
|
public function entityMove(CollectionIdentifier $target, EntityIdentifier ...$identifiers): array;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ use KTXF\Mail\Exception\SendException;
|
|||||||
*
|
*
|
||||||
* @since 2025.05.01
|
* @since 2025.05.01
|
||||||
*/
|
*/
|
||||||
interface ServiceEntityTransmitInterface {
|
interface ServiceEntityTransmitInterface extends ServiceBaseInterface {
|
||||||
|
|
||||||
public const CAPABILITY_ENTITY_TRANSMIT = 'EntityTransmit';
|
public const CAPABILITY_ENTITY_TRANSMIT = 'EntityTransmit';
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ use KTXF\Resource\Provider\ResourceServiceMutateInterface;
|
|||||||
*
|
*
|
||||||
* @since 2025.05.01
|
* @since 2025.05.01
|
||||||
*/
|
*/
|
||||||
interface ServiceMutableInterface extends ResourceServiceMutateInterface {
|
interface ServiceMutableInterface extends ServiceBaseInterface, ResourceServiceMutateInterface {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the primary mailing address for this service
|
* Sets the primary mailing address for this service
|
||||||
|
|||||||
@@ -1,37 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
declare(strict_types=1);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
|
||||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
||||||
*/
|
|
||||||
|
|
||||||
namespace KTXF\Resource;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Carries file-like binary content metadata and a byte stream.
|
|
||||||
*/
|
|
||||||
final class BinaryResource
|
|
||||||
{
|
|
||||||
public function __construct(
|
|
||||||
private readonly string $filename,
|
|
||||||
private readonly string $mimeType,
|
|
||||||
private readonly \Generator $stream,
|
|
||||||
) {}
|
|
||||||
|
|
||||||
public function filename(): string
|
|
||||||
{
|
|
||||||
return $this->filename;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function mimeType(): string
|
|
||||||
{
|
|
||||||
return $this->mimeType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function stream(): \Generator
|
|
||||||
{
|
|
||||||
return $this->stream;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -35,10 +35,6 @@ class ResourceIdentifier implements ResourceIdentifierInterface {
|
|||||||
return $this->provider;
|
return $this->provider;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function jsonSerialize(): string {
|
|
||||||
return (string) $this;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parse a colon-separated identifier string and return the appropriate level class
|
* Parse a colon-separated identifier string and return the appropriate level class
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -9,12 +9,10 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace KTXF\Resource\Identifier;
|
namespace KTXF\Resource\Identifier;
|
||||||
|
|
||||||
use KTXF\Json\JsonSerializable;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Top-level identifier for resources (provider level)
|
* Top-level identifier for resources (provider level)
|
||||||
*/
|
*/
|
||||||
interface ResourceIdentifierInterface extends JsonSerializable, \Stringable {
|
interface ResourceIdentifierInterface extends \Stringable {
|
||||||
|
|
||||||
/** The provider segment (e.g. "imap") */
|
/** The provider segment (e.g. "imap") */
|
||||||
public function provider(): string;
|
public function provider(): string;
|
||||||
@@ -25,7 +23,4 @@ interface ResourceIdentifierInterface extends JsonSerializable, \Stringable {
|
|||||||
/** Canonical string form: provider[:service[:collection[:entity]]] */
|
/** Canonical string form: provider[:service[:collection[:entity]]] */
|
||||||
public function __toString(): string;
|
public function __toString(): string;
|
||||||
|
|
||||||
/** Canonical JSON form: provider[:service[:collection[:entity]]] */
|
|
||||||
public function jsonSerialize(): string;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -151,11 +151,4 @@ class ResourceIdentifiers implements ResourceIdentifiersInterface {
|
|||||||
return count($this->identifiers) === 0;
|
return count($this->identifiers) === 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function jsonSerialize(): array {
|
|
||||||
return array_map(
|
|
||||||
static fn (ResourceIdentifierInterface $identifier): string => $identifier->jsonSerialize(),
|
|
||||||
$this->identifiers,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,12 +9,10 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace KTXF\Resource\Identifier;
|
namespace KTXF\Resource\Identifier;
|
||||||
|
|
||||||
use KTXF\Json\JsonSerializable;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A typed collection of resource identifiers with search and filter capabilities
|
* A typed collection of resource identifiers with search and filter capabilities
|
||||||
*/
|
*/
|
||||||
interface ResourceIdentifiersInterface extends JsonSerializable, \Countable, \IteratorAggregate {
|
interface ResourceIdentifiersInterface extends \Countable, \IteratorAggregate {
|
||||||
|
|
||||||
/** Add an identifier to the collection */
|
/** Add an identifier to the collection */
|
||||||
public function add(ResourceIdentifierInterface $identifier): void;
|
public function add(ResourceIdentifierInterface $identifier): void;
|
||||||
@@ -49,7 +47,4 @@ interface ResourceIdentifiersInterface extends JsonSerializable, \Countable, \It
|
|||||||
/** Get unique entity names */
|
/** Get unique entity names */
|
||||||
public function entities(): array;
|
public function entities(): array;
|
||||||
|
|
||||||
/** Serialize as an array of canonical identifier strings */
|
|
||||||
public function jsonSerialize(): array;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,11 +10,6 @@ declare(strict_types=1);
|
|||||||
namespace KTXF\Resource\Provider\Node;
|
namespace KTXF\Resource\Provider\Node;
|
||||||
|
|
||||||
use DateTimeImmutable;
|
use DateTimeImmutable;
|
||||||
use KTXF\Resource\Identifier\CollectionIdentifier;
|
|
||||||
use KTXF\Resource\Identifier\CollectionIdentifierInterface;
|
|
||||||
use KTXF\Resource\Identifier\EntityIdentifierInterface;
|
|
||||||
use KTXF\Resource\Identifier\ResourceIdentifier;
|
|
||||||
use KTXF\Resource\Identifier\ServiceIdentifier;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Abstract Node Base Class
|
* Abstract Node Base Class
|
||||||
@@ -28,7 +23,6 @@ abstract class NodeBaseAbstract implements NodeBaseInterface {
|
|||||||
/**
|
/**
|
||||||
* Internal data storage
|
* Internal data storage
|
||||||
*/
|
*/
|
||||||
protected string $type = 'resource.node';
|
|
||||||
protected array $data = [];
|
protected array $data = [];
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
@@ -36,82 +30,57 @@ abstract class NodeBaseAbstract implements NodeBaseInterface {
|
|||||||
protected readonly string|int $service,
|
protected readonly string|int $service,
|
||||||
) {
|
) {
|
||||||
$this->data = [
|
$this->data = [
|
||||||
static::PROPERTY_TYPE => $this->type,
|
static::JSON_PROPERTY_PROVIDER => $this->provider,
|
||||||
static::PROPERTY_PROVIDER => $this->provider,
|
static::JSON_PROPERTY_SERVICE => $this->service,
|
||||||
static::PROPERTY_SERVICE => $this->service,
|
static::JSON_PROPERTY_COLLECTION => null,
|
||||||
static::PROPERTY_COLLECTION => null,
|
static::JSON_PROPERTY_IDENTIFIER => null,
|
||||||
static::PROPERTY_IDENTIFIER => null,
|
static::JSON_PROPERTY_SIGNATURE => null,
|
||||||
static::PROPERTY_SIGNATURE => null,
|
static::JSON_PROPERTY_CREATED => null,
|
||||||
static::PROPERTY_CREATED => null,
|
static::JSON_PROPERTY_MODIFIED => null,
|
||||||
static::PROPERTY_MODIFIED => null,
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @inheritDoc
|
|
||||||
*/
|
|
||||||
public function jsonSerialize(): array {
|
|
||||||
$data = $this->data;
|
|
||||||
$data['provider'] = new ResourceIdentifier($this->data[static::PROPERTY_PROVIDER]);
|
|
||||||
$data['service'] = new ServiceIdentifier($this->data[static::PROPERTY_PROVIDER], $this->data[static::PROPERTY_SERVICE]);
|
|
||||||
$data['collection'] = isset($this->data[static::PROPERTY_COLLECTION])
|
|
||||||
? new CollectionIdentifier($this->data[static::PROPERTY_PROVIDER], $this->data[static::PROPERTY_SERVICE], $this->data[static::PROPERTY_COLLECTION])
|
|
||||||
: null;
|
|
||||||
$data['identifier'] = $this->nodeIdentifier();
|
|
||||||
$data[static::PROPERTY_PROPERTIES] = $this->getProperties()->jsonSerialize();
|
|
||||||
return $data;
|
|
||||||
}
|
|
||||||
|
|
||||||
abstract protected function nodeIdentifier(): CollectionIdentifierInterface|EntityIdentifierInterface|null;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function type(): string {
|
public function type(): string {
|
||||||
return $this->data[static::PROPERTY_TYPE];
|
return static::RESOURCE_TYPE;
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @inheritDoc
|
|
||||||
*/
|
|
||||||
public function urn(): string {
|
|
||||||
return (string) $this->nodeIdentifier();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function provider(): string {
|
public function provider(): string {
|
||||||
return $this->data[static::PROPERTY_PROVIDER];
|
return $this->data[static::JSON_PROPERTY_PROVIDER];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function service(): string|int {
|
public function service(): string|int {
|
||||||
return $this->data[static::PROPERTY_SERVICE];
|
return $this->data[static::JSON_PROPERTY_SERVICE];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function collection(): string|int|null {
|
public function collection(): string|int|null {
|
||||||
return $this->data[static::PROPERTY_COLLECTION] ?? null;
|
return $this->data[static::JSON_PROPERTY_COLLECTION] ?? null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function identifier(): string|int|null {
|
public function identifier(): string|int|null {
|
||||||
return $this->data[static::PROPERTY_IDENTIFIER] ?? null;
|
return $this->data[static::JSON_PROPERTY_IDENTIFIER] ?? null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function signature(): string|null {
|
public function signature(): string|null {
|
||||||
return isset($this->data[static::PROPERTY_SIGNATURE])
|
return isset($this->data[static::JSON_PROPERTY_SIGNATURE])
|
||||||
? (string)$this->data[static::PROPERTY_SIGNATURE]
|
? (string)$this->data[static::JSON_PROPERTY_SIGNATURE]
|
||||||
: null;
|
: null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -119,8 +88,8 @@ abstract class NodeBaseAbstract implements NodeBaseInterface {
|
|||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function created(): DateTimeImmutable|null {
|
public function created(): DateTimeImmutable|null {
|
||||||
return isset($this->data[static::PROPERTY_CREATED])
|
return isset($this->data[static::JSON_PROPERTY_CREATED])
|
||||||
? new DateTimeImmutable($this->data[static::PROPERTY_CREATED])
|
? new DateTimeImmutable($this->data[static::JSON_PROPERTY_CREATED])
|
||||||
: null;
|
: null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -128,11 +97,20 @@ abstract class NodeBaseAbstract implements NodeBaseInterface {
|
|||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function modified(): DateTimeImmutable|null {
|
public function modified(): DateTimeImmutable|null {
|
||||||
return isset($this->data[static::PROPERTY_MODIFIED])
|
return isset($this->data[static::JSON_PROPERTY_MODIFIED])
|
||||||
? new DateTimeImmutable($this->data[static::PROPERTY_MODIFIED])
|
? new DateTimeImmutable($this->data[static::JSON_PROPERTY_MODIFIED])
|
||||||
: null;
|
: null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function jsonSerialize(): array {
|
||||||
|
$data = $this->data;
|
||||||
|
$data[static::JSON_PROPERTY_PROPERTIES] = $this->getProperties()->jsonSerialize();
|
||||||
|
return $data;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -19,15 +19,15 @@ use KTXF\Json\JsonSerializable;
|
|||||||
*/
|
*/
|
||||||
interface NodeBaseInterface extends JsonSerializable {
|
interface NodeBaseInterface extends JsonSerializable {
|
||||||
|
|
||||||
public const PROPERTY_TYPE = 'resource.node';
|
public const RESOURCE_TYPE = 'resource.node';
|
||||||
public const PROPERTY_PROVIDER = 'provider';
|
public const JSON_PROPERTY_PROVIDER = 'provider';
|
||||||
public const PROPERTY_SERVICE = 'service';
|
public const JSON_PROPERTY_SERVICE = 'service';
|
||||||
public const PROPERTY_COLLECTION = 'collection';
|
public const JSON_PROPERTY_COLLECTION = 'collection';
|
||||||
public const PROPERTY_IDENTIFIER = 'identifier';
|
public const JSON_PROPERTY_IDENTIFIER = 'identifier';
|
||||||
public const PROPERTY_SIGNATURE = 'signature';
|
public const JSON_PROPERTY_SIGNATURE = 'signature';
|
||||||
public const PROPERTY_CREATED = 'created';
|
public const JSON_PROPERTY_CREATED = 'created';
|
||||||
public const PROPERTY_MODIFIED = 'modified';
|
public const JSON_PROPERTY_MODIFIED = 'modified';
|
||||||
public const PROPERTY_PROPERTIES = 'properties';
|
public const JSON_PROPERTY_PROPERTIES = 'properties';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Node type
|
* Node type
|
||||||
@@ -36,13 +36,6 @@ interface NodeBaseInterface extends JsonSerializable {
|
|||||||
*/
|
*/
|
||||||
public function type(): string;
|
public function type(): string;
|
||||||
|
|
||||||
/**
|
|
||||||
* Node URN
|
|
||||||
*
|
|
||||||
* @since 2025.05.01
|
|
||||||
*/
|
|
||||||
public function urn(): string;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provider identifier
|
* Provider identifier
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -28,56 +28,56 @@ abstract class NodeMutableAbstract extends NodeBaseAbstract implements NodeMutab
|
|||||||
|
|
||||||
$this->data = [];
|
$this->data = [];
|
||||||
|
|
||||||
if (isset($data[static::PROPERTY_COLLECTION])) {
|
if (isset($data[static::JSON_PROPERTY_COLLECTION])) {
|
||||||
if (!is_string($data[static::PROPERTY_COLLECTION]) && !is_int($data[static::PROPERTY_COLLECTION])) {
|
if (!is_string($data[static::JSON_PROPERTY_COLLECTION]) && !is_int($data[static::JSON_PROPERTY_COLLECTION])) {
|
||||||
throw new \InvalidArgumentException("Collection must be a string or integer");
|
throw new \InvalidArgumentException("Collection must be a string or integer");
|
||||||
}
|
}
|
||||||
$this->data[static::PROPERTY_COLLECTION] = $data[static::PROPERTY_COLLECTION];
|
$this->data[static::JSON_PROPERTY_COLLECTION] = $data[static::JSON_PROPERTY_COLLECTION];
|
||||||
} else {
|
} else {
|
||||||
$this->data[static::PROPERTY_COLLECTION] = null;
|
$this->data[static::JSON_PROPERTY_COLLECTION] = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($data[static::PROPERTY_IDENTIFIER])) {
|
if (isset($data[static::JSON_PROPERTY_IDENTIFIER])) {
|
||||||
if (!is_string($data[static::PROPERTY_IDENTIFIER]) && !is_int($data[static::PROPERTY_IDENTIFIER])) {
|
if (!is_string($data[static::JSON_PROPERTY_IDENTIFIER]) && !is_int($data[static::JSON_PROPERTY_IDENTIFIER])) {
|
||||||
throw new \InvalidArgumentException("Identifier must be a string or integer");
|
throw new \InvalidArgumentException("Identifier must be a string or integer");
|
||||||
}
|
}
|
||||||
$this->data[static::PROPERTY_IDENTIFIER] = $data[static::PROPERTY_IDENTIFIER];
|
$this->data[static::JSON_PROPERTY_IDENTIFIER] = $data[static::JSON_PROPERTY_IDENTIFIER];
|
||||||
} else {
|
} else {
|
||||||
$this->data[static::PROPERTY_IDENTIFIER] = null;
|
$this->data[static::JSON_PROPERTY_IDENTIFIER] = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($data[static::PROPERTY_SIGNATURE])) {
|
if (isset($data[static::JSON_PROPERTY_SIGNATURE])) {
|
||||||
if (!is_string($data[static::PROPERTY_SIGNATURE]) && !is_int($data[static::PROPERTY_SIGNATURE])) {
|
if (!is_string($data[static::JSON_PROPERTY_SIGNATURE]) && !is_int($data[static::JSON_PROPERTY_SIGNATURE])) {
|
||||||
throw new \InvalidArgumentException("Signature must be a string or integer");
|
throw new \InvalidArgumentException("Signature must be a string or integer");
|
||||||
}
|
}
|
||||||
$this->data[static::PROPERTY_SIGNATURE] = $data[static::PROPERTY_SIGNATURE];
|
$this->data[static::JSON_PROPERTY_SIGNATURE] = $data[static::JSON_PROPERTY_SIGNATURE];
|
||||||
} else {
|
} else {
|
||||||
$this->data[static::PROPERTY_SIGNATURE] = null;
|
$this->data[static::JSON_PROPERTY_SIGNATURE] = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($data[static::PROPERTY_CREATED])) {
|
if (isset($data[static::JSON_PROPERTY_CREATED])) {
|
||||||
if (!is_string($data[static::PROPERTY_CREATED])) {
|
if (!is_string($data[static::JSON_PROPERTY_CREATED])) {
|
||||||
throw new \InvalidArgumentException("Created date must be a string in ISO 8601 format");
|
throw new \InvalidArgumentException("Created date must be a string in ISO 8601 format");
|
||||||
}
|
}
|
||||||
$this->data[static::PROPERTY_CREATED] = $data[static::PROPERTY_CREATED];
|
$this->data[static::JSON_PROPERTY_CREATED] = $data[static::JSON_PROPERTY_CREATED];
|
||||||
} else {
|
} else {
|
||||||
$this->data[static::PROPERTY_CREATED] = null;
|
$this->data[static::JSON_PROPERTY_CREATED] = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($data[static::PROPERTY_MODIFIED])) {
|
if (isset($data[static::JSON_PROPERTY_MODIFIED])) {
|
||||||
if (!is_string($data[static::PROPERTY_MODIFIED])) {
|
if (!is_string($data[static::JSON_PROPERTY_MODIFIED])) {
|
||||||
throw new \InvalidArgumentException("Modified date must be a string in ISO 8601 format");
|
throw new \InvalidArgumentException("Modified date must be a string in ISO 8601 format");
|
||||||
}
|
}
|
||||||
$this->data[static::PROPERTY_MODIFIED] = $data[static::PROPERTY_MODIFIED];
|
$this->data[static::JSON_PROPERTY_MODIFIED] = $data[static::JSON_PROPERTY_MODIFIED];
|
||||||
} else {
|
} else {
|
||||||
$this->data[static::PROPERTY_MODIFIED] = null;
|
$this->data[static::JSON_PROPERTY_MODIFIED] = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($data[static::PROPERTY_PROPERTIES])) {
|
if (isset($data[static::JSON_PROPERTY_PROPERTIES])) {
|
||||||
if (!is_array($data[static::PROPERTY_PROPERTIES])) {
|
if (!is_array($data[static::JSON_PROPERTY_PROPERTIES])) {
|
||||||
throw new \InvalidArgumentException("Properties must be an array");
|
throw new \InvalidArgumentException("Properties must be an array");
|
||||||
}
|
}
|
||||||
$this->getProperties()->jsonDeserialize($data[static::PROPERTY_PROPERTIES]);
|
$this->getProperties()->jsonDeserialize($data[static::JSON_PROPERTY_PROPERTIES]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
|
|||||||
@@ -18,17 +18,16 @@ namespace KTXF\Resource\Provider\Node;
|
|||||||
*/
|
*/
|
||||||
abstract class NodePropertiesBaseAbstract implements NodePropertiesBaseInterface {
|
abstract class NodePropertiesBaseAbstract implements NodePropertiesBaseInterface {
|
||||||
|
|
||||||
protected string $type = 'resource.data';
|
|
||||||
protected array $data = [];
|
protected array $data = [];
|
||||||
|
|
||||||
public function __construct(array $data) {
|
public function __construct(array $data) {
|
||||||
|
|
||||||
if (!isset($data[static::PROPERTY_TYPE])) {
|
if (!isset($data[static::JSON_PROPERTY_TYPE])) {
|
||||||
$data[static::PROPERTY_TYPE] = $this->type;
|
$data[static::JSON_PROPERTY_TYPE] = static::JSON_TYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isset($data[static::PROPERTY_SCHEMA])) {
|
if (!isset($data[static::JSON_PROPERTY_SCHEMA])) {
|
||||||
$data[static::PROPERTY_SCHEMA] = 1;
|
$data[static::JSON_PROPERTY_SCHEMA] = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->data = $data;
|
$this->data = $data;
|
||||||
@@ -45,14 +44,14 @@ abstract class NodePropertiesBaseAbstract implements NodePropertiesBaseInterface
|
|||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function type(): string {
|
public function type(): string {
|
||||||
return $this->data[static::PROPERTY_TYPE];
|
return $this->data[static::JSON_PROPERTY_TYPE];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
public function schema(): int {
|
public function schema(): int {
|
||||||
return $this->data[static::PROPERTY_SCHEMA];
|
return $this->data[static::JSON_PROPERTY_SCHEMA];
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,8 +18,11 @@ use JsonSerializable;
|
|||||||
*/
|
*/
|
||||||
interface NodePropertiesBaseInterface extends JsonSerializable {
|
interface NodePropertiesBaseInterface extends JsonSerializable {
|
||||||
|
|
||||||
public const PROPERTY_TYPE = '@type';
|
public const RESOURCE_TYPE = 'resource.data';
|
||||||
public const PROPERTY_SCHEMA = 'schema';
|
|
||||||
|
public const JSON_TYPE = 'resource.data';
|
||||||
|
public const JSON_PROPERTY_TYPE = '@type';
|
||||||
|
public const JSON_PROPERTY_SCHEMA = 'schema';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get resource node properties type
|
* Get resource node properties type
|
||||||
|
|||||||
@@ -16,4 +16,6 @@ use KTXF\Json\JsonDeserializable;
|
|||||||
*
|
*
|
||||||
* @since 2025.05.01
|
* @since 2025.05.01
|
||||||
*/
|
*/
|
||||||
interface NodePropertiesMutableInterface extends NodePropertiesBaseInterface, JsonDeserializable {}
|
interface NodePropertiesMutableInterface extends NodePropertiesBaseInterface, JsonDeserializable {
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@@ -14,6 +14,11 @@ interface ResourceProviderBaseInterface extends ProviderInterface, JsonSerializa
|
|||||||
public const CAPABILITY_SERVICE_LIST = 'ServiceList';
|
public const CAPABILITY_SERVICE_LIST = 'ServiceList';
|
||||||
public const CAPABILITY_SERVICE_FETCH = 'ServiceFetch';
|
public const CAPABILITY_SERVICE_FETCH = 'ServiceFetch';
|
||||||
public const CAPABILITY_SERVICE_EXTANT = 'ServiceExtant';
|
public const CAPABILITY_SERVICE_EXTANT = 'ServiceExtant';
|
||||||
|
public const CAPABILITY_SERVICE_CREATE = 'ServiceCreate';
|
||||||
|
public const CAPABILITY_SERVICE_MODIFY = 'ServiceModify';
|
||||||
|
public const CAPABILITY_SERVICE_DESTROY = 'ServiceDestroy';
|
||||||
|
public const CAPABILITY_SERVICE_DISCOVER = 'ServiceDiscover';
|
||||||
|
public const CAPABILITY_SERVICE_TEST = 'ServiceTest';
|
||||||
|
|
||||||
public const JSON_TYPE = 'resource.provider';
|
public const JSON_TYPE = 'resource.provider';
|
||||||
public const JSON_PROPERTY_TYPE = '@type';
|
public const JSON_PROPERTY_TYPE = '@type';
|
||||||
|
|||||||
@@ -13,10 +13,6 @@ use KTXF\Json\JsonDeserializable;
|
|||||||
|
|
||||||
interface ResourceProviderServiceMutateInterface extends JsonDeserializable {
|
interface ResourceProviderServiceMutateInterface extends JsonDeserializable {
|
||||||
|
|
||||||
public const CAPABILITY_SERVICE_CREATE = 'ServiceCreate';
|
|
||||||
public const CAPABILITY_SERVICE_MODIFY = 'ServiceModify';
|
|
||||||
public const CAPABILITY_SERVICE_DESTROY = 'ServiceDestroy';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* construct and new blank service instance
|
* construct and new blank service instance
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user