]> source.dussan.org Git - nextcloud-server.git/commitdiff
Add endpoint to fetch a cachable reference data 34263/head
authorJulius Härtl <jus@bitgrid.net>
Mon, 26 Sep 2022 15:23:11 +0000 (17:23 +0200)
committerJulius Härtl <jus@bitgrid.net>
Mon, 26 Sep 2022 15:44:49 +0000 (17:44 +0200)
Signed-off-by: Julius Härtl <jus@bitgrid.net>
core/Controller/ReferenceApiController.php
core/routes.php

index 3ecd9917b2313abaf98e7865cf99145e8002a4df..b97067964603db5fb5d8af8c939609018c4f7db0 100644 (file)
@@ -57,6 +57,16 @@ class ReferenceApiController extends \OCP\AppFramework\OCSController {
                ]);
        }
 
+       /**
+        * @NoAdminRequired
+        */
+       public function resolveOne(string $reference): DataResponse {
+               $resolvedReference = $this->referenceManager->resolveReference($reference);
+
+               $response = new DataResponse(['references' => [ $reference => $resolvedReference ]]);
+               $response->cacheFor(3600, false, true);
+               return $response;
+       }
 
        /**
         * @NoAdminRequired
index 5e08213828d30b603d7c1ed1c6c5fff4cf041cb0..820db44bf90a4428b40f939a9b9361489c972e9c 100644 (file)
@@ -123,6 +123,7 @@ $application->registerRoutes($this, [
                ['root' => '/collaboration', 'name' => 'CollaborationResources#getCollectionsByResource', 'url' => '/resources/{resourceType}/{resourceId}', 'verb' => 'GET'],
                ['root' => '/collaboration', 'name' => 'CollaborationResources#createCollectionOnResource', 'url' => '/resources/{baseResourceType}/{baseResourceId}', 'verb' => 'POST'],
 
+               ['root' => '/references', 'name' => 'ReferenceApi#resolveOne', 'url' => '/resolve', 'verb' => 'GET'],
                ['root' => '/references', 'name' => 'ReferenceApi#extract', 'url' => '/extract', 'verb' => 'POST'],
                ['root' => '/references', 'name' => 'ReferenceApi#resolve', 'url' => '/resolve', 'verb' => 'POST'],