Merge pull request 'refactor: list and fetch' (#95) from refactor/list-and-fetch into main
Some checks failed
Renovate / renovate (push) Failing after 1m55s
Some checks failed
Renovate / renovate (push) Failing after 1m55s
Reviewed-on: #95
This commit was merged in pull request #95.
This commit is contained in:
@@ -28,6 +28,8 @@ use KTXF\Resource\Provider\ResourceServiceLocationInterface;
|
|||||||
*/
|
*/
|
||||||
interface ProviderServiceDiscoverInterface {
|
interface ProviderServiceDiscoverInterface {
|
||||||
|
|
||||||
|
public const CAPABILITY_SERVICE_DISCOVER = 'ServiceDiscover';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Attempts to discover service configuration using provider-specific methods.
|
* Attempts to discover service configuration using provider-specific methods.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -28,6 +28,8 @@ use KTXF\Mail\Service\ServiceMutableInterface;
|
|||||||
*/
|
*/
|
||||||
interface ProviderServiceTestInterface {
|
interface ProviderServiceTestInterface {
|
||||||
|
|
||||||
|
public const CAPABILITY_SERVICE_TEST = 'ServiceTest';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Test a service connection
|
* Test a service connection
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ use KTXF\Mail\Collection\CollectionBaseInterface;
|
|||||||
use KTXF\Mail\Object\AddressInterface;
|
use KTXF\Mail\Object\AddressInterface;
|
||||||
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;
|
||||||
@@ -166,9 +167,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|int,EntityBaseInterface> Messages indexed by ID
|
* @return array<string,EntityBaseInterface> Messages indexed by Urn
|
||||||
*/
|
*/
|
||||||
public function entityList(string|int $collection, ?IFilter $filter = null, ?ISort $sort = null, ?IRange $range = null, ?array $properties = null): array;
|
public function entityListBulk(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
|
||||||
@@ -244,11 +245,21 @@ interface ServiceBaseInterface extends ResourceServiceBaseInterface {
|
|||||||
*
|
*
|
||||||
* @since 2025.05.01
|
* @since 2025.05.01
|
||||||
*
|
*
|
||||||
* @param string|int $collection Collection ID
|
* @param EntityIdentifierInterface ...$identifiers Message identifiers to fetch
|
||||||
* @param string|int ...$identifiers Message IDs to fetch
|
|
||||||
*
|
*
|
||||||
* @return array<string|int,EntityBaseInterface> Messages indexed by ID
|
* @return array<string,EntityBaseInterface> Messages indexed by Urn
|
||||||
*/
|
*/
|
||||||
public function entityFetch(string|int $collection, string|int ...$identifiers): array;
|
public function entityFetchBulk(EntityIdentifierInterface ...$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;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,6 +71,13 @@ abstract class NodeBaseAbstract implements NodeBaseInterface {
|
|||||||
return $this->data[static::PROPERTY_TYPE];
|
return $this->data[static::PROPERTY_TYPE];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function urn(): string {
|
||||||
|
return (string) $this->nodeIdentifier();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @inheritDoc
|
* @inheritDoc
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -35,6 +35,13 @@ interface NodeBaseInterface extends JsonSerializable {
|
|||||||
* @since 2025.05.01
|
* @since 2025.05.01
|
||||||
*/
|
*/
|
||||||
public function type(): string;
|
public function type(): string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Node URN
|
||||||
|
*
|
||||||
|
* @since 2025.05.01
|
||||||
|
*/
|
||||||
|
public function urn(): string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provider identifier
|
* Provider identifier
|
||||||
|
|||||||
@@ -14,11 +14,6 @@ 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';
|
||||||
|
|||||||
@@ -12,6 +12,10 @@ namespace KTXF\Resource\Provider;
|
|||||||
use KTXF\Json\JsonDeserializable;
|
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