Update v1 api

This commit is contained in:
Daniel Supernault 2019-09-20 22:01:36 -06:00
parent 7d61e0ad8d
commit 1229cc1521
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7
3 changed files with 30 additions and 1 deletions

View file

@ -78,6 +78,15 @@ class ApiV1Controller extends Controller
return response()->json($res);
}
public function statusById(Request $request, $id)
{
$status = Status::whereVisibility('public')->findOrFail($id);
$resource = new Fractal\Resource\Item($status, new StatusTransformer());
$res = $this->fractal->createData($resource)->toArray();
return response()->json($res);
}
public function instance(Request $request)
{
$res = [
@ -99,4 +108,21 @@ class ApiV1Controller extends Controller
];
return response()->json($res, 200, [], JSON_PRETTY_PRINT);
}
public function filters(Request $request)
{
// Pixelfed does not yet support keyword filters
return response()->json([]);
}
public function context(Request $request)
{
// todo
$res = [
'ancestors' => [],
'descendants' => []
];
return response()->json($res);
}
}

View file

@ -223,7 +223,7 @@ class PublicApiController extends Controller
'page' => 'nullable|integer|max:40',
'min_id' => 'nullable|integer|min:0|max:' . PHP_INT_MAX,
'max_id' => 'nullable|integer|min:0|max:' . PHP_INT_MAX,
'limit' => 'nullable|integer|max:20'
'limit' => 'nullable|integer|max:30'
]);
if(config('instance.timeline.local.is_public') == false && !Auth::check()) {

View file

@ -9,5 +9,8 @@ Route::group(['prefix' => 'api'], function() {
Route::group(['prefix' => 'v1'], function() {
Route::post('apps', 'Api\ApiV1Controller@apps');
Route::get('instance', 'Api\ApiV1Controller@instance');
Route::get('filters', 'Api\ApiV1Controller@filters');
Route::get('statuses/{id}', 'Api\ApiV1Controller@statusById');
Route::get('statuses/{id}/context', 'Api\ApiV1Controller@context');
});
});