aboutsummaryrefslogtreecommitdiffstats
path: root/lib/public/Contacts
diff options
context:
space:
mode:
Diffstat (limited to 'lib/public/Contacts')
-rw-r--r--lib/public/Contacts/ContactsMenu/IAction.php33
-rw-r--r--lib/public/Contacts/ContactsMenu/IActionFactory.php23
-rw-r--r--lib/public/Contacts/ContactsMenu/IBulkProvider.php23
-rw-r--r--lib/public/Contacts/ContactsMenu/IContactsStore.php40
-rw-r--r--lib/public/Contacts/ContactsMenu/IEntry.php38
-rw-r--r--lib/public/Contacts/ContactsMenu/ILinkAction.php29
-rw-r--r--lib/public/Contacts/ContactsMenu/IProvider.php29
-rw-r--r--lib/public/Contacts/Events/ContactInteractedWithEvent.php22
-rw-r--r--lib/public/Contacts/IManager.php78
9 files changed, 100 insertions, 215 deletions
diff --git a/lib/public/Contacts/ContactsMenu/IAction.php b/lib/public/Contacts/ContactsMenu/IAction.php
index 9b08bbbf04b..00fe8ba35c4 100644
--- a/lib/public/Contacts/ContactsMenu/IAction.php
+++ b/lib/public/Contacts/ContactsMenu/IAction.php
@@ -1,24 +1,8 @@
<?php
+
/**
- * @copyright 2017 Christoph Wurst <christoph@winzerhof-wurst.at>
- *
- * @author Christoph Wurst <christoph@winzerhof-wurst.at>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCP\Contacts\ContactsMenu;
@@ -30,36 +14,35 @@ use JsonSerializable;
* @since 12.0
*/
interface IAction extends JsonSerializable {
-
/**
* @param string $icon absolute URI to an icon
* @since 12.0
*/
- public function setIcon($icon);
+ public function setIcon(string $icon);
/**
* @return string localized action name, e.g. 'Call'
* @since 12.0
*/
- public function getName();
+ public function getName(): string;
/**
* @param string $name localized action name, e.g. 'Call'
* @since 12.0
*/
- public function setName($name);
+ public function setName(string $name);
/**
* @param int $priority priorize actions, high order ones are shown on top
* @since 12.0
*/
- public function setPriority($priority);
+ public function setPriority(int $priority);
/**
* @return int priority to priorize actions, high order ones are shown on top
* @since 12.0
*/
- public function getPriority();
+ public function getPriority(): int;
/**
* @param string $appId
diff --git a/lib/public/Contacts/ContactsMenu/IActionFactory.php b/lib/public/Contacts/ContactsMenu/IActionFactory.php
index b4e4eb96819..69e6030e95b 100644
--- a/lib/public/Contacts/ContactsMenu/IActionFactory.php
+++ b/lib/public/Contacts/ContactsMenu/IActionFactory.php
@@ -1,24 +1,8 @@
<?php
+
/**
- * @copyright 2017 Christoph Wurst <christoph@winzerhof-wurst.at>
- *
- * @author Christoph Wurst <christoph@winzerhof-wurst.at>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCP\Contacts\ContactsMenu;
@@ -26,7 +10,6 @@ namespace OCP\Contacts\ContactsMenu;
* @since 12.0
*/
interface IActionFactory {
-
/**
* Construct and return a new link action for the contacts menu
*
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
index 3aa51888450..67913a2d919 100644
--- a/lib/public/Contacts/ContactsMenu/IContactsStore.php
+++ b/lib/public/Contacts/ContactsMenu/IContactsStore.php
@@ -1,26 +1,8 @@
<?php
+
/**
- * @copyright Copyright (c) 2016 Tobia De Koninck <tobia@ledfan.be>
- *
- * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
- * @author Christoph Wurst <christoph@winzerhof-wurst.at>
- * @author Tobia De Koninck <tobia@ledfan.be>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCP\Contacts\ContactsMenu;
@@ -30,25 +12,19 @@ use OCP\IUser;
* @since 13.0.0
*/
interface IContactsStore {
-
-
/**
* @param IUser $user
- * @param string $filter
- * @param int $limit added 19.0.2
- * @param int $offset added 19.0.2
+ * @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, $filter, ?int $limit = null, ?int $offset = null);
+ 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)
- * @param IUser $user
- * @param integer $shareType
- * @param string $shareWith
- * @return IEntry|null
* @since 13.0.0
*/
- public function findOne(IUser $user, $shareType, $shareWith);
+ 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
index d4e3e31cf79..9ae8a207297 100644
--- a/lib/public/Contacts/ContactsMenu/IEntry.php
+++ b/lib/public/Contacts/ContactsMenu/IEntry.php
@@ -1,25 +1,8 @@
<?php
+
/**
- * @copyright 2017 Christoph Wurst <christoph@winzerhof-wurst.at>
- *
- * @author Christoph Wurst <christoph@winzerhof-wurst.at>
- * @author Roeland Jago Douma <roeland@famdouma.nl>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCP\Contacts\ContactsMenu;
@@ -29,7 +12,6 @@ use JsonSerializable;
* @since 12.0
*/
interface IEntry extends JsonSerializable {
-
/**
* @since 12.0
* @return string
@@ -55,6 +37,20 @@ interface IEntry extends JsonSerializable {
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
diff --git a/lib/public/Contacts/ContactsMenu/ILinkAction.php b/lib/public/Contacts/ContactsMenu/ILinkAction.php
index 63e77f5446f..559e04885c5 100644
--- a/lib/public/Contacts/ContactsMenu/ILinkAction.php
+++ b/lib/public/Contacts/ContactsMenu/ILinkAction.php
@@ -1,24 +1,8 @@
<?php
+
/**
- * @copyright 2017 Christoph Wurst <christoph@winzerhof-wurst.at>
- *
- * @author Christoph Wurst <christoph@winzerhof-wurst.at>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-FileCopyrightText: 2017 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCP\Contacts\ContactsMenu;
@@ -26,16 +10,15 @@ namespace OCP\Contacts\ContactsMenu;
* @since 12.0
*/
interface ILinkAction extends IAction {
-
/**
- * @since 12.0
* @param string $href the target URL of the action
+ * @since 12.0
*/
- public function setHref($href);
+ public function setHref(string $href);
/**
* @since 12.0
* @return string
*/
- public function getHref();
+ public function getHref(): string;
}
diff --git a/lib/public/Contacts/ContactsMenu/IProvider.php b/lib/public/Contacts/ContactsMenu/IProvider.php
index c6c695c5698..e462b0133b8 100644
--- a/lib/public/Contacts/ContactsMenu/IProvider.php
+++ b/lib/public/Contacts/ContactsMenu/IProvider.php
@@ -1,32 +1,21 @@
<?php
+
+declare(strict_types=1);
+
/**
- * @copyright 2017 Christoph Wurst <christoph@winzerhof-wurst.at>
- *
- * @author Christoph Wurst <christoph@winzerhof-wurst.at>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * 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
diff --git a/lib/public/Contacts/Events/ContactInteractedWithEvent.php b/lib/public/Contacts/Events/ContactInteractedWithEvent.php
index b879c89a730..6f37cee7dba 100644
--- a/lib/public/Contacts/Events/ContactInteractedWithEvent.php
+++ b/lib/public/Contacts/Events/ContactInteractedWithEvent.php
@@ -3,25 +3,8 @@
declare(strict_types=1);
/**
- * @copyright 2020 Christoph Wurst <christoph@winzerhof-wurst.at>
- *
- * @author Christoph Wurst <christoph@winzerhof-wurst.at>
- *
- * @license GNU AGPL version 3 or any later version
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- *
+ * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCP\Contacts\Events;
@@ -39,7 +22,6 @@ use OCP\IUser;
* @since 19.0.0
*/
class ContactInteractedWithEvent extends Event {
-
/** @var IUser */
private $actor;
diff --git a/lib/public/Contacts/IManager.php b/lib/public/Contacts/IManager.php
index e9bdc01c060..60abb18b382 100644
--- a/lib/public/Contacts/IManager.php
+++ b/lib/public/Contacts/IManager.php
@@ -1,33 +1,12 @@
<?php
+
/**
- * @copyright Copyright (c) 2016, ownCloud, Inc.
- *
- * @author Anna Larch <anna@nextcloud.com>
- * @author Arne Hamann <kontakt+github@arne.email>
- * @author Christoph Wurst <christoph@winzerhof-wurst.at>
- * @author John Molakvoæ <skjnldsv@protonmail.com>
- * @author Julius Härtl <jus@bitgrid.net>
- * @author Morris Jobke <hey@morrisjobke.de>
- * @author Roeland Jago Douma <roeland@famdouma.nl>
- * @author Thomas Müller <thomas.mueller@tmit.eu>
- *
- * @license AGPL-3.0
- *
- * This code is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License, version 3,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License, version 3,
- * along with this program. If not, see <http://www.gnu.org/licenses/>
- *
+ * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
+ * SPDX-License-Identifier: AGPL-3.0-only
*/
// use OCP namespace for all classes that are considered public.
-// This means that they should be used by apps instead of the internal ownCloud classes
+// This means that they should be used by apps instead of the internal Nextcloud classes
namespace OCP\Contacts;
@@ -48,7 +27,6 @@ namespace OCP\Contacts;
* @since 6.0.0
*/
interface IManager {
-
/**
* This function is used to search and find contacts within the users address books.
* In case $pattern is empty all contacts will be returned.
@@ -57,7 +35,7 @@ interface IManager {
* Following function shows how to search for contacts for the name and the email address.
*
* public static function getMatchingRecipient($term) {
- * $cm = \OC::$server->getContactsManager();
+ * $cm = \OCP\Server::get(\OCP\Contacts\IManager::class);
* // The API is not active -> nothing to do
* if (!$cm->isEnabled()) {
* return array();
@@ -90,13 +68,15 @@ interface IManager {
* @param string $pattern which should match within the $searchProperties
* @param array $searchProperties defines the properties within the query pattern should match
* @param array $options = array() to define the search behavior
- * - 'escape_like_param' - If set to false wildcards _ and % are not escaped
- * - 'limit' - Set a numeric limit for the search results
- * - 'offset' - Set the offset for the limited search results
- * - 'enumeration' - (since 23.0.0) Whether user enumeration on system address book is allowed
- * - 'fullmatch' - (since 23.0.0) Whether matching on full detail in system addresss book is allowed
- * - 'strict_search' - (since 23.0.0) Whether the search pattern is full string or partial search
- * @psalm-param array{escape_like_param?: bool, limit?: int, offset?: int, enumeration?: bool, fullmatch?: bool, strict_search?: bool} $options
+ * - 'types' boolean (since 15.0.0) If set to true, fields that come with a TYPE property will be an array
+ * example: ['id' => 5, 'FN' => 'Thomas Tanghus', 'EMAIL' => ['type => 'HOME', 'value' => 'g@h.i']]
+ * - 'escape_like_param' - If set to false wildcards _ and % are not escaped
+ * - 'limit' - Set a numeric limit for the search results
+ * - 'offset' - Set the offset for the limited search results
+ * - 'enumeration' - (since 23.0.0) Whether user enumeration on system address book is allowed
+ * - 'fullmatch' - (since 23.0.0) Whether matching on full detail in system address book is allowed
+ * - 'strict_search' - (since 23.0.0) Whether the search pattern is full string or partial search
+ * @psalm-param array{types?: bool, escape_like_param?: bool, limit?: int, offset?: int, enumeration?: bool, fullmatch?: bool, strict_search?: bool} $options
* @return array an array of contacts which are arrays of key-value-pairs
* @since 6.0.0
*/
@@ -105,23 +85,23 @@ interface IManager {
/**
* This function can be used to delete the contact identified by the given id
*
- * @param object $id the unique identifier to a contact
- * @param string $address_book_key identifier of the address book in which the contact shall be deleted
+ * @param int $id the unique identifier to a contact
+ * @param string $addressBookKey identifier of the address book in which the contact shall be deleted
* @return bool successful or not
* @since 6.0.0
*/
- public function delete($id, $address_book_key);
+ public function delete($id, $addressBookKey);
/**
* This function is used to create a new contact if 'id' is not given or not present.
* Otherwise the contact will be updated by replacing the entire data set.
*
* @param array $properties this array if key-value-pairs defines a contact
- * @param string $address_book_key identifier of the address book in which the contact shall be created or updated
- * @return array an array representing the contact just created or updated
+ * @param string $addressBookKey identifier of the address book in which the contact shall be created or updated
+ * @return ?array an array representing the contact just created or updated
* @since 6.0.0
*/
- public function createOrUpdate($properties, $address_book_key);
+ public function createOrUpdate($properties, $addressBookKey);
/**
* Check if contacts are available (e.g. contacts app enabled)
@@ -134,20 +114,19 @@ interface IManager {
/**
* Registers an address book
*
- * @param \OCP\IAddressBook $address_book
* @return void
* @since 6.0.0
*/
- public function registerAddressBook(\OCP\IAddressBook $address_book);
+ public function registerAddressBook(\OCP\IAddressBook $addressBook);
/**
* Unregisters an address book
*
- * @param \OCP\IAddressBook $address_book
+ * @param \OCP\IAddressBook $addressBook
* @return void
* @since 6.0.0
*/
- public function unregisterAddressBook(\OCP\IAddressBook $address_book);
+ public function unregisterAddressBook(\OCP\IAddressBook $addressBook);
/**
* In order to improve lazy loading a closure can be registered which will be called in case
@@ -160,15 +139,6 @@ interface IManager {
public function register(\Closure $callable);
/**
- * Return a list of the user's addressbooks display names
- *
- * @return array
- * @since 6.0.0
- * @deprecated 16.0.0 - Use `$this->getUserAddressBooks()` instead
- */
- public function getAddressBooks();
-
- /**
* Return a list of the user's addressbooks
*
* @return \OCP\IAddressBook[]