Initial Version
This commit is contained in:
24
shared/lib/People/Collection/CollectionContent.php
Normal file
24
shared/lib/People/Collection/CollectionContent.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\People\Collection;
|
||||
|
||||
use JsonSerializable;
|
||||
|
||||
enum CollectionContent: string implements JsonSerializable {
|
||||
|
||||
case Individual = 'individual';
|
||||
case Organization = 'organization';
|
||||
case Group = 'group';
|
||||
|
||||
public function jsonSerialize(): string {
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
}
|
||||
26
shared/lib/People/Collection/CollectionPermissions.php
Normal file
26
shared/lib/People/Collection/CollectionPermissions.php
Normal file
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\People\Collection;
|
||||
|
||||
use JsonSerializable;
|
||||
|
||||
enum CollectionPermissions: string implements JsonSerializable {
|
||||
|
||||
case View = 'view';
|
||||
case Create = 'create';
|
||||
case Modify = 'modify';
|
||||
case Destroy = 'destroy';
|
||||
case Share = 'share';
|
||||
|
||||
public function jsonSerialize(): string {
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
}
|
||||
24
shared/lib/People/Collection/CollectionRoles.php
Normal file
24
shared/lib/People/Collection/CollectionRoles.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\People\Collection;
|
||||
|
||||
use JsonSerializable;
|
||||
|
||||
enum CollectionRoles: string implements JsonSerializable {
|
||||
|
||||
case System = 'system';
|
||||
case Individual = 'individual';
|
||||
case Recent = 'recent';
|
||||
|
||||
public function jsonSerialize(): string {
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
}
|
||||
160
shared/lib/People/Collection/ICollectionBase.php
Normal file
160
shared/lib/People/Collection/ICollectionBase.php
Normal file
@@ -0,0 +1,160 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\People\Collection;
|
||||
|
||||
use DateTimeImmutable;
|
||||
use JsonSerializable;
|
||||
|
||||
interface ICollectionBase extends JsonSerializable {
|
||||
|
||||
public const JSON_TYPE = 'people.collection';
|
||||
public const JSON_PROPERTY_TYPE = '@type';
|
||||
public const JSON_PROPERTY_PROVIDER = 'provider';
|
||||
public const JSON_PROPERTY_SERVICE = 'service';
|
||||
public const JSON_PROPERTY_IN = 'in';
|
||||
public const JSON_PROPERTY_ID = 'id';
|
||||
public const JSON_PROPERTY_LABEL = 'label';
|
||||
public const JSON_PROPERTY_DESCRIPTION = 'description';
|
||||
public const JSON_PROPERTY_PRIORITY = 'priority';
|
||||
public const JSON_PROPERTY_VISIBILITY = 'visibility';
|
||||
public const JSON_PROPERTY_COLOR = 'color';
|
||||
public const JSON_PROPERTY_CREATED = 'created';
|
||||
public const JSON_PROPERTY_MODIFIED = 'modified';
|
||||
public const JSON_PROPERTY_ENABLED = 'enabled';
|
||||
public const JSON_PROPERTY_SIGNATURE = 'signature';
|
||||
public const JSON_PROPERTY_PERMISSIONS = 'permissions';
|
||||
public const JSON_PROPERTY_ROLES = 'roles';
|
||||
public const JSON_PROPERTY_CONTENTS = 'contents';
|
||||
|
||||
/**
|
||||
* Unique identifier of the service this collection belongs to
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function in(): string|int|null;
|
||||
|
||||
/**
|
||||
* Unique arbitrary text string identifying this service (e.g. 1 or collection1 or anything else)
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function id(): string|int;
|
||||
|
||||
/**
|
||||
* Gets the creation date of this collection
|
||||
*/
|
||||
public function created(): ?DateTimeImmutable;
|
||||
|
||||
/**
|
||||
* Gets the modification date of this collection
|
||||
*/
|
||||
public function modified(): ?DateTimeImmutable;
|
||||
|
||||
/**
|
||||
* Lists all supported attributes
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @return array<string,array<string,bool>>
|
||||
*/
|
||||
public function attributes(): array;
|
||||
|
||||
/**
|
||||
* Gets the signature of this collection
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function signature(): ?string;
|
||||
|
||||
/**
|
||||
* Gets the role(s) of this collection
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function roles(): array;
|
||||
|
||||
/**
|
||||
* Checks if this collection supports the given role
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function role(CollectionRoles $value): bool;
|
||||
|
||||
/**
|
||||
* Gets the content types of this collection
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function contents(): array;
|
||||
|
||||
/**
|
||||
* Checks if this collection contains the given content type
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function contains(CollectionContent $value): bool;
|
||||
|
||||
/**
|
||||
* Gets the active status of this collection
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function getEnabled(): bool;
|
||||
|
||||
/**
|
||||
* Gets the active status of this collection
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function getPermissions(): array;
|
||||
|
||||
/**
|
||||
* Checks if this collection has the given permission
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function hasPermission(CollectionPermissions $permission): bool;
|
||||
|
||||
/**
|
||||
* Gets the human friendly name of this collection (e.g. Personal Contacts)
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function getLabel(): ?string;
|
||||
|
||||
/**
|
||||
* Gets the human friendly description of this collection
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function getDescription(): ?string;
|
||||
|
||||
/**
|
||||
* Gets the priority of this collection
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function getPriority(): ?int;
|
||||
|
||||
/**
|
||||
* Gets the visibility of this collection
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function getVisibility(): ?bool;
|
||||
|
||||
/**
|
||||
* Gets the color of this collection
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function getColor(): ?string;
|
||||
|
||||
}
|
||||
58
shared/lib/People/Collection/ICollectionMutable.php
Normal file
58
shared/lib/People/Collection/ICollectionMutable.php
Normal file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\People\Collection;
|
||||
|
||||
use KTXF\Json\JsonDeserializable;
|
||||
|
||||
interface ICollectionMutable extends ICollectionBase, JsonDeserializable {
|
||||
|
||||
/**
|
||||
* Sets the active status of this collection
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function setEnabled(bool $value): self;
|
||||
|
||||
/**
|
||||
* Sets the human friendly name of this collection (e.g. Personal Contacts)
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function setLabel(string $value): self;
|
||||
|
||||
/**
|
||||
* Sets the human friendly description of this collection
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function setDescription(?string $value): self;
|
||||
|
||||
/**
|
||||
* Sets the priority of this collection
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function setPriority(?int $value): self;
|
||||
|
||||
/**
|
||||
* Sets the visibility of this collection
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function setVisibility(?bool $value): self;
|
||||
|
||||
/**
|
||||
* Sets the color of this collection
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function setColor(?string $value): self;
|
||||
|
||||
}
|
||||
25
shared/lib/People/Entity/EntityPermissions.php
Normal file
25
shared/lib/People/Entity/EntityPermissions.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\People\Entity;
|
||||
|
||||
use JsonSerializable;
|
||||
|
||||
enum EntityPermissions: string implements JsonSerializable {
|
||||
|
||||
case View = 'view';
|
||||
case Modify = 'modify';
|
||||
case Delete = 'delete';
|
||||
case Share = 'share';
|
||||
|
||||
public function jsonSerialize(): string {
|
||||
return $this->value;
|
||||
}
|
||||
|
||||
}
|
||||
94
shared/lib/People/Entity/IEntityBase.php
Normal file
94
shared/lib/People/Entity/IEntityBase.php
Normal file
@@ -0,0 +1,94 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\People\Entity;
|
||||
|
||||
use DateTimeImmutable;
|
||||
use KTXF\People\Entity\Individual\IndividualObject;
|
||||
|
||||
interface IEntityBase extends \JsonSerializable {
|
||||
|
||||
public const JSON_TYPE = 'people.entity';
|
||||
public const JSON_PROPERTY_TYPE = '@type';
|
||||
public const JSON_PROPERTY_IN = 'in';
|
||||
public const JSON_PROPERTY_ID = 'id';
|
||||
public const JSON_PROPERTY_DATA = 'data';
|
||||
public const JSON_PROPERTY_CREATED = 'created';
|
||||
public const JSON_PROPERTY_MODIFIED = 'modified';
|
||||
public const JSON_PROPERTY_SIGNATURE = 'signature';
|
||||
|
||||
/**
|
||||
* Unique arbitrary text string identifying the collection this entity belongs to (e.g. 1 or Collection1 or anything else)
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function in(): string|int;
|
||||
|
||||
/**
|
||||
* Unique arbitrary text string identifying this service (e.g. 1 or Entity or anything else)
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function id(): string|int;
|
||||
|
||||
/**
|
||||
* Gets the creation date of this entity
|
||||
*/
|
||||
public function created(): ?DateTimeImmutable;
|
||||
|
||||
/**
|
||||
* Gets the modification date of this entity
|
||||
*/
|
||||
public function modified(): ?DateTimeImmutable;
|
||||
|
||||
/**
|
||||
* Gets the signature of this entity
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function signature(): ?string;
|
||||
|
||||
/**
|
||||
* Gets the priority of this entity
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function getPriority(): ?int;
|
||||
|
||||
/**
|
||||
* Gets the visibility of this entity
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function getVisibility(): ?bool;
|
||||
|
||||
/**
|
||||
* Gets the color of this entity
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function getColor(): ?string;
|
||||
|
||||
/**
|
||||
* Gets the object as a class instance.
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function getDataObject(): IndividualObject|null;
|
||||
|
||||
/**
|
||||
* Gets the raw data as an associative array or JSON string.
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @return array|string|null
|
||||
*/
|
||||
public function getDataJson(): array|string|null;
|
||||
|
||||
}
|
||||
52
shared/lib/People/Entity/IEntityMutable.php
Normal file
52
shared/lib/People/Entity/IEntityMutable.php
Normal file
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\People\Entity;
|
||||
|
||||
use KTXF\Json\JsonDeserializable;
|
||||
use KTXF\People\Entity\Individual\IndividualObject;
|
||||
|
||||
interface IEntityMutable extends IEntityBase, JsonDeserializable {
|
||||
|
||||
/**
|
||||
* Sets the priority of this entity
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function setPriority(?int $value): static;
|
||||
|
||||
/**
|
||||
* Sets the visibility of this entity
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function setVisibility(?bool $value): static;
|
||||
|
||||
/**
|
||||
* Sets the color of this entity
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function setColor(?string $value): static;
|
||||
|
||||
/**
|
||||
* Sets the object as a class instance.
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function setDataObject(IndividualObject $value): static;
|
||||
|
||||
/**
|
||||
* Sets the object data from a json string
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function setDataJson(array|string $value): static;
|
||||
|
||||
}
|
||||
20
shared/lib/People/Individual/IndividualAliasCollection.php
Normal file
20
shared/lib/People/Individual/IndividualAliasCollection.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\People\Entity\Individual;
|
||||
|
||||
use KTXF\Json\JsonSerializableCollection;
|
||||
|
||||
class IndividualAliasCollection extends JsonSerializableCollection {
|
||||
|
||||
public function __construct(array $data = []) {
|
||||
parent::__construct($data, IndividualAliasObject::class);
|
||||
}
|
||||
|
||||
}
|
||||
20
shared/lib/People/Individual/IndividualAliasObject.php
Normal file
20
shared/lib/People/Individual/IndividualAliasObject.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\People\Entity\Individual;
|
||||
|
||||
use KTXF\Json\JsonSerializableObject;
|
||||
|
||||
class IndividualAliasObject extends JsonSerializableObject {
|
||||
|
||||
public string|null $label = null;
|
||||
public string|null $context = null;
|
||||
public int|null $priority = null;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\People\Entity\Individual;
|
||||
|
||||
use KTXF\Json\JsonSerializableCollection;
|
||||
|
||||
class IndividualAnniversaryCollection extends JsonSerializableCollection {
|
||||
|
||||
public function __construct(array $data = []) {
|
||||
parent::__construct($data, IndividualAnniversaryObject::class);
|
||||
}
|
||||
|
||||
}
|
||||
21
shared/lib/People/Individual/IndividualAnniversaryObject.php
Normal file
21
shared/lib/People/Individual/IndividualAnniversaryObject.php
Normal file
@@ -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\People\Entity\Individual;
|
||||
|
||||
use DateTimeInterface;
|
||||
use KTXF\Json\JsonSerializableObject;
|
||||
|
||||
class IndividualAnniversaryObject extends JsonSerializableObject {
|
||||
|
||||
public IndividualAnniversaryTypes|null $type = null;
|
||||
public DateTimeInterface|null $when = null;
|
||||
public string|null $location = null;
|
||||
|
||||
}
|
||||
16
shared/lib/People/Individual/IndividualAnniversaryTypes.php
Normal file
16
shared/lib/People/Individual/IndividualAnniversaryTypes.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\People\Entity\Individual;
|
||||
|
||||
enum IndividualAnniversaryTypes: string {
|
||||
case Birth = 'birth';
|
||||
case Death = 'death';
|
||||
case Nuptial = 'nuptial';
|
||||
}
|
||||
20
shared/lib/People/Individual/IndividualCryptoCollection.php
Normal file
20
shared/lib/People/Individual/IndividualCryptoCollection.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\People\Entity\Individual;
|
||||
|
||||
use KTXF\Json\JsonSerializableCollection;
|
||||
|
||||
class IndividualCryptoCollection extends JsonSerializableCollection {
|
||||
|
||||
public function __construct(array $data = []) {
|
||||
parent::__construct($data, IndividualCryptoObject::class, 'string');
|
||||
}
|
||||
|
||||
}
|
||||
21
shared/lib/People/Individual/IndividualCryptoObject.php
Normal file
21
shared/lib/People/Individual/IndividualCryptoObject.php
Normal file
@@ -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\People\Entity\Individual;
|
||||
|
||||
use KTXF\Json\JsonSerializableObject;
|
||||
|
||||
class IndividualCryptoObject extends JsonSerializableObject {
|
||||
|
||||
public string|null $data = null;
|
||||
public string|null $type = null;
|
||||
public string|null $context = null;
|
||||
public int|null $priority = null;
|
||||
|
||||
}
|
||||
20
shared/lib/People/Individual/IndividualEmailCollection.php
Normal file
20
shared/lib/People/Individual/IndividualEmailCollection.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\People\Entity\Individual;
|
||||
|
||||
use KTXF\Json\JsonSerializableCollection;
|
||||
|
||||
class IndividualEmailCollection extends JsonSerializableCollection {
|
||||
|
||||
public function __construct(array $data = []) {
|
||||
parent::__construct($data, IndividualEmailObject::class, 'string');
|
||||
}
|
||||
|
||||
}
|
||||
20
shared/lib/People/Individual/IndividualEmailObject.php
Normal file
20
shared/lib/People/Individual/IndividualEmailObject.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\People\Entity\Individual;
|
||||
|
||||
use KTXF\Json\JsonSerializableObject;
|
||||
|
||||
class IndividualEmailObject extends JsonSerializableObject {
|
||||
|
||||
public string|null $address = null;
|
||||
public string|null $context = null;
|
||||
public int|null $priority = null;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\People\Entity\Individual;
|
||||
|
||||
use KTXF\Json\JsonSerializableCollection;
|
||||
|
||||
class IndividualLanguageCollection extends JsonSerializableCollection {
|
||||
public function __construct(array $data = []) {
|
||||
parent::__construct($data, IndividualLanguageObject::class);
|
||||
}
|
||||
}
|
||||
22
shared/lib/People/Individual/IndividualLanguageObject.php
Normal file
22
shared/lib/People/Individual/IndividualLanguageObject.php
Normal file
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\People\Entity\Individual;
|
||||
|
||||
use KTXF\Json\JsonSerializableObject;
|
||||
|
||||
class IndividualLanguageObject extends JsonSerializableObject {
|
||||
|
||||
public string|null $Data = null;
|
||||
|
||||
public string|null $Id = null;
|
||||
public int|null $Priority = null;
|
||||
public string|null $Context = null;
|
||||
|
||||
}
|
||||
20
shared/lib/People/Individual/IndividualMediaCollection.php
Normal file
20
shared/lib/People/Individual/IndividualMediaCollection.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\People\Entity\Individual;
|
||||
|
||||
use KTXF\Json\JsonSerializableCollection;
|
||||
|
||||
class IndividualMediaCollection extends JsonSerializableCollection {
|
||||
|
||||
public function __construct(array $data = []) {
|
||||
parent::__construct($data, IndividualMediaObject::class, 'string');
|
||||
}
|
||||
|
||||
}
|
||||
24
shared/lib/People/Individual/IndividualMediaObject.php
Normal file
24
shared/lib/People/Individual/IndividualMediaObject.php
Normal file
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\People\Entity\Individual;
|
||||
|
||||
use KTXF\Json\JsonSerializableObject;
|
||||
|
||||
class IndividualMediaObject extends JsonSerializableObject {
|
||||
|
||||
public string $type = 'Media';
|
||||
public string $kind;
|
||||
public string $uri;
|
||||
public string|null $mediaType = null;
|
||||
public array|null $contexts = null;
|
||||
public int|null $pref = null;
|
||||
public string|null $label = null;
|
||||
|
||||
}
|
||||
30
shared/lib/People/Individual/IndividualNameObject.php
Normal file
30
shared/lib/People/Individual/IndividualNameObject.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\People\Entity\Individual;
|
||||
|
||||
use KTXF\Json\JsonSerializableObject;
|
||||
|
||||
class IndividualNameObject extends JsonSerializableObject {
|
||||
|
||||
public string|null $family = null;
|
||||
public string|null $given = null;
|
||||
public string|null $additional = null;
|
||||
public string|null $prefix = null;
|
||||
public string|null $suffix = null;
|
||||
public string|null $phoneticFamily = null;
|
||||
public string|null $phoneticGiven = null;
|
||||
public string|null $phoneticAdditional = null;
|
||||
public IndividualAliasCollection $aliases;
|
||||
|
||||
public function __construct() {
|
||||
$this->aliases = new IndividualAliasCollection();
|
||||
}
|
||||
|
||||
}
|
||||
20
shared/lib/People/Individual/IndividualNoteCollection.php
Normal file
20
shared/lib/People/Individual/IndividualNoteCollection.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\People\Entity\Individual;
|
||||
|
||||
use KTXF\Json\JsonSerializableCollection;
|
||||
|
||||
class IndividualNoteCollection extends JsonSerializableCollection {
|
||||
|
||||
public function __construct(array $data = []) {
|
||||
parent::__construct($data, IndividualNoteObject::class, 'string');
|
||||
}
|
||||
|
||||
}
|
||||
25
shared/lib/People/Individual/IndividualNoteObject.php
Normal file
25
shared/lib/People/Individual/IndividualNoteObject.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\People\Entity\Individual;
|
||||
|
||||
use DateTimeInterface;
|
||||
use KTXF\Json\JsonSerializableObject;
|
||||
|
||||
class IndividualNoteObject extends JsonSerializableObject {
|
||||
|
||||
public string|null $content = null;
|
||||
public DateTimeInterface|null $date = null;
|
||||
public string|null $authorUri = null;
|
||||
public string|null $authorName = null;
|
||||
|
||||
public string|null $context = null;
|
||||
public int|null $priority = null;
|
||||
|
||||
}
|
||||
62
shared/lib/People/Individual/IndividualObject.php
Normal file
62
shared/lib/People/Individual/IndividualObject.php
Normal file
@@ -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\People\Entity\Individual;
|
||||
|
||||
use DateTimeInterface;
|
||||
use KTXF\Json\JsonSerializableObject;
|
||||
|
||||
class IndividualObject extends JsonSerializableObject {
|
||||
|
||||
// Meta Information
|
||||
public string $type = 'individual';
|
||||
public int $version = 1;
|
||||
public string|null $urid = null;
|
||||
public ?DateTimeInterface $created = null;
|
||||
public ?DateTimeInterface $modified = null;
|
||||
// Personal Information
|
||||
public string|null $label = null;
|
||||
public IndividualNameObject $names;
|
||||
public IndividualTitleCollection $titles;
|
||||
public IndividualAnniversaryCollection $anniversaries;
|
||||
// Location Information
|
||||
public IndividualPhysicalLocationCollection $physicalLocations;
|
||||
// Communication Information
|
||||
public IndividualPhoneCollection $phones;
|
||||
public IndividualEmailCollection $emails;
|
||||
public IndividualVirtualLocationCollection $virtualLocations;
|
||||
// Media Information
|
||||
public IndividualMediaCollection $media;
|
||||
// Organizations Information
|
||||
public IndividualOrganizationCollection $organizations;
|
||||
// Organizational Information
|
||||
public IndividualTagCollection $tags;
|
||||
public IndividualNoteCollection $notes;
|
||||
// Localization Information
|
||||
public string|null $language = null;
|
||||
public IndividualLanguageCollection $languages;
|
||||
// Other Information
|
||||
public IndividualCryptoCollection $crypto;
|
||||
|
||||
public function __construct() {
|
||||
$this->names = new IndividualNameObject();
|
||||
$this->anniversaries = new IndividualAnniversaryCollection();
|
||||
$this->phones = new IndividualPhoneCollection();
|
||||
$this->emails = new IndividualEmailCollection();
|
||||
$this->physicalLocations = new IndividualPhysicalLocationCollection();
|
||||
$this->organizations = new IndividualOrganizationCollection();
|
||||
$this->titles = new IndividualTitleCollection();
|
||||
$this->tags = new IndividualTagCollection();
|
||||
$this->notes = new IndividualNoteCollection();
|
||||
$this->crypto = new IndividualCryptoCollection();
|
||||
$this->virtualLocations = new IndividualVirtualLocationCollection();
|
||||
$this->media = new IndividualMediaCollection();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\People\Entity\Individual;
|
||||
|
||||
use KTXF\Json\JsonSerializableCollection;
|
||||
|
||||
class IndividualOrganizationCollection extends JsonSerializableCollection {
|
||||
|
||||
public function __construct(array $data = []) {
|
||||
parent::__construct($data, IndividualOrganizationObject::class, 'string');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\People\Entity\Individual;
|
||||
|
||||
use KTXF\Json\JsonSerializableObject;
|
||||
use OCA\JMAPC\Objects\BaseStringCollection;
|
||||
|
||||
class IndividualOrganizationObject extends JsonSerializableObject {
|
||||
|
||||
public string|null $Label;
|
||||
public BaseStringCollection $Units;
|
||||
|
||||
public string|null $sortName = null;
|
||||
|
||||
public string|null $context = null;
|
||||
public int|null $priority = null;
|
||||
|
||||
public function __construct() {
|
||||
$this->units = new BaseStringCollection();
|
||||
}
|
||||
|
||||
}
|
||||
20
shared/lib/People/Individual/IndividualPhoneCollection.php
Normal file
20
shared/lib/People/Individual/IndividualPhoneCollection.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\People\Entity\Individual;
|
||||
|
||||
use KTXF\Json\JsonSerializableCollection;
|
||||
|
||||
class IndividualPhoneCollection extends JsonSerializableCollection {
|
||||
|
||||
public function __construct(array $data = []) {
|
||||
parent::__construct($data, IndividualPhoneObject::class, 'string');
|
||||
}
|
||||
|
||||
}
|
||||
21
shared/lib/People/Individual/IndividualPhoneObject.php
Normal file
21
shared/lib/People/Individual/IndividualPhoneObject.php
Normal file
@@ -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\People\Entity\Individual;
|
||||
|
||||
use KTXF\Json\JsonSerializableObject;
|
||||
|
||||
class IndividualPhoneObject extends JsonSerializableObject {
|
||||
|
||||
public string|null $number = null;
|
||||
|
||||
public string|null $label = null;
|
||||
public string|null $context = null;
|
||||
public int|null $priority = null;
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\People\Entity\Individual;
|
||||
|
||||
use KTXF\Json\JsonSerializableCollection;
|
||||
|
||||
class IndividualPhysicalLocationCollection extends JsonSerializableCollection {
|
||||
|
||||
public function __construct(array $data = []) {
|
||||
parent::__construct($data, IndividualPhysicalLocationObject::class, 'string');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\People\Entity\Individual;
|
||||
|
||||
use KTXF\Json\JsonSerializableObject;
|
||||
|
||||
class IndividualPhysicalLocationObject extends JsonSerializableObject {
|
||||
|
||||
public string|null $box = null;
|
||||
public string|null $unit = null;
|
||||
public string|null $street = null;
|
||||
public string|null $locality = null;
|
||||
public string|null $region = null;
|
||||
public string|null $code = null;
|
||||
public string|null $country = null;
|
||||
|
||||
public string|null $label = null;
|
||||
public string|null $coordinates = null;
|
||||
public string|null $timeZone = null;
|
||||
|
||||
public string|null $context = null;
|
||||
public int|null $priority = null;
|
||||
|
||||
}
|
||||
20
shared/lib/People/Individual/IndividualPronounCollection.php
Normal file
20
shared/lib/People/Individual/IndividualPronounCollection.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\People\Entity\Individual;
|
||||
|
||||
use KTXF\Json\JsonSerializableCollection;
|
||||
|
||||
class IndividualPronounCollection extends JsonSerializableCollection {
|
||||
|
||||
public function __construct(array $data = []) {
|
||||
parent::__construct($data, IndividualPronounObject::class);
|
||||
}
|
||||
|
||||
}
|
||||
21
shared/lib/People/Individual/IndividualPronounObject.php
Normal file
21
shared/lib/People/Individual/IndividualPronounObject.php
Normal file
@@ -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\People\Entity\Individual;
|
||||
|
||||
use KTXF\Json\JsonSerializableObject;
|
||||
|
||||
class IndividualPronounObject extends JsonSerializableObject {
|
||||
|
||||
public string|null $pronoun = null;
|
||||
|
||||
public string|null $context = null;
|
||||
public int|null $priority = null;
|
||||
|
||||
}
|
||||
20
shared/lib/People/Individual/IndividualTagCollection.php
Normal file
20
shared/lib/People/Individual/IndividualTagCollection.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\People\Entity\Individual;
|
||||
|
||||
use KTXF\Json\JsonSerializableCollection;
|
||||
|
||||
class IndividualTagCollection extends JsonSerializableCollection {
|
||||
|
||||
public function __construct(array $data = []) {
|
||||
parent::__construct($data, 'string');
|
||||
}
|
||||
|
||||
}
|
||||
20
shared/lib/People/Individual/IndividualTitleCollection.php
Normal file
20
shared/lib/People/Individual/IndividualTitleCollection.php
Normal file
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\People\Entity\Individual;
|
||||
|
||||
use KTXF\Json\JsonSerializableCollection;
|
||||
|
||||
class IndividualTitleCollection extends JsonSerializableCollection {
|
||||
|
||||
public function __construct(array $data = []) {
|
||||
parent::__construct($data, IndividualTitleObject::class, 'string');
|
||||
}
|
||||
|
||||
}
|
||||
23
shared/lib/People/Individual/IndividualTitleObject.php
Normal file
23
shared/lib/People/Individual/IndividualTitleObject.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\People\Entity\Individual;
|
||||
|
||||
use KTXF\Json\JsonSerializableObject;
|
||||
|
||||
class IndividualTitleObject extends JsonSerializableObject {
|
||||
|
||||
public IndividualTitleTypes|null $kind = null;
|
||||
public string|null $label = null;
|
||||
public string|null $relation = null;
|
||||
|
||||
public string|null $context = null;
|
||||
public int|null $priority = null;
|
||||
|
||||
}
|
||||
15
shared/lib/People/Individual/IndividualTitleTypes.php
Normal file
15
shared/lib/People/Individual/IndividualTitleTypes.php
Normal file
@@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\People\Entity\Individual;
|
||||
|
||||
enum IndividualTitleTypes: string {
|
||||
case Title = 't';
|
||||
case Role = 'r';
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\People\Entity\Individual;
|
||||
|
||||
use KTXF\Json\JsonSerializableCollection;
|
||||
|
||||
class IndividualVirtualLocationCollection extends JsonSerializableCollection {
|
||||
|
||||
public function __construct(array $data = []) {
|
||||
parent::__construct($data, IndividualVirtualLocationObject::class, 'string');
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\People\Entity\Individual;
|
||||
|
||||
use KTXF\Json\JsonSerializableObject;
|
||||
|
||||
class IndividualVirtualLocationObject extends JsonSerializableObject {
|
||||
|
||||
public string|null $location = null;
|
||||
|
||||
public string|null $label = null;
|
||||
public string|null $context = null;
|
||||
public int|null $priority = null;
|
||||
|
||||
}
|
||||
96
shared/lib/People/Provider/IProviderBase.php
Normal file
96
shared/lib/People/Provider/IProviderBase.php
Normal file
@@ -0,0 +1,96 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\People\Provider;
|
||||
|
||||
use JsonSerializable;
|
||||
use KTXF\People\Service\IServiceBase;
|
||||
|
||||
interface IProviderBase extends JsonSerializable {
|
||||
|
||||
public const CAPABILITY_SERVICE_LIST = 'ServiceList';
|
||||
public const CAPABILITY_SERVICE_FETCH = 'ServiceFetch';
|
||||
public const CAPABILITY_SERVICE_EXTANT = 'ServiceExtant';
|
||||
|
||||
public const JSON_TYPE = 'people.provider';
|
||||
public const JSON_PROPERTY_TYPE = '@type';
|
||||
public const JSON_PROPERTY_ID = 'id';
|
||||
public const JSON_PROPERTY_LABEL = 'label';
|
||||
public const JSON_PROPERTY_CAPABILITIES = 'capabilities';
|
||||
|
||||
/**
|
||||
* Confirms if specific capability is supported (e.g. 'ServiceList')
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function capable(string $value): bool;
|
||||
|
||||
/**
|
||||
* Lists all supported capabilities
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @return array<string,bool>
|
||||
*/
|
||||
public function capabilities(): array;
|
||||
|
||||
/**
|
||||
* An arbitrary unique text string identifying this provider (e.g. UUID or 'system' or anything else)
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function id(): string;
|
||||
|
||||
/**
|
||||
* The localized human friendly name of this provider (e.g. System Contacts Provider)
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function label(): string;
|
||||
|
||||
/**
|
||||
* Retrieve collection of services for a specific user
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @param string $tenantId tenant identifier
|
||||
* @param string $userId user identifier
|
||||
* @param array $filter filter criteria
|
||||
*
|
||||
* @return array<string,IServiceBase> 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.05.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.05.01
|
||||
*
|
||||
* @param string $tenantId tenant identifier
|
||||
* @param string $userId user identifier
|
||||
* @param string|int $identifier service identifier
|
||||
*
|
||||
* @return IServiceBase|null returns service object or null if non found
|
||||
*/
|
||||
public function serviceFetch(string $tenantId, string $userId, string|int $identifier): ?IServiceBase;
|
||||
|
||||
}
|
||||
69
shared/lib/People/Provider/IProviderServiceMutate.php
Normal file
69
shared/lib/People/Provider/IProviderServiceMutate.php
Normal file
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\People\Provider;
|
||||
|
||||
use KTXF\Json\JsonDeserializable;
|
||||
use KTXF\People\Service\IServiceBase;
|
||||
|
||||
interface IProviderServiceMutate extends JsonDeserializable {
|
||||
|
||||
public const CAPABILITY_SERVICE_FRESH = 'ServiceFresh';
|
||||
public const CAPABILITY_SERVICE_CREATE = 'ServiceCreate';
|
||||
public const CAPABILITY_SERVICE_UPDATE = 'ServiceUpdate';
|
||||
public const CAPABILITY_SERVICE_DESTROY = 'ServiceDestroy';
|
||||
|
||||
/**
|
||||
* construct and new blank service instance
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @param string $userId user identifier
|
||||
*
|
||||
* @return IServiceBase
|
||||
*/
|
||||
public function serviceFresh(string $userId = ''): IServiceBase;
|
||||
|
||||
/**
|
||||
* create a service configuration for a specific user
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @param string $userId user identifier
|
||||
* @param IServiceBase $service service instance
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function serviceCreate(string $userId, IServiceBase $service): string;
|
||||
|
||||
/**
|
||||
* modify a service configuration for a specific user
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @param string $userId user identifier
|
||||
* @param IServiceBase $service service instance
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function serviceModify(string $userId, IServiceBase $service): string;
|
||||
|
||||
/**
|
||||
* delete a service configuration for a specific user
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @param string $userId user identifier
|
||||
* @param IServiceBase $service service instance
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function serviceDestroy(string $userId, IServiceBase $service): bool;
|
||||
|
||||
}
|
||||
221
shared/lib/People/Service/IServiceBase.php
Normal file
221
shared/lib/People/Service/IServiceBase.php
Normal file
@@ -0,0 +1,221 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\People\Service;
|
||||
|
||||
use JsonSerializable;
|
||||
use KTXF\People\Collection\ICollectionBase;
|
||||
use KTXF\Resource\Filter\IFilter;
|
||||
use KTXF\Resource\Range\IRange;
|
||||
use KTXF\Resource\Range\RangeType;
|
||||
use KTXF\Resource\Sort\ISort;
|
||||
|
||||
interface IServiceBase extends JsonSerializable {
|
||||
|
||||
public const CAPABILITY_COLLECTION_LIST = 'CollectionList';
|
||||
public const CAPABILITY_COLLECTION_LIST_FILTER = 'CollectionListFilter';
|
||||
public const CAPABILITY_COLLECTION_LIST_SORT = 'CollectionListSort';
|
||||
public const CAPABILITY_COLLECTION_EXTANT = 'CollectionExtant';
|
||||
public const CAPABILITY_COLLECTION_FETCH = 'CollectionFetch';
|
||||
|
||||
public const CAPABILITY_ENTITY_LIST = 'EntityList';
|
||||
public const CAPABILITY_ENTITY_LIST_FILTER = 'EntityListFilter';
|
||||
public const CAPABILITY_ENTITY_LIST_SORT = 'EntityListSort';
|
||||
public const CAPABILITY_ENTITY_LIST_RANGE = 'EntityListRange';
|
||||
public const CAPABILITY_ENTITY_DELTA = 'EntityDelta';
|
||||
public const CAPABILITY_ENTITY_EXTANT = 'EntityExtant';
|
||||
public const CAPABILITY_ENTITY_FETCH = 'EntityFetch';
|
||||
|
||||
public const JSON_TYPE = 'people.service';
|
||||
public const JSON_PROPERTY_TYPE = '@type';
|
||||
public const JSON_PROPERTY_PROVIDER = 'provider';
|
||||
public const JSON_PROPERTY_ID = 'id';
|
||||
public const JSON_PROPERTY_LABEL = 'label';
|
||||
public const JSON_PROPERTY_CAPABILITIES = 'capabilities';
|
||||
public const JSON_PROPERTY_ENABLED = 'enabled';
|
||||
|
||||
/**
|
||||
* Confirms if specific capability is supported
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @param string $value required ability e.g. 'EntityList'
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public function capable(string $value): bool;
|
||||
|
||||
/**
|
||||
* Lists all supported capabilities
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @return array<string,bool>
|
||||
*/
|
||||
public function capabilities(): array;
|
||||
|
||||
/**
|
||||
* Unique identifier of the provider this service belongs to
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function in(): string;
|
||||
|
||||
/**
|
||||
* Unique arbitrary text string identifying this service (e.g. 1 or service1 or anything else)
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function id(): string|int;
|
||||
|
||||
/**
|
||||
* Gets the localized human friendly name of this service (e.g. ACME Company Mail Service)
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function getLabel(): string;
|
||||
|
||||
/**
|
||||
* Gets the active status of this service
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function getEnabled(): bool;
|
||||
|
||||
/**
|
||||
* List of accessible collection
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @return array<string|int,ICollectionBase>
|
||||
*/
|
||||
public function collectionList(?IFilter $filter = null, ?ISort $sort = null): array;
|
||||
|
||||
/**
|
||||
* Fresh filter for collection list
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @return IFilter
|
||||
*/
|
||||
public function collectionListFilter(): IFilter;
|
||||
|
||||
/**
|
||||
* Fresh sort for collection list
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @return ISort
|
||||
*/
|
||||
public function collectionListSort(): ISort;
|
||||
|
||||
/**
|
||||
* Fetches details about a specific collection
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @param string|int $id collection identifier
|
||||
*/
|
||||
public function collectionExtant(string|int $identifier): bool;
|
||||
|
||||
/**
|
||||
* Fetches details about a specific collection
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @param string|int $identifier collection identifier
|
||||
*/
|
||||
public function collectionFetch(string|int $identifier): ?ICollectionBase;
|
||||
|
||||
/**
|
||||
* Lists all entities in a specific collection
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @param string|int $collection collection identifier
|
||||
*
|
||||
* @return array<string|int,IEntityBase>
|
||||
*/
|
||||
public function entityList(string|int $collection, ?IFilter $filter = null, ?ISort $sort = null, ?IRange $range = null, ?array $elements = null): array;
|
||||
|
||||
/**
|
||||
* Fresh filter for entity list
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @return Filter
|
||||
*/
|
||||
public function entityListFilter(): IFilter;
|
||||
|
||||
/**
|
||||
* Fresh sort for entity list
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @return ISort
|
||||
*/
|
||||
public function entityListSort(): ISort;
|
||||
|
||||
/**
|
||||
* Fresh range for entity list
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @param RangeType $type range type
|
||||
*
|
||||
* @return IRange
|
||||
*/
|
||||
public function entityListRange(RangeType $type): IRange;
|
||||
|
||||
/**
|
||||
* Lists of all changes from a specific token
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @param string|int $collection collection identifier
|
||||
* @param string $signature token signature
|
||||
* @param string $detail detail level ids | meta | full
|
||||
*
|
||||
* @return array
|
||||
*
|
||||
* [
|
||||
* 'added' => array<string|int>,
|
||||
* 'updated' => array<string|int>,
|
||||
* 'deleted' => array<string|int>,
|
||||
* 'signature' => string
|
||||
* ]
|
||||
*
|
||||
*/
|
||||
public function entityDelta(string|int $collection, string $signature, string $detail = 'ids'): array;
|
||||
|
||||
/**
|
||||
* Confirms if specific entity exists in a collection
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @param string|int $collection collection identifier
|
||||
* @param string|int ...$identifiers list of entity identifiers
|
||||
*
|
||||
* @return array<string|int,bool>
|
||||
*/
|
||||
public function entityExtant(string|int $collection, string|int ...$identifiers): array;
|
||||
|
||||
/**
|
||||
* Fetches details about a specific entities in a collection
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @param string|int $collection collection identifier
|
||||
* @param string|int ...$identifiers entity identifier
|
||||
*
|
||||
* @return array<string|int,IEntityBase>
|
||||
*/
|
||||
public function entityFetch(string|int $collection, string|int ...$identifiers): array;
|
||||
|
||||
}
|
||||
79
shared/lib/People/Service/IServiceCollectionMutable.php
Normal file
79
shared/lib/People/Service/IServiceCollectionMutable.php
Normal file
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\People\Service;
|
||||
|
||||
use KTXF\People\Collection\ICollectionBase;
|
||||
use KTXF\People\Collection\ICollectionMutable;
|
||||
|
||||
interface IServiceCollectionMutable extends IServiceBase {
|
||||
|
||||
public const CAPABILITY_COLLECTION_CREATE = 'CollectionCreate';
|
||||
public const CAPABILITY_COLLECTION_MODIFY = 'CollectionModify';
|
||||
public const CAPABILITY_COLLECTION_DESTROY = 'CollectionDestroy';
|
||||
public const CAPABILITY_COLLECTION_MOVE = 'CollectionMove';
|
||||
|
||||
/**
|
||||
* Creates a new, empty collection object
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @return ICollectionMutable
|
||||
*/
|
||||
public function collectionFresh(): ICollectionMutable;
|
||||
|
||||
/**
|
||||
* Creates a new collection at the specified location
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @param string|int $location The parent collection to create this collection in, or empty string for root
|
||||
* @param ICollectionMutable $collection The collection to create
|
||||
* @param array $options Additional options for the collection creation
|
||||
*
|
||||
* @return ICollectionBase
|
||||
*
|
||||
* @throws \KTXF\Resource\Exceptions\InvalidArgumentException
|
||||
* @throws \KTXF\Resource\Exceptions\UnsupportedException
|
||||
* @throws \KTXF\Resource\Exceptions\UnauthorizedException
|
||||
*/
|
||||
public function collectionCreate(string|int $location, ICollectionMutable $collection, array $options): ICollectionBase;
|
||||
|
||||
/**
|
||||
* Modifies an existing collection
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @param string|int $identifier The ID of the collection to modify
|
||||
* @param ICollectionMutable $collection The collection with modifications
|
||||
*
|
||||
* @return ICollectionBase
|
||||
*
|
||||
* @throws \KTXF\Resource\Exceptions\InvalidArgumentException
|
||||
* @throws \KTXF\Resource\Exceptions\UnsupportedException
|
||||
* @throws \KTXF\Resource\Exceptions\UnauthorizedException
|
||||
*/
|
||||
public function collectionModify(string|int $identifier, ICollectionMutable $collection): ICollectionBase;
|
||||
|
||||
/**
|
||||
* Destroys an existing collection
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @param string|int $identifier The ID of the collection to destroy
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @throws \KTXF\Resource\Exceptions\InvalidArgumentException
|
||||
* @throws \KTXF\Resource\Exceptions\UnsupportedException
|
||||
* @throws \KTXF\Resource\Exceptions\UnauthorizedException
|
||||
*/
|
||||
public function collectionDestroy(string|int $identifier): bool;
|
||||
|
||||
}
|
||||
82
shared/lib/People/Service/IServiceEntityMutable.php
Normal file
82
shared/lib/People/Service/IServiceEntityMutable.php
Normal file
@@ -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\People\Service;
|
||||
|
||||
use KTXF\People\Entity\IEntityBase;
|
||||
use KTXF\People\Entity\IEntityMutable;
|
||||
|
||||
interface IServiceEntityMutable extends IServiceBase {
|
||||
|
||||
public const CAPABILITY_ENTITY_CREATE = 'EntityCreate';
|
||||
public const CAPABILITY_ENTITY_MODIFY = 'EntityModify';
|
||||
public const CAPABILITY_ENTITY_DESTROY = 'EntityDestroy';
|
||||
public const CAPABILITY_ENTITY_COPY = 'EntityCopy';
|
||||
public const CAPABILITY_ENTITY_MOVE = 'EntityMove';
|
||||
|
||||
/**
|
||||
* Creates a fresh entity of the specified type
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @return IEntityMutable
|
||||
*/
|
||||
public function entityFresh(): IEntityMutable;
|
||||
|
||||
/**
|
||||
* Creates a new entity in the specified collection
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @param string|int $collection The collection to create this entity in
|
||||
* @param IEntityMutable $entity The entity to create
|
||||
* @param array $options Additional options for the entity creation
|
||||
*
|
||||
* @return IEntityMutable
|
||||
*
|
||||
* @throws \KTXF\Resource\Exceptions\InvalidArgumentException
|
||||
* @throws \KTXF\Resource\Exceptions\UnsupportedException
|
||||
* @throws \KTXF\Resource\Exceptions\UnauthorizedException
|
||||
*/
|
||||
public function entityCreate(string|int $collection, IEntityMutable $entity, array $options): IEntityMutable;
|
||||
|
||||
/**
|
||||
* Modifies an existing entity in the specified collection
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @param string|int $collection The collection containing the entity to modify
|
||||
* @param string|int $identifier The ID of the entity to modify
|
||||
* @param IEntityMutable $entity The entity with modifications
|
||||
*
|
||||
* @return IEntityMutable
|
||||
*
|
||||
* @throws \KTXF\Resource\Exceptions\InvalidArgumentException
|
||||
* @throws \KTXF\Resource\Exceptions\UnsupportedException
|
||||
* @throws \KTXF\Resource\Exceptions\UnauthorizedException
|
||||
*/
|
||||
public function entityModify(string|int $collection, string|int $identifier, IEntityMutable $entity): IEntityMutable;
|
||||
|
||||
/**
|
||||
* Destroys an existing entity in the specified collection
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*
|
||||
* @param string|int $collection The collection containing the entity to destroy
|
||||
* @param string|int $identifier The ID of the entity to destroy
|
||||
*
|
||||
* @return bool
|
||||
*
|
||||
* @throws \KTXF\Resource\Exceptions\InvalidArgumentException
|
||||
* @throws \KTXF\Resource\Exceptions\UnsupportedException
|
||||
* @throws \KTXF\Resource\Exceptions\UnauthorizedException
|
||||
*/
|
||||
public function entityDestroy(string|int $collection, string|int $identifier): IEntityBase;
|
||||
|
||||
}
|
||||
30
shared/lib/People/Service/IServiceMutable.php
Normal file
30
shared/lib/People/Service/IServiceMutable.php
Normal file
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
/**
|
||||
* SPDX-FileCopyrightText: Sebastian Krupinski <krupinski01@gmail.com>
|
||||
* SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
*/
|
||||
|
||||
namespace KTXF\People\Service;
|
||||
|
||||
use KTXF\Json\JsonDeserializable;
|
||||
|
||||
interface IServiceMutable extends IServiceBase, JsonDeserializable {
|
||||
|
||||
/**
|
||||
* Sets the localized human friendly name of this service (e.g. ACME Company Mail Service)
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function setLabel(string $value): self;
|
||||
|
||||
/**
|
||||
* Sets the active status of this service
|
||||
*
|
||||
* @since 2025.05.01
|
||||
*/
|
||||
public function setEnabled(bool $value): self;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user