summaryrefslogtreecommitdiffstats
path: root/core/Controller
diff options
context:
space:
mode:
authorJulien Veyssier <julien-nc@posteo.net>2022-12-02 13:06:59 +0100
committerJulius Härtl <jus@bitgrid.net>2023-01-27 11:10:55 +0100
commit6431c5a559a1361ae9148adf22b21630b8a37431 (patch)
tree2e9cc47ef2f2b0b6369e1b22ff9fab72721c6b16 /core/Controller
parentaee6b37f3f908cfe3a3d22d26dceea3f67441fa1 (diff)
downloadnextcloud-server-6431c5a559a1361ae9148adf22b21630b8a37431.tar.gz
nextcloud-server-6431c5a559a1361ae9148adf22b21630b8a37431.zip
extend the reference API for the new link picker
- add 2 interfaces for discoverable and searchable reference providers - new OCS route to get info on discoverable/searchable reference providers - new abstract ADiscoverableReferenceProvider that only implements jsonSerialize - listen to RenderReferenceEvent to inject provider list with initial state Signed-off-by: Julien Veyssier <julien-nc@posteo.net>
Diffstat (limited to 'core/Controller')
-rw-r--r--core/Controller/ReferenceApiController.php14
1 files changed, 14 insertions, 0 deletions
diff --git a/core/Controller/ReferenceApiController.php b/core/Controller/ReferenceApiController.php
index 266532113d8..098940187a8 100644
--- a/core/Controller/ReferenceApiController.php
+++ b/core/Controller/ReferenceApiController.php
@@ -25,6 +25,7 @@ declare(strict_types=1);
namespace OC\Core\Controller;
use OCP\AppFramework\Http\DataResponse;
+use OCP\Collaboration\Reference\IDiscoverableReferenceProvider;
use OCP\Collaboration\Reference\IReferenceManager;
use OCP\IRequest;
@@ -88,4 +89,17 @@ class ReferenceApiController extends \OCP\AppFramework\OCSController {
'references' => array_filter($result)
]);
}
+
+ /**
+ * @NoAdminRequired
+ *
+ * @return DataResponse
+ */
+ public function getProvidersInfo(): DataResponse {
+ $providers = $this->referenceManager->getDiscoverableProviders();
+ $jsonProviders = array_map(static function (IDiscoverableReferenceProvider $provider) {
+ return $provider->jsonSerialize();
+ }, $providers);
+ return new DataResponse($jsonProviders);
+ }
}