refactor: service interfaces #78
@@ -20,7 +20,7 @@ use KTXF\Mail\Collection\CollectionMutableInterface;
|
|||||||
*
|
*
|
||||||
* @since 2025.05.01
|
* @since 2025.05.01
|
||||||
*/
|
*/
|
||||||
interface ServiceCollectionMutableInterface extends ServiceBaseInterface {
|
interface ServiceCollectionMutableInterface {
|
||||||
|
|
||||||
public const CAPABILITY_COLLECTION_CREATE = 'CollectionCreate';
|
public const CAPABILITY_COLLECTION_CREATE = 'CollectionCreate';
|
||||||
public const CAPABILITY_COLLECTION_UPDATE = 'CollectionUpdate';
|
public const CAPABILITY_COLLECTION_UPDATE = 'CollectionUpdate';
|
||||||
|
|||||||
@@ -12,15 +12,12 @@ namespace KTXF\Mail\Service;
|
|||||||
use KTXF\Resource\Provider\ResourceServiceConfigureInterface;
|
use KTXF\Resource\Provider\ResourceServiceConfigureInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Mail Service Mutable Interface
|
* Mail Service Configurable 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 ServiceMutableInterface, ResourceServiceConfigureInterface {
|
interface ServiceConfigurableInterface extends ResourceServiceConfigureInterface {
|
||||||
|
|
||||||
public const JSON_TYPE = ServiceBaseInterface::JSON_TYPE;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ 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\CollectionIdentifier;
|
||||||
use KTXF\Resource\Identifier\EntityIdentifier;
|
use KTXF\Resource\Identifier\EntityIdentifier;
|
||||||
|
|
||||||
@@ -22,11 +23,12 @@ use KTXF\Resource\Identifier\EntityIdentifier;
|
|||||||
*
|
*
|
||||||
* @since 2025.05.01
|
* @since 2025.05.01
|
||||||
*/
|
*/
|
||||||
interface ServiceEntityMutableInterface extends ServiceBaseInterface {
|
interface ServiceEntityMutableInterface {
|
||||||
|
|
||||||
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';
|
||||||
|
|
||||||
@@ -44,33 +46,32 @@ interface ServiceEntityMutableInterface extends ServiceBaseInterface {
|
|||||||
*
|
*
|
||||||
* @since 2025.05.01
|
* @since 2025.05.01
|
||||||
*
|
*
|
||||||
* @param string|int $collection collection identifier
|
* @param CollectionIdentifier $target Target collection identifier
|
||||||
* @param EntityMutableInterface $entity Entity data
|
* @param MessagePropertiesMutableInterface $properties Entity properties
|
||||||
* @param array $options additional options
|
* @param array $options Additional options
|
||||||
*
|
*
|
||||||
* @return EntityBaseInterface Created entity
|
* @return EntityBaseInterface Created entity
|
||||||
*/
|
*/
|
||||||
public function entityCreate(string|int $collection, EntityMutableInterface $entity, array $options = []): EntityBaseInterface;
|
public function entityCreate(CollectionIdentifier $target, MessagePropertiesMutableInterface $properties, array $options = []): EntityBaseInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Modifies an existing entity
|
* Modifies an existing entity
|
||||||
*
|
*
|
||||||
* @since 2025.05.01
|
* @since 2025.05.01
|
||||||
*
|
*
|
||||||
* @param string|int $collection Collection identifier
|
* @param EntityIdentifier $target Target entity identifier
|
||||||
* @param string|int $identifier Entity identifier
|
* @param MessagePropertiesMutableInterface $properties Entity properties to update
|
||||||
* @param EntityMutableInterface $entity Entity data
|
|
||||||
*
|
*
|
||||||
* @return EntityBaseInterface Modified entity
|
* @return EntityBaseInterface Modified entity
|
||||||
*/
|
*/
|
||||||
public function entityModify(string|int $collection, string|int $identifier, EntityMutableInterface $entity): EntityBaseInterface;
|
public function entityModify(EntityIdentifier $target, MessagePropertiesMutableInterface $properties): EntityBaseInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Deletes entities
|
* Deletes entities
|
||||||
*
|
*
|
||||||
* @since 2026.04.01
|
* @since 2026.04.01
|
||||||
*
|
*
|
||||||
* @param EntityIdentifier ...$identifiers Source entities to delete
|
* @param EntityIdentifier ...$targets Source entities to delete
|
||||||
*
|
*
|
||||||
* @return array<string, array{
|
* @return array<string, array{
|
||||||
* disposition: 'moved'|'deleted'|'error',
|
* disposition: 'moved'|'deleted'|'error',
|
||||||
@@ -78,23 +79,21 @@ interface ServiceEntityMutableInterface extends ServiceBaseInterface {
|
|||||||
* mutation: EntityIdentifier
|
* mutation: EntityIdentifier
|
||||||
* }> Results keyed by source entity identifier
|
* }> Results keyed by source entity identifier
|
||||||
*/
|
*/
|
||||||
public function entityDelete(EntityIdentifier ...$identifiers): array;
|
public function entityDelete(EntityIdentifier ...$targets): array;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copies entities to another collection
|
* Patches an existing entity(ies) with partial data
|
||||||
*
|
*
|
||||||
* @since 2025.05.01
|
* @since 2025.05.01
|
||||||
*
|
*
|
||||||
* @param CollectionIdentifier $target Target collection identifier
|
* @param MessagePropertiesMutableInterface $properties Partial entity properties
|
||||||
* @param EntityIdentifier ...$identifiers Source entities to copy
|
* @param EntityIdentifier ...$targets Source entities to patch
|
||||||
*
|
*
|
||||||
* @return array<string, array{
|
* @return array<string, array{
|
||||||
* disposition: 'copied'|'error',
|
* disposition: 'patched'|'error'
|
||||||
* destination: ?CollectionIdentifier,
|
|
||||||
* mutation: EntityIdentifier
|
|
||||||
* }> Results keyed by source entity identifier
|
* }> Results keyed by source entity identifier
|
||||||
*/
|
*/
|
||||||
public function entityCopy(CollectionIdentifier $target, EntityIdentifier ...$identifiers): array;
|
public function entityPatch(MessagePropertiesMutableInterface $properties, EntityIdentifier ...$targets): array;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Moves entities to another collection
|
* Moves entities to another collection
|
||||||
@@ -102,7 +101,7 @@ interface ServiceEntityMutableInterface extends ServiceBaseInterface {
|
|||||||
* @since 2025.05.01
|
* @since 2025.05.01
|
||||||
*
|
*
|
||||||
* @param CollectionIdentifier $target Target collection identifier
|
* @param CollectionIdentifier $target Target collection identifier
|
||||||
* @param EntityIdentifier ...$identifiers Source entities to move
|
* @param EntityIdentifier ...$sources Source entities to move
|
||||||
*
|
*
|
||||||
* @return array<string, array{
|
* @return array<string, array{
|
||||||
* disposition: 'moved'|'error',
|
* disposition: 'moved'|'error',
|
||||||
@@ -110,6 +109,22 @@ interface ServiceEntityMutableInterface extends ServiceBaseInterface {
|
|||||||
* mutation: EntityIdentifier
|
* mutation: EntityIdentifier
|
||||||
* }> Results keyed by source entity identifier
|
* }> Results keyed by source entity identifier
|
||||||
*/
|
*/
|
||||||
public function entityMove(CollectionIdentifier $target, EntityIdentifier ...$identifiers): array;
|
public function entityMove(CollectionIdentifier $target, EntityIdentifier ...$sources): array;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copies entities to another collection
|
||||||
|
*
|
||||||
|
* @since 2025.05.01
|
||||||
|
*
|
||||||
|
* @param CollectionIdentifier $target Target collection identifier
|
||||||
|
* @param EntityIdentifier ...$sources Source entities to copy
|
||||||
|
*
|
||||||
|
* @return array<string, array{
|
||||||
|
* disposition: 'copied'|'error',
|
||||||
|
* destination: ?CollectionIdentifier,
|
||||||
|
* mutation: EntityIdentifier
|
||||||
|
* }> Results keyed by source entity identifier
|
||||||
|
*/
|
||||||
|
public function entityCopy(CollectionIdentifier $target, EntityIdentifier ...$sources): array;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ use KTXF\Mail\Exception\SendException;
|
|||||||
*
|
*
|
||||||
* @since 2025.05.01
|
* @since 2025.05.01
|
||||||
*/
|
*/
|
||||||
interface ServiceEntityTransmitInterface extends ServiceBaseInterface {
|
interface ServiceEntityTransmitInterface {
|
||||||
|
|
||||||
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 ServiceBaseInterface, ResourceServiceMutateInterface {
|
interface ServiceMutableInterface extends ResourceServiceMutateInterface {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the primary mailing address for this service
|
* Sets the primary mailing address for this service
|
||||||
|
|||||||
Reference in New Issue
Block a user