IAddressBookProvider.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCA\DAV\CardDAV\Integration;
  8. /**
  9. * @since 19.0.0
  10. */
  11. interface IAddressBookProvider {
  12. /**
  13. * Provides the appId of the plugin
  14. *
  15. * @since 19.0.0
  16. * @return string AppId
  17. */
  18. public function getAppId(): string;
  19. /**
  20. * Fetches all address books for a given principal uri
  21. *
  22. * @since 19.0.0
  23. * @param string $principalUri E.g. principals/users/user1
  24. * @return ExternalAddressBook[] Array of all address books
  25. */
  26. public function fetchAllForAddressBookHome(string $principalUri): array;
  27. /**
  28. * Checks whether plugin has an address book for a given principalUri and URI
  29. *
  30. * @since 19.0.0
  31. * @param string $principalUri E.g. principals/users/user1
  32. * @param string $uri E.g. personal
  33. * @return bool True if address book for principalUri and URI exists, false otherwise
  34. */
  35. public function hasAddressBookInAddressBookHome(string $principalUri, string $uri): bool;
  36. /**
  37. * Fetches an address book for a given principalUri and URI
  38. * Returns null if address book does not exist
  39. *
  40. * @param string $principalUri E.g. principals/users/user1
  41. * @param string $uri E.g. personal
  42. *
  43. * @return ExternalAddressBook|null address book if it exists, null otherwise
  44. *@since 19.0.0
  45. */
  46. public function getAddressBookInAddressBookHome(string $principalUri, string $uri): ?ExternalAddressBook;
  47. }