mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-12 17:44:31 +00:00
Update v1 api
This commit is contained in:
parent
7d61e0ad8d
commit
1229cc1521
3 changed files with 30 additions and 1 deletions
|
@ -78,6 +78,15 @@ class ApiV1Controller extends Controller
|
||||||
return response()->json($res);
|
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)
|
public function instance(Request $request)
|
||||||
{
|
{
|
||||||
$res = [
|
$res = [
|
||||||
|
@ -99,4 +108,21 @@ class ApiV1Controller extends Controller
|
||||||
];
|
];
|
||||||
return response()->json($res, 200, [], JSON_PRETTY_PRINT);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -223,7 +223,7 @@ class PublicApiController extends Controller
|
||||||
'page' => 'nullable|integer|max:40',
|
'page' => 'nullable|integer|max:40',
|
||||||
'min_id' => 'nullable|integer|min:0|max:' . PHP_INT_MAX,
|
'min_id' => 'nullable|integer|min:0|max:' . PHP_INT_MAX,
|
||||||
'max_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()) {
|
if(config('instance.timeline.local.is_public') == false && !Auth::check()) {
|
||||||
|
|
|
@ -9,5 +9,8 @@ Route::group(['prefix' => 'api'], function() {
|
||||||
Route::group(['prefix' => 'v1'], function() {
|
Route::group(['prefix' => 'v1'], function() {
|
||||||
Route::post('apps', 'Api\ApiV1Controller@apps');
|
Route::post('apps', 'Api\ApiV1Controller@apps');
|
||||||
Route::get('instance', 'Api\ApiV1Controller@instance');
|
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');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue