@@ -37,85 +37,85 @@ discard block |
||
| 37 | 37 | /** @var Application $application */ |
| 38 | 38 | $application = \OC::$server->query(Application::class); |
| 39 | 39 | $application->registerRoutes($this, [ |
| 40 | - 'routes' => [ |
|
| 41 | - ['name' => 'lost#email', 'url' => '/lostpassword/email', 'verb' => 'POST'], |
|
| 42 | - ['name' => 'lost#resetform', 'url' => '/lostpassword/reset/form/{token}/{userId}', 'verb' => 'GET'], |
|
| 43 | - ['name' => 'lost#setPassword', 'url' => '/lostpassword/set/{token}/{userId}', 'verb' => 'POST'], |
|
| 44 | - ['name' => 'user#getDisplayNames', 'url' => '/displaynames', 'verb' => 'POST'], |
|
| 45 | - ['name' => 'avatar#getAvatar', 'url' => '/avatar/{userId}/{size}', 'verb' => 'GET'], |
|
| 46 | - ['name' => 'avatar#deleteAvatar', 'url' => '/avatar/', 'verb' => 'DELETE'], |
|
| 47 | - ['name' => 'avatar#postCroppedAvatar', 'url' => '/avatar/cropped', 'verb' => 'POST'], |
|
| 48 | - ['name' => 'avatar#getTmpAvatar', 'url' => '/avatar/tmp', 'verb' => 'GET'], |
|
| 49 | - ['name' => 'avatar#postAvatar', 'url' => '/avatar/', 'verb' => 'POST'], |
|
| 50 | - ['name' => 'GuestAvatar#getAvatar', 'url' => '/avatar/guest/{guestName}/{size}', 'verb' => 'GET'], |
|
| 51 | - ['name' => 'CSRFToken#index', 'url' => '/csrftoken', 'verb' => 'GET'], |
|
| 52 | - ['name' => 'login#tryLogin', 'url' => '/login', 'verb' => 'POST'], |
|
| 53 | - ['name' => 'login#confirmPassword', 'url' => '/login/confirm', 'verb' => 'POST'], |
|
| 54 | - ['name' => 'login#showLoginForm', 'url' => '/login', 'verb' => 'GET'], |
|
| 55 | - ['name' => 'login#logout', 'url' => '/logout', 'verb' => 'GET'], |
|
| 56 | - // Original login flow used by all clients |
|
| 57 | - ['name' => 'ClientFlowLogin#showAuthPickerPage', 'url' => '/login/flow', 'verb' => 'GET'], |
|
| 58 | - ['name' => 'ClientFlowLogin#generateAppPassword', 'url' => '/login/flow', 'verb' => 'POST'], |
|
| 59 | - ['name' => 'ClientFlowLogin#grantPage', 'url' => '/login/flow/grant', 'verb' => 'GET'], |
|
| 60 | - ['name' => 'ClientFlowLogin#apptokenRedirect', 'url' => '/login/flow/apptoken', 'verb' => 'POST'], |
|
| 61 | - // NG login flow used by desktop client in case of Kerberos/fancy 2fa (smart cards for example) |
|
| 62 | - ['name' => 'ClientFlowLoginV2#poll', 'url' => '/login/v2/poll', 'verb' => 'POST'], |
|
| 63 | - ['name' => 'ClientFlowLoginV2#showAuthPickerPage', 'url' => '/login/v2/flow', 'verb' => 'GET'], |
|
| 64 | - ['name' => 'ClientFlowLoginV2#landing', 'url' => '/login/v2/flow/{token}', 'verb' => 'GET'], |
|
| 65 | - ['name' => 'ClientFlowLoginV2#grantPage', 'url' => '/login/v2/grant', 'verb' => 'GET'], |
|
| 66 | - ['name' => 'ClientFlowLoginV2#generateAppPassword', 'url' => '/login/v2/grant', 'verb' => 'POST'], |
|
| 67 | - ['name' => 'ClientFlowLoginV2#init', 'url' => '/login/v2', 'verb' => 'POST'], |
|
| 68 | - ['name' => 'TwoFactorChallenge#selectChallenge', 'url' => '/login/selectchallenge', 'verb' => 'GET'], |
|
| 69 | - ['name' => 'TwoFactorChallenge#showChallenge', 'url' => '/login/challenge/{challengeProviderId}', 'verb' => 'GET'], |
|
| 70 | - ['name' => 'TwoFactorChallenge#solveChallenge', 'url' => '/login/challenge/{challengeProviderId}', 'verb' => 'POST'], |
|
| 71 | - ['name' => 'TwoFactorChallenge#setupProviders', 'url' => 'login/setupchallenge', 'verb' => 'GET'], |
|
| 72 | - ['name' => 'TwoFactorChallenge#setupProvider', 'url' => 'login/setupchallenge/{providerId}', 'verb' => 'GET'], |
|
| 73 | - ['name' => 'TwoFactorChallenge#confirmProviderSetup', 'url' => 'login/setupchallenge/{providerId}', 'verb' => 'POST'], |
|
| 74 | - ['name' => 'OCJS#getConfig', 'url' => '/core/js/oc.js', 'verb' => 'GET'], |
|
| 75 | - ['name' => 'Preview#getPreviewByFileId', 'url' => '/core/preview', 'verb' => 'GET'], |
|
| 76 | - ['name' => 'Preview#getPreview', 'url' => '/core/preview.png', 'verb' => 'GET'], |
|
| 77 | - ['name' => 'RecommendedApps#index', 'url' => '/core/apps/recommended', 'verb' => 'GET'], |
|
| 78 | - ['name' => 'Svg#getSvgFromCore', 'url' => '/svg/core/{folder}/{fileName}', 'verb' => 'GET'], |
|
| 79 | - ['name' => 'Svg#getSvgFromApp', 'url' => '/svg/{app}/{fileName}', 'verb' => 'GET'], |
|
| 80 | - ['name' => 'UnifiedSearch#getProviders', 'url' => '/search/providers', 'verb' => 'GET'], |
|
| 81 | - ['name' => 'UnifiedSearch#search', 'url' => '/search/providers/{providerId}/search', 'verb' => 'GET'], |
|
| 82 | - ['name' => 'Css#getCss', 'url' => '/css/{appName}/{fileName}', 'verb' => 'GET'], |
|
| 83 | - ['name' => 'Js#getJs', 'url' => '/js/{appName}/{fileName}', 'verb' => 'GET'], |
|
| 84 | - ['name' => 'contactsMenu#index', 'url' => '/contactsmenu/contacts', 'verb' => 'POST'], |
|
| 85 | - ['name' => 'contactsMenu#findOne', 'url' => '/contactsmenu/findOne', 'verb' => 'POST'], |
|
| 86 | - ['name' => 'WalledGarden#get', 'url' => '/204', 'verb' => 'GET'], |
|
| 87 | - ['name' => 'Search#search', 'url' => '/core/search', 'verb' => 'GET'], |
|
| 88 | - ['name' => 'Wipe#checkWipe', 'url' => '/core/wipe/check', 'verb' => 'POST'], |
|
| 89 | - ['name' => 'Wipe#wipeDone', 'url' => '/core/wipe/success', 'verb' => 'POST'], |
|
| 40 | + 'routes' => [ |
|
| 41 | + ['name' => 'lost#email', 'url' => '/lostpassword/email', 'verb' => 'POST'], |
|
| 42 | + ['name' => 'lost#resetform', 'url' => '/lostpassword/reset/form/{token}/{userId}', 'verb' => 'GET'], |
|
| 43 | + ['name' => 'lost#setPassword', 'url' => '/lostpassword/set/{token}/{userId}', 'verb' => 'POST'], |
|
| 44 | + ['name' => 'user#getDisplayNames', 'url' => '/displaynames', 'verb' => 'POST'], |
|
| 45 | + ['name' => 'avatar#getAvatar', 'url' => '/avatar/{userId}/{size}', 'verb' => 'GET'], |
|
| 46 | + ['name' => 'avatar#deleteAvatar', 'url' => '/avatar/', 'verb' => 'DELETE'], |
|
| 47 | + ['name' => 'avatar#postCroppedAvatar', 'url' => '/avatar/cropped', 'verb' => 'POST'], |
|
| 48 | + ['name' => 'avatar#getTmpAvatar', 'url' => '/avatar/tmp', 'verb' => 'GET'], |
|
| 49 | + ['name' => 'avatar#postAvatar', 'url' => '/avatar/', 'verb' => 'POST'], |
|
| 50 | + ['name' => 'GuestAvatar#getAvatar', 'url' => '/avatar/guest/{guestName}/{size}', 'verb' => 'GET'], |
|
| 51 | + ['name' => 'CSRFToken#index', 'url' => '/csrftoken', 'verb' => 'GET'], |
|
| 52 | + ['name' => 'login#tryLogin', 'url' => '/login', 'verb' => 'POST'], |
|
| 53 | + ['name' => 'login#confirmPassword', 'url' => '/login/confirm', 'verb' => 'POST'], |
|
| 54 | + ['name' => 'login#showLoginForm', 'url' => '/login', 'verb' => 'GET'], |
|
| 55 | + ['name' => 'login#logout', 'url' => '/logout', 'verb' => 'GET'], |
|
| 56 | + // Original login flow used by all clients |
|
| 57 | + ['name' => 'ClientFlowLogin#showAuthPickerPage', 'url' => '/login/flow', 'verb' => 'GET'], |
|
| 58 | + ['name' => 'ClientFlowLogin#generateAppPassword', 'url' => '/login/flow', 'verb' => 'POST'], |
|
| 59 | + ['name' => 'ClientFlowLogin#grantPage', 'url' => '/login/flow/grant', 'verb' => 'GET'], |
|
| 60 | + ['name' => 'ClientFlowLogin#apptokenRedirect', 'url' => '/login/flow/apptoken', 'verb' => 'POST'], |
|
| 61 | + // NG login flow used by desktop client in case of Kerberos/fancy 2fa (smart cards for example) |
|
| 62 | + ['name' => 'ClientFlowLoginV2#poll', 'url' => '/login/v2/poll', 'verb' => 'POST'], |
|
| 63 | + ['name' => 'ClientFlowLoginV2#showAuthPickerPage', 'url' => '/login/v2/flow', 'verb' => 'GET'], |
|
| 64 | + ['name' => 'ClientFlowLoginV2#landing', 'url' => '/login/v2/flow/{token}', 'verb' => 'GET'], |
|
| 65 | + ['name' => 'ClientFlowLoginV2#grantPage', 'url' => '/login/v2/grant', 'verb' => 'GET'], |
|
| 66 | + ['name' => 'ClientFlowLoginV2#generateAppPassword', 'url' => '/login/v2/grant', 'verb' => 'POST'], |
|
| 67 | + ['name' => 'ClientFlowLoginV2#init', 'url' => '/login/v2', 'verb' => 'POST'], |
|
| 68 | + ['name' => 'TwoFactorChallenge#selectChallenge', 'url' => '/login/selectchallenge', 'verb' => 'GET'], |
|
| 69 | + ['name' => 'TwoFactorChallenge#showChallenge', 'url' => '/login/challenge/{challengeProviderId}', 'verb' => 'GET'], |
|
| 70 | + ['name' => 'TwoFactorChallenge#solveChallenge', 'url' => '/login/challenge/{challengeProviderId}', 'verb' => 'POST'], |
|
| 71 | + ['name' => 'TwoFactorChallenge#setupProviders', 'url' => 'login/setupchallenge', 'verb' => 'GET'], |
|
| 72 | + ['name' => 'TwoFactorChallenge#setupProvider', 'url' => 'login/setupchallenge/{providerId}', 'verb' => 'GET'], |
|
| 73 | + ['name' => 'TwoFactorChallenge#confirmProviderSetup', 'url' => 'login/setupchallenge/{providerId}', 'verb' => 'POST'], |
|
| 74 | + ['name' => 'OCJS#getConfig', 'url' => '/core/js/oc.js', 'verb' => 'GET'], |
|
| 75 | + ['name' => 'Preview#getPreviewByFileId', 'url' => '/core/preview', 'verb' => 'GET'], |
|
| 76 | + ['name' => 'Preview#getPreview', 'url' => '/core/preview.png', 'verb' => 'GET'], |
|
| 77 | + ['name' => 'RecommendedApps#index', 'url' => '/core/apps/recommended', 'verb' => 'GET'], |
|
| 78 | + ['name' => 'Svg#getSvgFromCore', 'url' => '/svg/core/{folder}/{fileName}', 'verb' => 'GET'], |
|
| 79 | + ['name' => 'Svg#getSvgFromApp', 'url' => '/svg/{app}/{fileName}', 'verb' => 'GET'], |
|
| 80 | + ['name' => 'UnifiedSearch#getProviders', 'url' => '/search/providers', 'verb' => 'GET'], |
|
| 81 | + ['name' => 'UnifiedSearch#search', 'url' => '/search/providers/{providerId}/search', 'verb' => 'GET'], |
|
| 82 | + ['name' => 'Css#getCss', 'url' => '/css/{appName}/{fileName}', 'verb' => 'GET'], |
|
| 83 | + ['name' => 'Js#getJs', 'url' => '/js/{appName}/{fileName}', 'verb' => 'GET'], |
|
| 84 | + ['name' => 'contactsMenu#index', 'url' => '/contactsmenu/contacts', 'verb' => 'POST'], |
|
| 85 | + ['name' => 'contactsMenu#findOne', 'url' => '/contactsmenu/findOne', 'verb' => 'POST'], |
|
| 86 | + ['name' => 'WalledGarden#get', 'url' => '/204', 'verb' => 'GET'], |
|
| 87 | + ['name' => 'Search#search', 'url' => '/core/search', 'verb' => 'GET'], |
|
| 88 | + ['name' => 'Wipe#checkWipe', 'url' => '/core/wipe/check', 'verb' => 'POST'], |
|
| 89 | + ['name' => 'Wipe#wipeDone', 'url' => '/core/wipe/success', 'verb' => 'POST'], |
|
| 90 | 90 | |
| 91 | - // Logins for passwordless auth |
|
| 92 | - ['name' => 'WebAuthn#startAuthentication', 'url' => 'login/webauthn/start', 'verb' => 'POST'], |
|
| 93 | - ['name' => 'WebAuthn#finishAuthentication', 'url' => 'login/webauthn/finish', 'verb' => 'POST'], |
|
| 94 | - ], |
|
| 95 | - 'ocs' => [ |
|
| 96 | - ['root' => '/cloud', 'name' => 'OCS#getCapabilities', 'url' => '/capabilities', 'verb' => 'GET'], |
|
| 97 | - ['root' => '', 'name' => 'OCS#getConfig', 'url' => '/config', 'verb' => 'GET'], |
|
| 98 | - ['root' => '/person', 'name' => 'OCS#personCheck', 'url' => '/check', 'verb' => 'POST'], |
|
| 99 | - ['root' => '/identityproof', 'name' => 'OCS#getIdentityProof', 'url' => '/key/{cloudId}', 'verb' => 'GET'], |
|
| 100 | - ['root' => '/core', 'name' => 'Navigation#getAppsNavigation', 'url' => '/navigation/apps', 'verb' => 'GET'], |
|
| 101 | - ['root' => '/core', 'name' => 'Navigation#getSettingsNavigation', 'url' => '/navigation/settings', 'verb' => 'GET'], |
|
| 102 | - ['root' => '/core', 'name' => 'AutoComplete#get', 'url' => '/autocomplete/get', 'verb' => 'GET'], |
|
| 103 | - ['root' => '/core', 'name' => 'WhatsNew#get', 'url' => '/whatsnew', 'verb' => 'GET'], |
|
| 104 | - ['root' => '/core', 'name' => 'WhatsNew#dismiss', 'url' => '/whatsnew', 'verb' => 'POST'], |
|
| 105 | - ['root' => '/core', 'name' => 'AppPassword#getAppPassword', 'url' => '/getapppassword', 'verb' => 'GET'], |
|
| 106 | - ['root' => '/core', 'name' => 'AppPassword#rotateAppPassword', 'url' => '/apppassword/rotate', 'verb' => 'POST'], |
|
| 107 | - ['root' => '/core', 'name' => 'AppPassword#deleteAppPassword', 'url' => '/apppassword', 'verb' => 'DELETE'], |
|
| 91 | + // Logins for passwordless auth |
|
| 92 | + ['name' => 'WebAuthn#startAuthentication', 'url' => 'login/webauthn/start', 'verb' => 'POST'], |
|
| 93 | + ['name' => 'WebAuthn#finishAuthentication', 'url' => 'login/webauthn/finish', 'verb' => 'POST'], |
|
| 94 | + ], |
|
| 95 | + 'ocs' => [ |
|
| 96 | + ['root' => '/cloud', 'name' => 'OCS#getCapabilities', 'url' => '/capabilities', 'verb' => 'GET'], |
|
| 97 | + ['root' => '', 'name' => 'OCS#getConfig', 'url' => '/config', 'verb' => 'GET'], |
|
| 98 | + ['root' => '/person', 'name' => 'OCS#personCheck', 'url' => '/check', 'verb' => 'POST'], |
|
| 99 | + ['root' => '/identityproof', 'name' => 'OCS#getIdentityProof', 'url' => '/key/{cloudId}', 'verb' => 'GET'], |
|
| 100 | + ['root' => '/core', 'name' => 'Navigation#getAppsNavigation', 'url' => '/navigation/apps', 'verb' => 'GET'], |
|
| 101 | + ['root' => '/core', 'name' => 'Navigation#getSettingsNavigation', 'url' => '/navigation/settings', 'verb' => 'GET'], |
|
| 102 | + ['root' => '/core', 'name' => 'AutoComplete#get', 'url' => '/autocomplete/get', 'verb' => 'GET'], |
|
| 103 | + ['root' => '/core', 'name' => 'WhatsNew#get', 'url' => '/whatsnew', 'verb' => 'GET'], |
|
| 104 | + ['root' => '/core', 'name' => 'WhatsNew#dismiss', 'url' => '/whatsnew', 'verb' => 'POST'], |
|
| 105 | + ['root' => '/core', 'name' => 'AppPassword#getAppPassword', 'url' => '/getapppassword', 'verb' => 'GET'], |
|
| 106 | + ['root' => '/core', 'name' => 'AppPassword#rotateAppPassword', 'url' => '/apppassword/rotate', 'verb' => 'POST'], |
|
| 107 | + ['root' => '/core', 'name' => 'AppPassword#deleteAppPassword', 'url' => '/apppassword', 'verb' => 'DELETE'], |
|
| 108 | 108 | |
| 109 | - ['root' => '/collaboration', 'name' => 'CollaborationResources#searchCollections', 'url' => '/resources/collections/search/{filter}', 'verb' => 'GET'], |
|
| 110 | - ['root' => '/collaboration', 'name' => 'CollaborationResources#listCollection', 'url' => '/resources/collections/{collectionId}', 'verb' => 'GET'], |
|
| 111 | - ['root' => '/collaboration', 'name' => 'CollaborationResources#renameCollection', 'url' => '/resources/collections/{collectionId}', 'verb' => 'PUT'], |
|
| 112 | - ['root' => '/collaboration', 'name' => 'CollaborationResources#addResource', 'url' => '/resources/collections/{collectionId}', 'verb' => 'POST'], |
|
| 109 | + ['root' => '/collaboration', 'name' => 'CollaborationResources#searchCollections', 'url' => '/resources/collections/search/{filter}', 'verb' => 'GET'], |
|
| 110 | + ['root' => '/collaboration', 'name' => 'CollaborationResources#listCollection', 'url' => '/resources/collections/{collectionId}', 'verb' => 'GET'], |
|
| 111 | + ['root' => '/collaboration', 'name' => 'CollaborationResources#renameCollection', 'url' => '/resources/collections/{collectionId}', 'verb' => 'PUT'], |
|
| 112 | + ['root' => '/collaboration', 'name' => 'CollaborationResources#addResource', 'url' => '/resources/collections/{collectionId}', 'verb' => 'POST'], |
|
| 113 | 113 | |
| 114 | - ['root' => '/collaboration', 'name' => 'CollaborationResources#removeResource', 'url' => '/resources/collections/{collectionId}', 'verb' => 'DELETE'], |
|
| 115 | - ['root' => '/collaboration', 'name' => 'CollaborationResources#getCollectionsByResource', 'url' => '/resources/{resourceType}/{resourceId}', 'verb' => 'GET'], |
|
| 116 | - ['root' => '/collaboration', 'name' => 'CollaborationResources#createCollectionOnResource', 'url' => '/resources/{baseResourceType}/{baseResourceId}', 'verb' => 'POST'] |
|
| 114 | + ['root' => '/collaboration', 'name' => 'CollaborationResources#removeResource', 'url' => '/resources/collections/{collectionId}', 'verb' => 'DELETE'], |
|
| 115 | + ['root' => '/collaboration', 'name' => 'CollaborationResources#getCollectionsByResource', 'url' => '/resources/{resourceType}/{resourceId}', 'verb' => 'GET'], |
|
| 116 | + ['root' => '/collaboration', 'name' => 'CollaborationResources#createCollectionOnResource', 'url' => '/resources/{baseResourceType}/{baseResourceId}', 'verb' => 'POST'] |
|
| 117 | 117 | |
| 118 | - ], |
|
| 118 | + ], |
|
| 119 | 119 | ]); |
| 120 | 120 | |
| 121 | 121 | // Post installation check |
@@ -124,4 +124,4 @@ discard block |
||
| 124 | 124 | // Core ajax actions |
| 125 | 125 | // Routing |
| 126 | 126 | $this->create('core_ajax_update', '/core/ajax/update.php') |
| 127 | - ->actionInclude('core/ajax/update.php'); |
|
| 127 | + ->actionInclude('core/ajax/update.php'); |
|
@@ -36,63 +36,63 @@ |
||
| 36 | 36 | |
| 37 | 37 | class UnifiedSearchController extends Controller { |
| 38 | 38 | |
| 39 | - /** @var SearchComposer */ |
|
| 40 | - private $composer; |
|
| 39 | + /** @var SearchComposer */ |
|
| 40 | + private $composer; |
|
| 41 | 41 | |
| 42 | - /** @var IUserSession */ |
|
| 43 | - private $userSession; |
|
| 42 | + /** @var IUserSession */ |
|
| 43 | + private $userSession; |
|
| 44 | 44 | |
| 45 | - public function __construct(IRequest $request, |
|
| 46 | - IUserSession $userSession, |
|
| 47 | - SearchComposer $composer) { |
|
| 48 | - parent::__construct('core', $request); |
|
| 45 | + public function __construct(IRequest $request, |
|
| 46 | + IUserSession $userSession, |
|
| 47 | + SearchComposer $composer) { |
|
| 48 | + parent::__construct('core', $request); |
|
| 49 | 49 | |
| 50 | - $this->composer = $composer; |
|
| 51 | - $this->userSession = $userSession; |
|
| 52 | - } |
|
| 50 | + $this->composer = $composer; |
|
| 51 | + $this->userSession = $userSession; |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | - /** |
|
| 55 | - * @NoAdminRequired |
|
| 56 | - * @NoCSRFRequired |
|
| 57 | - */ |
|
| 58 | - public function getProviders(): JSONResponse { |
|
| 59 | - return new JSONResponse( |
|
| 60 | - $this->composer->getProviders() |
|
| 61 | - ); |
|
| 62 | - } |
|
| 54 | + /** |
|
| 55 | + * @NoAdminRequired |
|
| 56 | + * @NoCSRFRequired |
|
| 57 | + */ |
|
| 58 | + public function getProviders(): JSONResponse { |
|
| 59 | + return new JSONResponse( |
|
| 60 | + $this->composer->getProviders() |
|
| 61 | + ); |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | - /** |
|
| 65 | - * @NoAdminRequired |
|
| 66 | - * @NoCSRFRequired |
|
| 67 | - * |
|
| 68 | - * @param string $providerId |
|
| 69 | - * @param string $term |
|
| 70 | - * @param int|null $sortOrder |
|
| 71 | - * @param int|null $limit |
|
| 72 | - * @param int|string|null $cursor |
|
| 73 | - * |
|
| 74 | - * @return JSONResponse |
|
| 75 | - */ |
|
| 76 | - public function search(string $providerId, |
|
| 77 | - string $term = '', |
|
| 78 | - ?int $sortOrder = null, |
|
| 79 | - ?int $limit = null, |
|
| 80 | - $cursor = null): JSONResponse { |
|
| 81 | - if (empty($term)) { |
|
| 82 | - return new JSONResponse(null, Http::STATUS_BAD_REQUEST); |
|
| 83 | - } |
|
| 64 | + /** |
|
| 65 | + * @NoAdminRequired |
|
| 66 | + * @NoCSRFRequired |
|
| 67 | + * |
|
| 68 | + * @param string $providerId |
|
| 69 | + * @param string $term |
|
| 70 | + * @param int|null $sortOrder |
|
| 71 | + * @param int|null $limit |
|
| 72 | + * @param int|string|null $cursor |
|
| 73 | + * |
|
| 74 | + * @return JSONResponse |
|
| 75 | + */ |
|
| 76 | + public function search(string $providerId, |
|
| 77 | + string $term = '', |
|
| 78 | + ?int $sortOrder = null, |
|
| 79 | + ?int $limit = null, |
|
| 80 | + $cursor = null): JSONResponse { |
|
| 81 | + if (empty($term)) { |
|
| 82 | + return new JSONResponse(null, Http::STATUS_BAD_REQUEST); |
|
| 83 | + } |
|
| 84 | 84 | |
| 85 | - return new JSONResponse( |
|
| 86 | - $this->composer->search( |
|
| 87 | - $this->userSession->getUser(), |
|
| 88 | - $providerId, |
|
| 89 | - new SearchQuery( |
|
| 90 | - $term, |
|
| 91 | - $sortOrder ?? ISearchQuery::SORT_DATE_DESC, |
|
| 92 | - $limit ?? SearchQuery::LIMIT_DEFAULT, |
|
| 93 | - $cursor |
|
| 94 | - ) |
|
| 95 | - ) |
|
| 96 | - ); |
|
| 97 | - } |
|
| 85 | + return new JSONResponse( |
|
| 86 | + $this->composer->search( |
|
| 87 | + $this->userSession->getUser(), |
|
| 88 | + $providerId, |
|
| 89 | + new SearchQuery( |
|
| 90 | + $term, |
|
| 91 | + $sortOrder ?? ISearchQuery::SORT_DATE_DESC, |
|
| 92 | + $limit ?? SearchQuery::LIMIT_DEFAULT, |
|
| 93 | + $cursor |
|
| 94 | + ) |
|
| 95 | + ) |
|
| 96 | + ); |
|
| 97 | + } |
|
| 98 | 98 | } |