lots of improvements
This commit is contained in:
@@ -9,9 +9,9 @@ declare(strict_types=1);
|
||||
|
||||
namespace KTXF\Mail\Service;
|
||||
|
||||
use KTXF\Mail\Collection\ICollectionBase;
|
||||
use KTXF\Mail\Entity\IAddress;
|
||||
use KTXF\Mail\Entity\IMessageBase;
|
||||
use KTXF\Mail\Collection\CollectionBaseInterface;
|
||||
use KTXF\Mail\Object\AddressInterface;
|
||||
use KTXF\Resource\Delta\Delta;
|
||||
use KTXF\Resource\Filter\IFilter;
|
||||
use KTXF\Resource\Provider\ResourceServiceBaseInterface;
|
||||
use KTXF\Resource\Range\IRange;
|
||||
@@ -34,7 +34,13 @@ interface ServiceBaseInterface extends ResourceServiceBaseInterface {
|
||||
public const CAPABILITY_COLLECTION_LIST_SORT = 'CollectionListSort';
|
||||
public const CAPABILITY_COLLECTION_EXTANT = 'CollectionExtant';
|
||||
public const CAPABILITY_COLLECTION_FETCH = 'CollectionFetch';
|
||||
// Message capabilities
|
||||
// Collection Filter
|
||||
public const CAPABILITY_COLLECTION_FILTER_LABEL = 'label';
|
||||
public const CAPABILITY_COLLECTION_FILTER_ROLE = 'role';
|
||||
// Collection Sort
|
||||
public const CAPABILITY_COLLECTION_SORT_LABEL = 'label';
|
||||
public const CAPABILITY_COLLECTION_SORT_RANK = 'rank';
|
||||
// Entity capabilities
|
||||
public const CAPABILITY_ENTITY_LIST = 'EntityList';
|
||||
public const CAPABILITY_ENTITY_LIST_FILTER = 'EntityListFilter';
|
||||
public const CAPABILITY_ENTITY_LIST_SORT = 'EntityListSort';
|
||||
@@ -43,19 +49,24 @@ interface ServiceBaseInterface extends ResourceServiceBaseInterface {
|
||||
public const CAPABILITY_ENTITY_EXTANT = 'EntityExtant';
|
||||
public const CAPABILITY_ENTITY_FETCH = 'EntityFetch';
|
||||
// Filter capabilities
|
||||
public const CAPABILITY_FILTER_ID = 'id';
|
||||
public const CAPABILITY_FILTER_SUBJECT = 'subject';
|
||||
public const CAPABILITY_FILTER_FROM = 'from';
|
||||
public const CAPABILITY_FILTER_TO = 'to';
|
||||
public const CAPABILITY_FILTER_DATE = 'date';
|
||||
public const CAPABILITY_FILTER_FLAG = 'flag';
|
||||
public const CAPABILITY_FILTER_SIZE = 'size';
|
||||
public const CAPABILITY_FILTER_BODY = 'body';
|
||||
public const CAPABILITY_ENTITY_FILTER_ALL = '*';
|
||||
public const CAPABILITY_ENTITY_FILTER_FROM = 'from';
|
||||
public const CAPABILITY_ENTITY_FILTER_TO = 'to';
|
||||
public const CAPABILITY_ENTITY_FILTER_CC = 'cc';
|
||||
public const CAPABILITY_ENTITY_FILTER_BCC = 'bcc';
|
||||
public const CAPABILITY_ENTITY_FILTER_SUBJECT = 'subject';
|
||||
public const CAPABILITY_ENTITY_FILTER_BODY = 'body';
|
||||
public const CAPABILITY_ENTITY_FILTER_DATE_BEFORE = 'before';
|
||||
public const CAPABILITY_ENTITY_FILTER_DATE_AFTER = 'after';
|
||||
public const CAPABILITY_ENTITY_FILTER_SIZE_MIN = 'min';
|
||||
public const CAPABILITY_ENTITY_FILTER_SIZE_MAX = 'max';
|
||||
// Sort capabilities
|
||||
public const CAPABILITY_SORT_DATE = 'date';
|
||||
public const CAPABILITY_SORT_SUBJECT = 'subject';
|
||||
public const CAPABILITY_SORT_FROM = 'from';
|
||||
public const CAPABILITY_SORT_SIZE = 'size';
|
||||
public const CAPABILITY_ENTITY_SORT_FROM = 'from';
|
||||
public const CAPABILITY_ENTITY_SORT_TO = 'to';
|
||||
public const CAPABILITY_ENTITY_SORT_SUBJECT = 'subject';
|
||||
public const CAPABILITY_ENTITY_SORT_DATE_RECEIVED = 'received';
|
||||
public const CAPABILITY_ENTITY_SORT_DATE_SENT = 'sent';
|
||||
public const CAPABILITY_ENTITY_SORT_SIZE = 'size';
|
||||
|
||||
public const JSON_TYPE = 'mail.service';
|
||||
public const JSON_PROPERTY_PRIMARY_ADDRESS = 'primaryAddress';
|
||||
@@ -66,16 +77,16 @@ interface ServiceBaseInterface extends ResourceServiceBaseInterface {
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @return IAddress
|
||||
* @return AddressInterface
|
||||
*/
|
||||
public function getPrimaryAddress(): IAddress;
|
||||
public function getPrimaryAddress(): AddressInterface;
|
||||
|
||||
/**
|
||||
* Gets the secondary mailing addresses (aliases) for this service
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @return array<int, IAddress>
|
||||
* @return array<int,AddressInterface>
|
||||
*/
|
||||
public function getSecondaryAddresses(): array;
|
||||
|
||||
@@ -88,7 +99,7 @@ interface ServiceBaseInterface extends ResourceServiceBaseInterface {
|
||||
*
|
||||
* @return bool True if address matches primary or any secondary address
|
||||
*/
|
||||
public function handlesAddress(string $address): bool;
|
||||
public function hasAddress(string $address): bool;
|
||||
|
||||
/**
|
||||
* Lists all collections in this service
|
||||
@@ -98,9 +109,9 @@ interface ServiceBaseInterface extends ResourceServiceBaseInterface {
|
||||
* @param IFilter|null $filter Optional filter criteria
|
||||
* @param ISort|null $sort Optional sort order
|
||||
*
|
||||
* @return array<string|int,ICollectionBase> Collections indexed by ID
|
||||
* @return array<string|int,CollectionBaseInterface> Collections indexed by ID
|
||||
*/
|
||||
public function collectionList(?IFilter $filter = null, ?ISort $sort = null): array;
|
||||
public function collectionList(string|int $location, ?IFilter $filter = null, ?ISort $sort = null): array;
|
||||
|
||||
/**
|
||||
* Creates a filter builder for collections
|
||||
@@ -129,7 +140,7 @@ interface ServiceBaseInterface extends ResourceServiceBaseInterface {
|
||||
*
|
||||
* @return array<string|int,bool> Map of ID => exists
|
||||
*/
|
||||
public function collectionExtant(string|int ...$identifiers): array;
|
||||
public function collectionExtant(string|int $location, string|int ...$identifiers): array;
|
||||
|
||||
/**
|
||||
* Fetches a single collection
|
||||
@@ -138,9 +149,9 @@ interface ServiceBaseInterface extends ResourceServiceBaseInterface {
|
||||
*
|
||||
* @param string|int $identifier Collection ID
|
||||
*
|
||||
* @return ICollectionBase|null Collection or null if not found
|
||||
* @return CollectionBaseInterface|null Collection or null if not found
|
||||
*/
|
||||
public function collectionFetch(string|int $identifier): ?ICollectionBase;
|
||||
public function collectionFetch(string|int $identifier): ?CollectionBaseInterface;
|
||||
|
||||
/**
|
||||
* Lists messages in a collection
|
||||
@@ -153,9 +164,9 @@ interface ServiceBaseInterface extends ResourceServiceBaseInterface {
|
||||
* @param IRange|null $range Optional pagination
|
||||
* @param array|null $properties Optional message properties to fetch
|
||||
*
|
||||
* @return array<string|int,IMessageBase> Messages indexed by ID
|
||||
* @return array<string|int,EntityBaseInterface> Messages indexed by ID
|
||||
*/
|
||||
public function messageList(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;
|
||||
|
||||
/**
|
||||
* Creates a filter builder for messages
|
||||
@@ -164,7 +175,7 @@ interface ServiceBaseInterface extends ResourceServiceBaseInterface {
|
||||
*
|
||||
* @return IFilter
|
||||
*/
|
||||
public function messageListFilter(): IFilter;
|
||||
public function entityListFilter(): IFilter;
|
||||
|
||||
/**
|
||||
* Creates a sort builder for messages
|
||||
@@ -173,7 +184,7 @@ interface ServiceBaseInterface extends ResourceServiceBaseInterface {
|
||||
*
|
||||
* @return ISort
|
||||
*/
|
||||
public function messageListSort(): ISort;
|
||||
public function entityListSort(): ISort;
|
||||
|
||||
/**
|
||||
* Creates a range builder for messages
|
||||
@@ -184,7 +195,7 @@ interface ServiceBaseInterface extends ResourceServiceBaseInterface {
|
||||
*
|
||||
* @return IRange
|
||||
*/
|
||||
public function messageListRange(RangeType $type): IRange;
|
||||
public function entityListRange(RangeType $type): IRange;
|
||||
|
||||
/**
|
||||
* Gets incremental changes since last sync
|
||||
@@ -197,7 +208,7 @@ interface ServiceBaseInterface extends ResourceServiceBaseInterface {
|
||||
*
|
||||
* @return array ['signature' => string, 'added' => array, 'modified' => array, 'removed' => array]
|
||||
*/
|
||||
public function messageDelta(string|int $collection, string $signature, string $detail = 'ids'): array;
|
||||
public function entityDelta(string|int $collection, string $signature, string $detail = 'ids'): Delta;
|
||||
|
||||
/**
|
||||
* Checks if messages exist
|
||||
@@ -209,18 +220,18 @@ interface ServiceBaseInterface extends ResourceServiceBaseInterface {
|
||||
*
|
||||
* @return array<string|int,bool> Map of ID => exists
|
||||
*/
|
||||
public function messageExtant(string|int $collection, string|int ...$identifiers): array;
|
||||
public function entityExtant(string|int $collection, string|int ...$identifiers): array;
|
||||
|
||||
/**
|
||||
* Fetches one or more messages
|
||||
* Fetches one or more entities
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @param string|int $collection Collection ID
|
||||
* @param string|int ...$identifiers Message IDs to fetch
|
||||
*
|
||||
* @return array<string|int,IMessageBase> Messages indexed by ID
|
||||
* @return array<string|int,EntityBaseInterface> Messages indexed by ID
|
||||
*/
|
||||
public function messageFetch(string|int $collection, string|int ...$identifiers): array;
|
||||
public function entityFetch(string|int $collection, string|int ...$identifiers): array;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user