mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-25 15:55:22 +00:00
Update ApiV1Controller, add v2 search endpoint
This commit is contained in:
parent
6cf89e7346
commit
69d36fc1c1
1 changed files with 30 additions and 1 deletions
|
@ -44,7 +44,10 @@ use App\Jobs\VideoPipeline\{
|
|||
VideoPostProcess,
|
||||
VideoThumbnail
|
||||
};
|
||||
use App\Services\NotificationService;
|
||||
use App\Services\{
|
||||
NotificationService,
|
||||
SearchApiV2Service
|
||||
};
|
||||
|
||||
class ApiV1Controller extends Controller
|
||||
{
|
||||
|
@ -1705,4 +1708,30 @@ class ApiV1Controller extends Controller
|
|||
$res = [];
|
||||
return response()->json($res);
|
||||
}
|
||||
|
||||
/**
|
||||
* GET /api/v2/search
|
||||
*
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function searchV2(Request $request)
|
||||
{
|
||||
abort_if(!$request->user(), 403);
|
||||
|
||||
$this->validate($request, [
|
||||
'q' => 'required|string|min:1|max:80',
|
||||
'account_id' => 'nullable|string',
|
||||
'max_id' => 'nullable|string',
|
||||
'min_id' => 'nullable|string',
|
||||
'type' => 'nullable|in:accounts,hashtags,statuses',
|
||||
'exclude_unreviewed' => 'nullable',
|
||||
'resolve' => 'nullable',
|
||||
'limit' => 'nullable|integer|max:40',
|
||||
'offset' => 'nullable|integer',
|
||||
'following' => 'nullable|following'
|
||||
]);
|
||||
|
||||
return SearchApiV2Service::query($request);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue