IAddressBookProvider.php 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * @copyright Copyright (c) 2016 Christoph Wurst <christoph@winzerhof-wurst.at>
  5. *
  6. * @author Christoph Wurst <christoph@winzerhof-wurst.at>
  7. *
  8. * @license GNU AGPL version 3 or any later version
  9. *
  10. * This program is free software: you can redistribute it and/or modify
  11. * it under the terms of the GNU Affero General Public License as
  12. * published by the Free Software Foundation, either version 3 of the
  13. * License, or (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU Affero General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU Affero General Public License
  21. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  22. *
  23. */
  24. namespace OCA\DAV\CardDAV\Integration;
  25. /**
  26. * @since 19.0.0
  27. */
  28. interface IAddressBookProvider {
  29. /**
  30. * Provides the appId of the plugin
  31. *
  32. * @since 19.0.0
  33. * @return string AppId
  34. */
  35. public function getAppId(): string;
  36. /**
  37. * Fetches all address books for a given principal uri
  38. *
  39. * @since 19.0.0
  40. * @param string $principalUri E.g. principals/users/user1
  41. * @return ExternalAddressBook[] Array of all address books
  42. */
  43. public function fetchAllForAddressBookHome(string $principalUri): array;
  44. /**
  45. * Checks whether plugin has an address book for a given principalUri and URI
  46. *
  47. * @since 19.0.0
  48. * @param string $principalUri E.g. principals/users/user1
  49. * @param string $uri E.g. personal
  50. * @return bool True if address book for principalUri and URI exists, false otherwise
  51. */
  52. public function hasAddressBookInAddressBookHome(string $principalUri, string $uri): bool;
  53. /**
  54. * Fetches an address book for a given principalUri and URI
  55. * Returns null if address book does not exist
  56. *
  57. * @param string $principalUri E.g. principals/users/user1
  58. * @param string $uri E.g. personal
  59. *
  60. * @return ExternalAddressBook|null address book if it exists, null otherwise
  61. *@since 19.0.0
  62. */
  63. public function getAddressBookInAddressBookHome(string $principalUri, string $uri): ?ExternalAddressBook;
  64. }