IReferenceProvider.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCP\Collaboration\Reference;
  8. /**
  9. * @since 25.0.0
  10. */
  11. interface IReferenceProvider {
  12. /**
  13. * Validate that a given reference identifier matches the current provider
  14. *
  15. * @since 25.0.0
  16. */
  17. public function matchReference(string $referenceText): bool;
  18. /**
  19. * Return a reference with its metadata for a given reference identifier
  20. *
  21. * @since 25.0.0
  22. */
  23. public function resolveReference(string $referenceText): ?IReference;
  24. /**
  25. * Return true if the reference metadata can be globally cached
  26. *
  27. * @since 25.0.0
  28. */
  29. public function getCachePrefix(string $referenceId): string;
  30. /**
  31. * Return a custom cache key to be used for caching the metadata
  32. * This could be for example the current user id if the reference
  33. * access permissions are different for each user
  34. *
  35. * Should return null, if the cache is only related to the
  36. * reference id and has no further dependency
  37. *
  38. * @since 25.0.0
  39. */
  40. public function getCacheKey(string $referenceId): ?string;
  41. }