aboutsummaryrefslogtreecommitdiffstats
path: root/lib/public/Collaboration/Reference/IReferenceProvider.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/public/Collaboration/Reference/IReferenceProvider.php')
-rw-r--r--lib/public/Collaboration/Reference/IReferenceProvider.php47
1 files changed, 47 insertions, 0 deletions
diff --git a/lib/public/Collaboration/Reference/IReferenceProvider.php b/lib/public/Collaboration/Reference/IReferenceProvider.php
new file mode 100644
index 00000000000..9ff9a728063
--- /dev/null
+++ b/lib/public/Collaboration/Reference/IReferenceProvider.php
@@ -0,0 +1,47 @@
+<?php
+
+declare(strict_types=1);
+/**
+ * SPDX-FileCopyrightText: 2022 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
+namespace OCP\Collaboration\Reference;
+
+/**
+ * @since 25.0.0
+ */
+interface IReferenceProvider {
+ /**
+ * Validate that a given reference identifier matches the current provider
+ *
+ * @since 25.0.0
+ */
+ public function matchReference(string $referenceText): bool;
+
+ /**
+ * Return a reference with its metadata for a given reference identifier
+ *
+ * @since 25.0.0
+ */
+ public function resolveReference(string $referenceText): ?IReference;
+
+ /**
+ * Return true if the reference metadata can be globally cached
+ *
+ * @since 25.0.0
+ */
+ public function getCachePrefix(string $referenceId): string;
+
+ /**
+ * Return a custom cache key to be used for caching the metadata
+ * This could be for example the current user id if the reference
+ * access permissions are different for each user
+ *
+ * Should return null, if the cache is only related to the
+ * reference id and has no further dependency
+ *
+ * @since 25.0.0
+ */
+ public function getCacheKey(string $referenceId): ?string;
+}