diff options
Diffstat (limited to 'core/Controller/UnifiedSearchController.php')
-rw-r--r-- | core/Controller/UnifiedSearchController.php | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/core/Controller/UnifiedSearchController.php b/core/Controller/UnifiedSearchController.php index 7e73ac8100f..346717599e0 100644 --- a/core/Controller/UnifiedSearchController.php +++ b/core/Controller/UnifiedSearchController.php @@ -8,6 +8,7 @@ declare(strict_types=1); * @author Christoph Wurst <christoph@winzerhof-wurst.at> * @author Joas Schilling <coding@schilljs.com> * @author John Molakvoæ <skjnldsv@protonmail.com> + * @author Kate Döen <kate.doeen@nextcloud.com> * * @license GNU AGPL version 3 or any later version * @@ -29,6 +30,7 @@ namespace OC\Core\Controller; use OC\Search\SearchComposer; use OC\Search\SearchQuery; +use OCA\Core\ResponseDefinitions; use OCP\AppFramework\OCSController; use OCP\AppFramework\Http; use OCP\AppFramework\Http\DataResponse; @@ -39,6 +41,10 @@ use OCP\Route\IRouter; use OCP\Search\ISearchQuery; use Symfony\Component\Routing\Exception\ResourceNotFoundException; +/** + * @psalm-import-type CoreUnifiedSearchProvider from ResponseDefinitions + * @psalm-import-type CoreUnifiedSearchResult from ResponseDefinitions + */ class UnifiedSearchController extends OCSController { public function __construct( IRequest $request, @@ -54,7 +60,10 @@ class UnifiedSearchController extends OCSController { * @NoAdminRequired * @NoCSRFRequired * + * Get the providers for unified search + * * @param string $from the url the user is currently at + * @return DataResponse<Http::STATUS_OK, CoreUnifiedSearchProvider[], array{}> */ public function getProviders(string $from = ''): DataResponse { [$route, $parameters] = $this->getRouteInformation($from); @@ -69,14 +78,19 @@ class UnifiedSearchController extends OCSController { * @NoAdminRequired * @NoCSRFRequired * - * @param string $providerId - * @param string $term - * @param int|null $sortOrder - * @param int|null $limit - * @param int|string|null $cursor - * @param string $from + * Search + * + * @param string $providerId ID of the provider + * @param string $term Term to search + * @param int|null $sortOrder Order of entries + * @param int|null $limit Maximum amount of entries + * @param int|string|null $cursor Offset for searching + * @param string $from The current user URL + * + * @return DataResponse<Http::STATUS_OK, CoreUnifiedSearchResult, array{}>|DataResponse<Http::STATUS_BAD_REQUEST, null, array{}> * - * @return DataResponse + * 200: Search entries returned + * 400: Searching is not possible */ public function search(string $providerId, string $term = '', @@ -101,7 +115,7 @@ class UnifiedSearchController extends OCSController { $route, $routeParameters ) - ) + )->jsonSerialize() ); } |