Update ApiV1Controller, add v2 search endpoint

This commit is contained in:
Daniel Supernault 2020-02-06 17:13:10 -07:00
parent 6cf89e7346
commit 69d36fc1c1
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7

View file

@ -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);
}
}