Initial Version
This commit is contained in:
116
shared/lib/Resource/Provider/Node/NodeBaseAbstract.php
Normal file
116
shared/lib/Resource/Provider/Node/NodeBaseAbstract.php
Normal file
@@ -0,0 +1,116 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\Resource\Provider\Node;
|
||||
|
||||
use DateTimeImmutable;
|
||||
|
||||
/**
|
||||
* Abstract Node Base Class
|
||||
*
|
||||
* Provides common implementation for all resource nodes
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
abstract class NodeBaseAbstract implements NodeBaseInterface {
|
||||
|
||||
/**
|
||||
* Internal data storage
|
||||
*/
|
||||
protected array $data = [];
|
||||
|
||||
public function __construct(
|
||||
protected readonly string $provider,
|
||||
protected readonly string|int $service,
|
||||
) {
|
||||
$this->data = [
|
||||
static::JSON_PROPERTY_PROVIDER => $this->provider,
|
||||
static::JSON_PROPERTY_SERVICE => $this->service,
|
||||
static::JSON_PROPERTY_COLLECTION => null,
|
||||
static::JSON_PROPERTY_IDENTIFIER => null,
|
||||
static::JSON_PROPERTY_SIGNATURE => null,
|
||||
static::JSON_PROPERTY_CREATED => null,
|
||||
static::JSON_PROPERTY_MODIFIED => null,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function type(): string {
|
||||
return static::RESOURCE_TYPE;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function provider(): string {
|
||||
return $this->data[static::JSON_PROPERTY_PROVIDER];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function service(): string|int {
|
||||
return $this->data[static::JSON_PROPERTY_SERVICE];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function collection(): string|int|null {
|
||||
return $this->data[static::JSON_PROPERTY_COLLECTION] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function identifier(): string|int|null {
|
||||
return $this->data[static::JSON_PROPERTY_IDENTIFIER] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function signature(): string|null {
|
||||
return $this->data[static::JSON_PROPERTY_SIGNATURE] ?? null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function created(): DateTimeImmutable|null {
|
||||
return isset($this->data[static::JSON_PROPERTY_CREATED])
|
||||
? new DateTimeImmutable($this->data[static::JSON_PROPERTY_CREATED])
|
||||
: null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function modified(): DateTimeImmutable|null {
|
||||
return isset($this->data[static::JSON_PROPERTY_MODIFIED])
|
||||
? new DateTimeImmutable($this->data[static::JSON_PROPERTY_MODIFIED])
|
||||
: null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function jsonSerialize(): array {
|
||||
$data = $this->data;
|
||||
$data[static::JSON_PROPERTY_PROPERTIES] = $this->getProperties()->jsonSerialize();
|
||||
return $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
abstract public function getProperties(): NodePropertiesBaseInterface;
|
||||
}
|
||||
95
shared/lib/Resource/Provider/Node/NodeBaseInterface.php
Normal file
95
shared/lib/Resource/Provider/Node/NodeBaseInterface.php
Normal file
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\Resource\Provider\Node;
|
||||
|
||||
use DateTimeImmutable;
|
||||
use KTXF\Json\JsonSerializable;
|
||||
|
||||
/**
|
||||
* Resource Node Read Interface
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
interface NodeBaseInterface extends JsonSerializable {
|
||||
|
||||
public const RESOURCE_TYPE = 'resource.node';
|
||||
public const JSON_PROPERTY_PROVIDER = 'provider';
|
||||
public const JSON_PROPERTY_SERVICE = 'service';
|
||||
public const JSON_PROPERTY_COLLECTION = 'collection';
|
||||
public const JSON_PROPERTY_IDENTIFIER = 'identifier';
|
||||
public const JSON_PROPERTY_SIGNATURE = 'signature';
|
||||
public const JSON_PROPERTY_CREATED = 'created';
|
||||
public const JSON_PROPERTY_MODIFIED = 'modified';
|
||||
public const JSON_PROPERTY_PROPERTIES = 'properties';
|
||||
|
||||
/**
|
||||
* Node type
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function type(): string;
|
||||
|
||||
/**
|
||||
* Provider identifier
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function provider(): string;
|
||||
|
||||
/**
|
||||
* Service identifier
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function service(): string|int;
|
||||
|
||||
/**
|
||||
* Collection identifier
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function collection(): string|int|null;
|
||||
|
||||
/**
|
||||
* Node identifier
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function identifier(): string|int|null;
|
||||
|
||||
/**
|
||||
* Node signature/sync token
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function signature(): string|null;
|
||||
|
||||
/**
|
||||
* Node creation date
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function created(): DateTimeImmutable|null;
|
||||
|
||||
/**
|
||||
* Node modification date
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function modified(): DateTimeImmutable|null;
|
||||
|
||||
/**
|
||||
* Get the node properties
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function getProperties(): NodePropertiesBaseInterface|NodePropertiesMutableInterface;
|
||||
|
||||
}
|
||||
95
shared/lib/Resource/Provider/Node/NodeMutableAbstract.php
Normal file
95
shared/lib/Resource/Provider/Node/NodeMutableAbstract.php
Normal file
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\Resource\Provider\Node;
|
||||
|
||||
/**
|
||||
* Abstract Node Mutable Class
|
||||
*
|
||||
* Provides common implementation for mutable resource nodes
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
abstract class NodeMutableAbstract extends NodeBaseAbstract implements NodeMutableInterface {
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function jsonDeserialize(array|string $data): static {
|
||||
if (is_string($data)) {
|
||||
$data = json_decode($data, true);
|
||||
}
|
||||
|
||||
$this->data = [];
|
||||
|
||||
if (isset($data[static::JSON_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");
|
||||
}
|
||||
$this->data[static::JSON_PROPERTY_COLLECTION] = $data[static::JSON_PROPERTY_COLLECTION];
|
||||
} else {
|
||||
$this->data[static::JSON_PROPERTY_COLLECTION] = null;
|
||||
}
|
||||
|
||||
if (isset($data[static::JSON_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");
|
||||
}
|
||||
$this->data[static::JSON_PROPERTY_IDENTIFIER] = $data[static::JSON_PROPERTY_IDENTIFIER];
|
||||
} else {
|
||||
$this->data[static::JSON_PROPERTY_IDENTIFIER] = null;
|
||||
}
|
||||
|
||||
if (isset($data[static::JSON_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");
|
||||
}
|
||||
$this->data[static::JSON_PROPERTY_SIGNATURE] = $data[static::JSON_PROPERTY_SIGNATURE];
|
||||
} else {
|
||||
$this->data[static::JSON_PROPERTY_SIGNATURE] = null;
|
||||
}
|
||||
|
||||
if (isset($data[static::JSON_PROPERTY_CREATED])) {
|
||||
if (!is_string($data[static::JSON_PROPERTY_CREATED])) {
|
||||
throw new \InvalidArgumentException("Created date must be a string in ISO 8601 format");
|
||||
}
|
||||
$this->data[static::JSON_PROPERTY_CREATED] = $data[static::JSON_PROPERTY_CREATED];
|
||||
} else {
|
||||
$this->data[static::JSON_PROPERTY_CREATED] = null;
|
||||
}
|
||||
|
||||
if (isset($data[static::JSON_PROPERTY_MODIFIED])) {
|
||||
if (!is_string($data[static::JSON_PROPERTY_MODIFIED])) {
|
||||
throw new \InvalidArgumentException("Modified date must be a string in ISO 8601 format");
|
||||
}
|
||||
$this->data[static::JSON_PROPERTY_MODIFIED] = $data[static::JSON_PROPERTY_MODIFIED];
|
||||
} else {
|
||||
$this->data[static::JSON_PROPERTY_MODIFIED] = null;
|
||||
}
|
||||
|
||||
if (isset($data[static::JSON_PROPERTY_PROPERTIES])) {
|
||||
if (!is_array($data[static::JSON_PROPERTY_PROPERTIES])) {
|
||||
throw new \InvalidArgumentException("Properties must be an array");
|
||||
}
|
||||
$this->getProperties()->jsonDeserialize($data[static::JSON_PROPERTY_PROPERTIES]);
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
abstract public function getProperties(): NodePropertiesMutableInterface;
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
abstract public function setProperties(NodePropertiesMutableInterface $value): static;
|
||||
}
|
||||
35
shared/lib/Resource/Provider/Node/NodeMutableInterface.php
Normal file
35
shared/lib/Resource/Provider/Node/NodeMutableInterface.php
Normal file
@@ -0,0 +1,35 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\Resource\Provider\Node;
|
||||
|
||||
use KTXF\Json\JsonDeserializable;
|
||||
|
||||
/**
|
||||
* Node Mutable Write Interface
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
interface NodeMutableInterface extends NodeBaseInterface, JsonDeserializable {
|
||||
|
||||
/**
|
||||
* Get the node properties
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function getProperties(): NodePropertiesMutableInterface;
|
||||
|
||||
/**
|
||||
* Sets the node properties
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function setProperties(NodePropertiesMutableInterface $value): static;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\Resource\Provider\Node;
|
||||
|
||||
/**
|
||||
* Abstract Node Properties Base Class
|
||||
*
|
||||
* Provides common implementation for node properties
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
abstract class NodePropertiesBaseAbstract implements NodePropertiesBaseInterface {
|
||||
|
||||
protected array $data = [];
|
||||
|
||||
public function __construct(array $data) {
|
||||
|
||||
if (!isset($data[static::JSON_PROPERTY_TYPE])) {
|
||||
$data[static::JSON_PROPERTY_TYPE] = static::JSON_TYPE;
|
||||
}
|
||||
|
||||
if (!isset($data[static::JSON_PROPERTY_VERSION])) {
|
||||
$data[static::JSON_PROPERTY_VERSION] = 1;
|
||||
}
|
||||
|
||||
$this->data = $data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function jsonSerialize(): array {
|
||||
return $this->data;
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function type(): string {
|
||||
return $this->data[static::JSON_PROPERTY_TYPE];
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function version(): int {
|
||||
return $this->data[static::JSON_PROPERTY_VERSION];
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\Resource\Provider\Node;
|
||||
|
||||
use JsonSerializable;
|
||||
|
||||
/**
|
||||
* Resource Node Properties Read Interface
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
interface NodePropertiesBaseInterface extends JsonSerializable {
|
||||
|
||||
public const RESOURCE_TYPE = 'resource.data';
|
||||
|
||||
public const JSON_TYPE = 'resource.data';
|
||||
public const JSON_PROPERTY_TYPE = '@type';
|
||||
public const JSON_PROPERTY_VERSION = 'version';
|
||||
|
||||
/**
|
||||
* Get resource node properties type
|
||||
*/
|
||||
public function type(): string;
|
||||
|
||||
/**
|
||||
* Get resource node properties version
|
||||
*/
|
||||
public function version(): int;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\Resource\Provider\Node;
|
||||
|
||||
/**
|
||||
* Abstract Node Properties Mutable Class
|
||||
*
|
||||
* Provides common implementation for mutable node properties
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
abstract class NodePropertiesMutableAbstract extends NodePropertiesBaseAbstract implements NodePropertiesMutableInterface {
|
||||
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
public function jsonDeserialize(array|string $data): static {
|
||||
if (is_string($data)) {
|
||||
$data = json_decode($data, true);
|
||||
}
|
||||
|
||||
$this->data = $data;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\Resource\Provider\Node;
|
||||
|
||||
use KTXF\Json\JsonDeserializable;
|
||||
|
||||
/**
|
||||
* Resource Node Properties Mutable Interface
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
interface NodePropertiesMutableInterface extends NodePropertiesBaseInterface, JsonDeserializable {
|
||||
|
||||
}
|
||||
44
shared/lib/Resource/Provider/ProviderInterface.php
Normal file
44
shared/lib/Resource/Provider/ProviderInterface.php
Normal file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace KTXF\Resource\Provider;
|
||||
|
||||
/**
|
||||
* Resource Provider Interface
|
||||
*/
|
||||
interface ProviderInterface
|
||||
{
|
||||
|
||||
public const TYPE_AUTHENTICATION = 'authentication';
|
||||
public const TYPE_PEOPLE = 'people';
|
||||
public const TYPE_CHRONO = 'chrono';
|
||||
public const TYPE_FILES = 'files';
|
||||
public const TYPE_MAIL = 'mail';
|
||||
|
||||
/**
|
||||
* Provider type (e.g., 'authentication', 'storage', 'notification')
|
||||
*/
|
||||
public function type(): string;
|
||||
|
||||
/**
|
||||
* Unique identifier for this provider instance (e.g., UUID or 'password-auth')
|
||||
*/
|
||||
public function identifier(): string;
|
||||
|
||||
/**
|
||||
* Human-friendly name (e.g., 'Password Authentication Provider', 'S3 Storage Provider')
|
||||
*/
|
||||
public function label(): string;
|
||||
|
||||
/**
|
||||
* human-friendly description of this provider's functionality
|
||||
*/
|
||||
public function description(): string;
|
||||
|
||||
/**
|
||||
* Icon representing this provider (e.g., FontAwesome class)
|
||||
*/
|
||||
public function icon(): string;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace KTXF\Resource\Provider;
|
||||
|
||||
use KTXF\Json\JsonSerializable;
|
||||
|
||||
/**
|
||||
* Resource Provider Interface
|
||||
*/
|
||||
interface ResourceProviderBaseInterface extends ProviderInterface, JsonSerializable
|
||||
{
|
||||
public const CAPABILITY_SERVICE_LIST = 'ServiceList';
|
||||
public const CAPABILITY_SERVICE_FETCH = 'ServiceFetch';
|
||||
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_PROPERTY_TYPE = '@type';
|
||||
public const JSON_PROPERTY_IDENTIFIER = 'identifier';
|
||||
public const JSON_PROPERTY_LABEL = 'label';
|
||||
public const JSON_PROPERTY_CAPABILITIES = 'capabilities';
|
||||
|
||||
/**
|
||||
* Confirms if specific capability is supported (e.g. 'ServiceList')
|
||||
*
|
||||
* @since 2025.11.01
|
||||
*/
|
||||
public function capable(string $value): bool;
|
||||
|
||||
/**
|
||||
* Lists all supported capabilities
|
||||
*
|
||||
* @since 2025.11.01
|
||||
*
|
||||
* @return array<string,bool>
|
||||
*/
|
||||
public function capabilities(): array;
|
||||
|
||||
/**
|
||||
* Retrieve collection of services for a specific user
|
||||
*
|
||||
* @since 2025.11.01
|
||||
*
|
||||
* @param string $tenantId tenant identifier
|
||||
* @param string $userId user identifier
|
||||
* @param array $filter filter criteria
|
||||
*
|
||||
* @return array<string,ResourceServiceBaseInterface> collection of service objects
|
||||
*/
|
||||
public function serviceList(string $tenantId, string $userId, array $filter): array;
|
||||
|
||||
/**
|
||||
* Determine if any services are configured for a specific user
|
||||
*
|
||||
* @since 2025.11.01
|
||||
*
|
||||
* @param string $tenantId tenant identifier
|
||||
* @param string $userId user identifier
|
||||
* @param int|string ...$identifiers variadic collection of service identifiers
|
||||
*
|
||||
* @return array<string,bool> collection of service identifiers with boolean values indicating if the service is available
|
||||
*/
|
||||
public function serviceExtant(string $tenantId, string $userId, int|string ...$identifiers): array;
|
||||
|
||||
/**
|
||||
* Retrieve a service with a specific identifier
|
||||
*
|
||||
* @since 2025.11.01
|
||||
*
|
||||
* @param string $tenantId tenant identifier
|
||||
* @param string $userId user identifier
|
||||
* @param string|int $identifier service identifier
|
||||
*
|
||||
* @return ResourceServiceBaseInterface|null returns service object or null if non found
|
||||
*/
|
||||
public function serviceFetch(string $tenantId, string $userId, string|int $identifier): ?ResourceServiceBaseInterface;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\Resource\Provider;
|
||||
|
||||
use KTXF\Json\JsonDeserializable;
|
||||
|
||||
interface ResourceProviderServiceMutateInterface extends ResourceProviderBaseInterface, JsonDeserializable {
|
||||
|
||||
/**
|
||||
* construct and new blank service instance
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function serviceFresh(): ResourceServiceMutateInterface;
|
||||
|
||||
/**
|
||||
* create a service configuration for a specific user
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function serviceCreate(string $tenantId, string $userId, ResourceServiceMutateInterface $service): string;
|
||||
|
||||
/**
|
||||
* modify a service configuration for a specific user
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function serviceModify(string $tenantId, string $userId, ResourceServiceMutateInterface $service): string;
|
||||
|
||||
/**
|
||||
* delete a service configuration for a specific user
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function serviceDestroy(string $tenantId, string $userId, ResourceServiceMutateInterface $service): bool;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace KTXF\Resource\Provider;
|
||||
|
||||
use KTXF\Json\JsonSerializable;
|
||||
|
||||
interface ResourceServiceBaseInterface extends JsonSerializable {
|
||||
|
||||
// JSON Constants
|
||||
public const JSON_TYPE = 'resource.service';
|
||||
public const JSON_PROPERTY_TYPE = '@type';
|
||||
public const JSON_PROPERTY_PROVIDER = 'provider';
|
||||
public const JSON_PROPERTY_IDENTIFIER = 'identifier';
|
||||
public const JSON_PROPERTY_LABEL = 'label';
|
||||
public const JSON_PROPERTY_ENABLED = 'enabled';
|
||||
public const JSON_PROPERTY_CAPABILITIES = 'capabilities';
|
||||
public const JSON_PROPERTY_LOCATION = 'location';
|
||||
public const JSON_PROPERTY_IDENTITY = 'identity';
|
||||
public const JSON_PROPERTY_AUXILIARY = 'auxiliary';
|
||||
|
||||
/**
|
||||
* Confirms if specific capability is supported
|
||||
*
|
||||
* @since 2025.11.01
|
||||
*
|
||||
* @param string $value required ability e.g. 'EntityList'
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function capable(string $value): bool;
|
||||
|
||||
/**
|
||||
* Lists all supported capabilities
|
||||
*
|
||||
* @since 2025.11.01
|
||||
*
|
||||
* @return array<string,bool>
|
||||
*/
|
||||
public function capabilities(): array;
|
||||
|
||||
/**
|
||||
* Unique identifier of the provider this service belongs to
|
||||
*
|
||||
* @since 2025.11.01
|
||||
*/
|
||||
public function provider(): string;
|
||||
|
||||
/**
|
||||
* Unique arbitrary text string identifying this service (e.g. 1 or service1 or anything else)
|
||||
*
|
||||
* @since 2025.11.01
|
||||
*/
|
||||
public function identifier(): string|int;
|
||||
|
||||
/**
|
||||
* Gets the localized human friendly name of this service (e.g. ACME Company File Service)
|
||||
*
|
||||
* @since 2025.11.01
|
||||
*/
|
||||
public function getLabel(): string|null;
|
||||
|
||||
/**
|
||||
* Gets the active status of this service
|
||||
*
|
||||
* @since 2025.11.01
|
||||
*/
|
||||
public function getEnabled(): bool;
|
||||
|
||||
/**
|
||||
* Gets the location information of this service
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @return ResourceServiceLocationInterface
|
||||
*/
|
||||
public function getLocation(): ResourceServiceLocationInterface;
|
||||
|
||||
/**
|
||||
* Gets the identity information of this service
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @return ResourceServiceIdentityInterface
|
||||
*/
|
||||
public function getIdentity(): ResourceServiceIdentityInterface;
|
||||
|
||||
/**
|
||||
* Gets the auxiliary information of this service
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getAuxiliary(): array;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\Resource\Provider;
|
||||
|
||||
/**
|
||||
* Resource Service Configurable Interface
|
||||
*
|
||||
* Extends base service interface with setter methods for mutable properties.
|
||||
* Used for service configuration and updates.
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
interface ResourceServiceConfigureInterface extends ResourceServiceMutateInterface {
|
||||
|
||||
/**
|
||||
* Sets the location/configuration of this service
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @param ResourceServiceLocationInterface $value Service location/configuration
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setLocation(ResourceServiceLocationInterface $value): self;
|
||||
|
||||
/**
|
||||
* Gets a fresh instance of the location/configuration of this service
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @return ResourceServiceLocationInterface
|
||||
*/
|
||||
public function freshLocation(string|null $type, array $data = []): ResourceServiceLocationInterface;
|
||||
|
||||
/**
|
||||
* Sets the identity used for this service
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @param ResourceServiceIdentityInterface $value Service identity
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setIdentity(ResourceServiceIdentityInterface $value): self;
|
||||
|
||||
/**
|
||||
* Gets a fresh instance of the identity used for this service
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @return ResourceServiceIdentityInterface
|
||||
*/
|
||||
public function freshIdentity(string|null $type, array $data = []): ResourceServiceIdentityInterface;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\Resource\Provider;
|
||||
|
||||
/**
|
||||
* Resource Service Identity Basic
|
||||
*
|
||||
* Basic authentication (username/password) credentials for resource services.
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
interface ResourceServiceIdentityBasic extends ResourceServiceIdentityInterface {
|
||||
|
||||
/**
|
||||
* Gets the identity/username
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getIdentity(): string;
|
||||
|
||||
/**
|
||||
* Sets the identity/username
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setIdentity(string $value): void;
|
||||
|
||||
/**
|
||||
* Gets the secret/password
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSecret(): string;
|
||||
|
||||
/**
|
||||
* Sets the secret/password
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setSecret(string $value): void;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\Resource\Provider;
|
||||
|
||||
/**
|
||||
* Resource Service Identity Certificate
|
||||
*
|
||||
* Client certificate authentication credentials for resource services.
|
||||
* Uses X.509 certificates for mutual TLS (mTLS) authentication.
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
interface ResourceServiceIdentityCertificate extends ResourceServiceIdentityInterface {
|
||||
|
||||
/**
|
||||
* Gets the certificate file path or content
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @return string Path to certificate file or PEM-encoded certificate
|
||||
*/
|
||||
public function getCertificate(): string;
|
||||
|
||||
/**
|
||||
* Sets the certificate file path or content
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @param string $value Path to certificate file or PEM-encoded certificate
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setCertificate(string $value): void;
|
||||
|
||||
/**
|
||||
* Gets the private key file path or content
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @return string Path to private key file or PEM-encoded private key
|
||||
*/
|
||||
public function getPrivateKey(): string;
|
||||
|
||||
/**
|
||||
* Sets the private key file path or content
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @param string $value Path to private key file or PEM-encoded private key
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setPrivateKey(string $value): void;
|
||||
|
||||
/**
|
||||
* Gets the private key passphrase (if encrypted)
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @return string|null Passphrase for encrypted private key, or null if not encrypted
|
||||
*/
|
||||
public function getPassphrase(): ?string;
|
||||
|
||||
/**
|
||||
* Sets the private key passphrase (if encrypted)
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @param string|null $value Passphrase for encrypted private key
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setPassphrase(?string $value): void;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\Resource\Provider;
|
||||
|
||||
use KTXF\Json\JsonSerializable;
|
||||
|
||||
/**
|
||||
* Resource Service Identity Interface
|
||||
*
|
||||
* Base interface for authentication credentials used by resource services.
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
interface ResourceServiceIdentityInterface extends JsonSerializable {
|
||||
|
||||
public const TYPE_NONE = 'NA';
|
||||
public const TYPE_BASIC = 'BA';
|
||||
public const TYPE_TOKEN = 'TA';
|
||||
public const TYPE_OAUTH = 'OA';
|
||||
public const TYPE_CERTIFICATE = 'CC';
|
||||
|
||||
/**
|
||||
* Gets the identity/authentication type
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @return string One of: TYPE_NONE, TYPE_BASIC, TYPE_TOKEN, TYPE_OAUTH, TYPE_CERTIFICATE
|
||||
*/
|
||||
public function type(): string;
|
||||
|
||||
}
|
||||
121
shared/lib/Resource/Provider/ResourceServiceIdentityOAuth.php
Normal file
121
shared/lib/Resource/Provider/ResourceServiceIdentityOAuth.php
Normal file
@@ -0,0 +1,121 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\Resource\Provider;
|
||||
|
||||
/**
|
||||
* Resource Service Identity OAuth
|
||||
*
|
||||
* OAuth authentication credentials for resource services, including token management.
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
interface ResourceServiceIdentityOAuth extends ResourceServiceIdentityInterface {
|
||||
|
||||
/**
|
||||
* Gets the access token
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getAccessToken(): string;
|
||||
|
||||
/**
|
||||
* Sets the access token
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setAccessToken(string $value): void;
|
||||
|
||||
/**
|
||||
* Gets the access token scope
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getAccessScope(): array;
|
||||
|
||||
/**
|
||||
* Sets the access token scope
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @param array $value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setAccessScope(array $value): void;
|
||||
|
||||
/**
|
||||
* Gets the access token expiry timestamp
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @return int Unix timestamp
|
||||
*/
|
||||
public function getAccessExpiry(): int;
|
||||
|
||||
/**
|
||||
* Sets the access token expiry timestamp
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @param int $value Unix timestamp
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setAccessExpiry(int $value): void;
|
||||
|
||||
/**
|
||||
* Gets the refresh token
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getRefreshToken(): string;
|
||||
|
||||
/**
|
||||
* Sets the refresh token
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setRefreshToken(string $value): void;
|
||||
|
||||
/**
|
||||
* Gets the token refresh location/endpoint
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getRefreshLocation(): string;
|
||||
|
||||
/**
|
||||
* Sets the token refresh location/endpoint
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setRefreshLocation(string $value): void;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\Resource\Provider;
|
||||
|
||||
/**
|
||||
* Resource Service Identity Token
|
||||
*
|
||||
* Token authentication credentials for resource services.
|
||||
* Uses a single static token/key for authentication.
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
interface ResourceServiceIdentityToken extends ResourceServiceIdentityInterface {
|
||||
|
||||
/**
|
||||
* Gets the authentication token
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getToken(): string;
|
||||
|
||||
/**
|
||||
* Sets the authentication token
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setToken(string $value): void;
|
||||
|
||||
}
|
||||
51
shared/lib/Resource/Provider/ResourceServiceLocationFile.php
Normal file
51
shared/lib/Resource/Provider/ResourceServiceLocationFile.php
Normal file
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\Resource\Provider;
|
||||
|
||||
/**
|
||||
* Resource Service Location File
|
||||
*
|
||||
* File-based service location for services using local or network file paths
|
||||
* (e.g., maildir, mbox, local storage).
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
interface ResourceServiceLocationFile extends ResourceServiceLocationInterface {
|
||||
|
||||
/**
|
||||
* Gets the complete file location path
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @return string File path (e.g., "/var/mail/user" or "\\server\share\mail")
|
||||
*/
|
||||
public function location(): string;
|
||||
|
||||
/**
|
||||
* Gets the file location path
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @return string File path
|
||||
*/
|
||||
public function getLocation(): string;
|
||||
|
||||
/**
|
||||
* Sets the file location path
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setLocation(string $value): void;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\Resource\Provider;
|
||||
|
||||
use JsonSerializable;
|
||||
|
||||
/**
|
||||
* Resource Service Location Interface
|
||||
*
|
||||
* Unified interface supporting both URI-based (API services) and socket-based
|
||||
* (traditional IMAP/SMTP) connection configurations.
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
interface ResourceServiceLocationInterface extends JsonSerializable {
|
||||
|
||||
public const TYPE_URI = 'URI';
|
||||
public const TYPE_SOCKET_SOLE = 'SOCKET_SOLE';
|
||||
public const TYPE_SOCKET_SPLIT = 'SOCKET_SPLIT';
|
||||
public const TYPE_FILE = 'FILE';
|
||||
|
||||
/**
|
||||
* Gets the service location type
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @return string One of: TYPE_URI, TYPE_SOCKET_SOLE, TYPE_SOCKET_SPLIT, TYPE_FILE
|
||||
*/
|
||||
public function type(): string;
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\Resource\Provider;
|
||||
|
||||
/**
|
||||
* Resource Service Location Socket Sole
|
||||
*
|
||||
* Single socket-based service location for services using a single host/port combination
|
||||
* (e.g., JMAP, unified mail servers).
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
interface ResourceServiceLocationSocketSole extends ResourceServiceLocationInterface {
|
||||
|
||||
/**
|
||||
* Gets the complete location string
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @return string Location (e.g., "mail.example.com:993")
|
||||
*/
|
||||
public function location(): string;
|
||||
|
||||
/**
|
||||
* Gets the host
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @return string Host (e.g., "mail.example.com")
|
||||
*/
|
||||
public function getHost(): string;
|
||||
|
||||
/**
|
||||
* Sets the host
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setHost(string $value): void;
|
||||
|
||||
/**
|
||||
* Gets the port
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @return int Port number
|
||||
*/
|
||||
public function getPort(): int;
|
||||
|
||||
/**
|
||||
* Sets the port
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @param int $value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setPort(int $value): void;
|
||||
|
||||
/**
|
||||
* Gets the encryption/security mode
|
||||
*
|
||||
* @since 2025.12.01
|
||||
*
|
||||
* @return string One of: 'none', 'ssl', 'tls', 'starttls'
|
||||
*/
|
||||
public function getEncryption(): string;
|
||||
|
||||
/**
|
||||
* Sets the encryption/security mode
|
||||
*
|
||||
* @since 2025.12.01
|
||||
*
|
||||
* @param string $value One of: 'none', 'ssl', 'tls', 'starttls'
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setEncryption(string $value): void;
|
||||
|
||||
/**
|
||||
* Gets whether to verify SSL/TLS peer certificate
|
||||
*
|
||||
* @since 2025.12.01
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getVerifyPeer(): bool;
|
||||
|
||||
/**
|
||||
* Sets whether to verify SSL/TLS peer certificate
|
||||
*
|
||||
* @since 2025.12.01
|
||||
*
|
||||
* @param bool $value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setVerifyPeer(bool $value): void;
|
||||
|
||||
/**
|
||||
* Gets whether to verify SSL/TLS certificate host
|
||||
*
|
||||
* @since 2025.12.01
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getVerifyHost(): bool;
|
||||
|
||||
/**
|
||||
* Sets whether to verify SSL/TLS certificate host
|
||||
*
|
||||
* @since 2025.12.01
|
||||
*
|
||||
* @param bool $value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setVerifyHost(bool $value): void;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,240 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\Resource\Provider;
|
||||
|
||||
/**
|
||||
* Resource Service Location Socket Split
|
||||
*
|
||||
* Split socket-based service location for services using separate inbound/outbound servers
|
||||
* (e.g., traditional IMAP/SMTP configurations).
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
interface ResourceServiceLocationSocketSplit extends ResourceServiceLocationInterface {
|
||||
|
||||
/**
|
||||
* Gets the complete inbound location string
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @return string Inbound location (e.g., "imap.example.com:993")
|
||||
*/
|
||||
public function locationInbound(): string;
|
||||
|
||||
/**
|
||||
* Gets the complete outbound location string
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @return string Outbound location (e.g., "smtp.example.com:465")
|
||||
*/
|
||||
public function locationOutbound(): string;
|
||||
|
||||
/**
|
||||
* Gets the inbound host
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @return string Inbound host (e.g., "imap.example.com")
|
||||
*/
|
||||
public function getInboundHost(): string;
|
||||
|
||||
/**
|
||||
* Sets the inbound host
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setInboundHost(string $value): void;
|
||||
|
||||
/**
|
||||
* Gets the outbound host
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @return string Outbound host (e.g., "smtp.example.com")
|
||||
*/
|
||||
public function getOutboundHost(): string;
|
||||
|
||||
/**
|
||||
* Sets the outbound host
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setOutboundHost(string $value): void;
|
||||
|
||||
/**
|
||||
* Gets the inbound port
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @return int Inbound port number
|
||||
*/
|
||||
public function getInboundPort(): int;
|
||||
|
||||
/**
|
||||
* Sets the inbound port
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @param int $value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setInboundPort(int $value): void;
|
||||
|
||||
/**
|
||||
* Gets the outbound port
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @return int Outbound port number
|
||||
*/
|
||||
public function getOutboundPort(): int;
|
||||
|
||||
/**
|
||||
* Sets the outbound port
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @param int $value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setOutboundPort(int $value): void;
|
||||
|
||||
/**
|
||||
* Gets the inbound encryption/security mode
|
||||
*
|
||||
* @since 2025.12.01
|
||||
*
|
||||
* @return string One of: 'none', 'ssl', 'tls', 'starttls'
|
||||
*/
|
||||
public function getInboundEncryption(): string;
|
||||
|
||||
/**
|
||||
* Sets the inbound encryption/security mode
|
||||
*
|
||||
* @since 2025.12.01
|
||||
*
|
||||
* @param string $value One of: 'none', 'ssl', 'tls', 'starttls'
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setInboundEncryption(string $value): void;
|
||||
|
||||
/**
|
||||
* Gets the outbound encryption/security mode
|
||||
*
|
||||
* @since 2025.12.01
|
||||
*
|
||||
* @return string One of: 'none', 'ssl', 'tls', 'starttls'
|
||||
*/
|
||||
public function getOutboundEncryption(): string;
|
||||
|
||||
/**
|
||||
* Sets the outbound encryption/security mode
|
||||
*
|
||||
* @since 2025.12.01
|
||||
*
|
||||
* @param string $value One of: 'none', 'ssl', 'tls', 'starttls'
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setOutboundEncryption(string $value): void;
|
||||
|
||||
/**
|
||||
* Gets whether to verify inbound SSL/TLS peer certificate
|
||||
*
|
||||
* @since 2025.12.01
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getInboundVerifyPeer(): bool;
|
||||
|
||||
/**
|
||||
* Sets whether to verify inbound SSL/TLS peer certificate
|
||||
*
|
||||
* @since 2025.12.01
|
||||
*
|
||||
* @param bool $value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setInboundVerifyPeer(bool $value): void;
|
||||
|
||||
/**
|
||||
* Gets whether to verify inbound SSL/TLS certificate host
|
||||
*
|
||||
* @since 2025.12.01
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getInboundVerifyHost(): bool;
|
||||
|
||||
/**
|
||||
* Sets whether to verify inbound SSL/TLS certificate host
|
||||
*
|
||||
* @since 2025.12.01
|
||||
*
|
||||
* @param bool $value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setInboundVerifyHost(bool $value): void;
|
||||
|
||||
/**
|
||||
* Gets whether to verify outbound SSL/TLS peer certificate
|
||||
*
|
||||
* @since 2025.12.01
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getOutboundVerifyPeer(): bool;
|
||||
|
||||
/**
|
||||
* Sets whether to verify outbound SSL/TLS peer certificate
|
||||
*
|
||||
* @since 2025.12.01
|
||||
*
|
||||
* @param bool $value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setOutboundVerifyPeer(bool $value): void;
|
||||
|
||||
/**
|
||||
* Gets whether to verify outbound SSL/TLS certificate host
|
||||
*
|
||||
* @since 2025.12.01
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getOutboundVerifyHost(): bool;
|
||||
|
||||
/**
|
||||
* Sets whether to verify outbound SSL/TLS certificate host
|
||||
*
|
||||
* @since 2025.12.01
|
||||
*
|
||||
* @param bool $value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setOutboundVerifyHost(bool $value): void;
|
||||
|
||||
}
|
||||
150
shared/lib/Resource/Provider/ResourceServiceLocationUri.php
Normal file
150
shared/lib/Resource/Provider/ResourceServiceLocationUri.php
Normal file
@@ -0,0 +1,150 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\Resource\Provider;
|
||||
|
||||
/**
|
||||
* Resource Service Location Uri
|
||||
*
|
||||
* URI-based service location for API and web services (e.g., https://api.example.com:443/v1/endpoint).
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
interface ResourceServiceLocationUri extends ResourceServiceLocationInterface {
|
||||
|
||||
/**
|
||||
* Gets the complete location URI
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @return string Complete URI (e.g., "https://api.example.com:443/v1")
|
||||
*/
|
||||
public function location(): string;
|
||||
|
||||
/**
|
||||
* Gets the URI scheme
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @return string Scheme (e.g., "https", "http")
|
||||
*/
|
||||
public function getScheme(): string;
|
||||
|
||||
/**
|
||||
* Sets the URI scheme
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setScheme(string $value): void;
|
||||
|
||||
/**
|
||||
* Gets the host
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @return string Host (e.g., "api.example.com")
|
||||
*/
|
||||
public function getHost(): string;
|
||||
|
||||
/**
|
||||
* Sets the host
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setHost(string $value): void;
|
||||
|
||||
/**
|
||||
* Gets the port
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @return int Port number
|
||||
*/
|
||||
public function getPort(): int;
|
||||
|
||||
/**
|
||||
* Sets the port
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @param int $value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setPort(int $value): void;
|
||||
|
||||
/**
|
||||
* Gets the path
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @return string Path (e.g., "/v1/api")
|
||||
*/
|
||||
public function getPath(): string;
|
||||
|
||||
/**
|
||||
* Sets the path
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @param string $value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setPath(string $value): void;
|
||||
|
||||
/**
|
||||
* Gets whether to verify SSL/TLS peer certificate
|
||||
*
|
||||
* @since 2025.12.01
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getVerifyPeer(): bool;
|
||||
|
||||
/**
|
||||
* Sets whether to verify SSL/TLS peer certificate
|
||||
*
|
||||
* @since 2025.12.01
|
||||
*
|
||||
* @param bool $value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setVerifyPeer(bool $value): void;
|
||||
|
||||
/**
|
||||
* Gets whether to verify SSL/TLS certificate host
|
||||
*
|
||||
* @since 2025.12.01
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function getVerifyHost(): bool;
|
||||
|
||||
/**
|
||||
* Sets whether to verify SSL/TLS certificate host
|
||||
*
|
||||
* @since 2025.12.01
|
||||
*
|
||||
* @param bool $value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function setVerifyHost(bool $value): void;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\Resource\Provider;
|
||||
|
||||
use KTXF\Json\JsonDeserializable;
|
||||
|
||||
/**
|
||||
* Resource Service Configurable Interface
|
||||
*
|
||||
* Extends base service interface with setter methods for mutable properties.
|
||||
* Used for service configuration and updates.
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
interface ResourceServiceMutateInterface extends ResourceServiceBaseInterface, JsonDeserializable {
|
||||
|
||||
/**
|
||||
* Sets the localized human-friendly name of this service (e.g. ACME Company Mail Service)
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @param string $value Service label
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setLabel(string $value): self;
|
||||
|
||||
/**
|
||||
* Sets the active status of this service
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @param bool $value True to enable, false to disable
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setEnabled(bool $value): self;
|
||||
|
||||
/**
|
||||
* Sets the auxiliary information of this service
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @param array $value Arbitrary key-value pairs for additional service info
|
||||
*
|
||||
* @return self
|
||||
*/
|
||||
public function setAuxiliary(array $value): self;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user