diff options
Diffstat (limited to 'lib/public/Contacts/ContactsMenu')
-rw-r--r-- | lib/public/Contacts/ContactsMenu/IAction.php | 58 | ||||
-rw-r--r-- | lib/public/Contacts/ContactsMenu/IActionFactory.php | 38 | ||||
-rw-r--r-- | lib/public/Contacts/ContactsMenu/IBulkProvider.php | 23 | ||||
-rw-r--r-- | lib/public/Contacts/ContactsMenu/IContactsStore.php | 30 | ||||
-rw-r--r-- | lib/public/Contacts/ContactsMenu/IEntry.php | 61 | ||||
-rw-r--r-- | lib/public/Contacts/ContactsMenu/ILinkAction.php | 24 | ||||
-rw-r--r-- | lib/public/Contacts/ContactsMenu/IProvider.php | 25 |
7 files changed, 259 insertions, 0 deletions
diff --git a/lib/public/Contacts/ContactsMenu/IAction.php b/lib/public/Contacts/ContactsMenu/IAction.php new file mode 100644 index 00000000000..00fe8ba35c4 --- /dev/null +++ b/lib/public/Contacts/ContactsMenu/IAction.php @@ -0,0 +1,58 @@ +<?php + +/** + * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +namespace OCP\Contacts\ContactsMenu; + +use JsonSerializable; + +/** + * Apps should use the IActionFactory to create new action objects + * + * @since 12.0 + */ +interface IAction extends JsonSerializable { + /** + * @param string $icon absolute URI to an icon + * @since 12.0 + */ + public function setIcon(string $icon); + + /** + * @return string localized action name, e.g. 'Call' + * @since 12.0 + */ + public function getName(): string; + + /** + * @param string $name localized action name, e.g. 'Call' + * @since 12.0 + */ + public function setName(string $name); + + /** + * @param int $priority priorize actions, high order ones are shown on top + * @since 12.0 + */ + public function setPriority(int $priority); + + /** + * @return int priority to priorize actions, high order ones are shown on top + * @since 12.0 + */ + public function getPriority(): int; + + /** + * @param string $appId + * @since 23.0.0 + */ + public function setAppId(string $appId); + + /** + * @return string + * @since 23.0.0 + */ + public function getAppId(): string; +} diff --git a/lib/public/Contacts/ContactsMenu/IActionFactory.php b/lib/public/Contacts/ContactsMenu/IActionFactory.php new file mode 100644 index 00000000000..69e6030e95b --- /dev/null +++ b/lib/public/Contacts/ContactsMenu/IActionFactory.php @@ -0,0 +1,38 @@ +<?php + +/** + * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +namespace OCP\Contacts\ContactsMenu; + +/** + * @since 12.0 + */ +interface IActionFactory { + /** + * Construct and return a new link action for the contacts menu + * + * @since 12.0 + * + * @param string $icon full path to the action's icon + * @param string $name localized name of the action + * @param string $href target URL + * @param string $appId the app ID registering the action + * @return ILinkAction + */ + public function newLinkAction(string $icon, string $name, string $href, string $appId = ''): ILinkAction; + + /** + * Construct and return a new email action for the contacts menu + * + * @since 12.0 + * + * @param string $icon full path to the action's icon + * @param string $name localized name of the action + * @param string $email target e-mail address + * @param string $appId the appName registering the action + * @return ILinkAction + */ + public function newEMailAction(string $icon, string $name, string $email, string $appId = ''): ILinkAction; +} diff --git a/lib/public/Contacts/ContactsMenu/IBulkProvider.php b/lib/public/Contacts/ContactsMenu/IBulkProvider.php new file mode 100644 index 00000000000..b817b8cbcdc --- /dev/null +++ b/lib/public/Contacts/ContactsMenu/IBulkProvider.php @@ -0,0 +1,23 @@ +<?php + +declare(strict_types=1); + +/** + * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +namespace OCP\Contacts\ContactsMenu; + +/** + * Process contacts menu entries in bulk + * + * @since 28.0 + */ +interface IBulkProvider { + /** + * @since 28.0 + * @param list<IEntry> $entries + * @return void + */ + public function process(array $entries): void; +} diff --git a/lib/public/Contacts/ContactsMenu/IContactsStore.php b/lib/public/Contacts/ContactsMenu/IContactsStore.php new file mode 100644 index 00000000000..67913a2d919 --- /dev/null +++ b/lib/public/Contacts/ContactsMenu/IContactsStore.php @@ -0,0 +1,30 @@ +<?php + +/** + * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +namespace OCP\Contacts\ContactsMenu; + +use OCP\IUser; + +/** + * @since 13.0.0 + */ +interface IContactsStore { + /** + * @param IUser $user + * @param string|null $filter + * @param int|null $limit added 19.0.2 + * @param int|null $offset added 19.0.2 + * @return IEntry[] + * @since 13.0.0 + */ + public function getContacts(IUser $user, ?string $filter, ?int $limit = null, ?int $offset = null): array; + + /** + * @brief finds a contact by specifying the property to search on ($shareType) and the value ($shareWith) + * @since 13.0.0 + */ + public function findOne(IUser $user, int $shareType, string $shareWith): ?IEntry; +} diff --git a/lib/public/Contacts/ContactsMenu/IEntry.php b/lib/public/Contacts/ContactsMenu/IEntry.php new file mode 100644 index 00000000000..9ae8a207297 --- /dev/null +++ b/lib/public/Contacts/ContactsMenu/IEntry.php @@ -0,0 +1,61 @@ +<?php + +/** + * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +namespace OCP\Contacts\ContactsMenu; + +use JsonSerializable; + +/** + * @since 12.0 + */ +interface IEntry extends JsonSerializable { + /** + * @since 12.0 + * @return string + */ + public function getFullName(): string; + + /** + * @since 12.0 + * @return string[] + */ + public function getEMailAddresses(): array; + + /** + * @since 12.0 + * @return string|null image URI + */ + public function getAvatar(): ?string; + + /** + * @since 12.0 + * @param IAction $action an action to show in the contacts menu + */ + public function addAction(IAction $action): void; + + /** + * Set the (system) contact's user status + * + * @since 28.0 + * @param string $status + * @param string $statusMessage + * @param string|null $icon + * @return void + */ + public function setStatus(string $status, + ?string $statusMessage = null, + ?int $statusMessageTimestamp = null, + ?string $icon = null): void; + + /** + * Get an arbitrary property from the contact + * + * @since 12.0 + * @param string $key + * @return mixed the value of the property or null + */ + public function getProperty(string $key); +} diff --git a/lib/public/Contacts/ContactsMenu/ILinkAction.php b/lib/public/Contacts/ContactsMenu/ILinkAction.php new file mode 100644 index 00000000000..559e04885c5 --- /dev/null +++ b/lib/public/Contacts/ContactsMenu/ILinkAction.php @@ -0,0 +1,24 @@ +<?php + +/** + * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +namespace OCP\Contacts\ContactsMenu; + +/** + * @since 12.0 + */ +interface ILinkAction extends IAction { + /** + * @param string $href the target URL of the action + * @since 12.0 + */ + public function setHref(string $href); + + /** + * @since 12.0 + * @return string + */ + public function getHref(): string; +} diff --git a/lib/public/Contacts/ContactsMenu/IProvider.php b/lib/public/Contacts/ContactsMenu/IProvider.php new file mode 100644 index 00000000000..e462b0133b8 --- /dev/null +++ b/lib/public/Contacts/ContactsMenu/IProvider.php @@ -0,0 +1,25 @@ +<?php + +declare(strict_types=1); + +/** + * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors + * SPDX-License-Identifier: AGPL-3.0-or-later + */ +namespace OCP\Contacts\ContactsMenu; + +/** + * Process contacts menu entries + * + * @see IBulkProvider for providers that work with the full dataset at once + * + * @since 12.0 + */ +interface IProvider { + /** + * @since 12.0 + * @param IEntry $entry + * @return void + */ + public function process(IEntry $entry); +} |