mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-22 06:21:27 +00:00
Add /api/v1/lists endpoint
This commit is contained in:
parent
e52aeeedad
commit
2a106c4e12
2 changed files with 31 additions and 9 deletions
|
@ -816,15 +816,13 @@ class ApiV1Controller extends Controller
|
|||
return response()->json([]);
|
||||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
* GET /api/v1/instance
|
||||
*
|
||||
* Information about the server.
|
||||
*
|
||||
* @return Instance
|
||||
*/
|
||||
public function instance(Request $request)
|
||||
{
|
||||
$res = [
|
||||
|
@ -847,6 +845,29 @@ class ApiV1Controller extends Controller
|
|||
return response()->json($res, 200, [], JSON_PRETTY_PRINT);
|
||||
}
|
||||
|
||||
/**
|
||||
* GET /api/v1/lists
|
||||
*
|
||||
* Return empty array as we don't support lists
|
||||
*
|
||||
* @return null
|
||||
*/
|
||||
public function accountLists(Request $request)
|
||||
{
|
||||
abort_if(!$request->user(), 403);
|
||||
|
||||
return response()->json([]);
|
||||
}
|
||||
|
||||
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 context(Request $request)
|
||||
{
|
||||
// todo
|
||||
|
|
|
@ -107,6 +107,7 @@ Route::domain(config('pixelfed.domain.app'))->middleware(['validemail', 'twofact
|
|||
Route::post('follow_requests/{id}/authorize', 'Api\ApiV1Controller@accountFollowRequestAccept')->middleware('auth:api');
|
||||
Route::post('follow_requests/{id}/reject', 'Api\ApiV1Controller@accountFollowRequestReject')->middleware('auth:api');
|
||||
Route::get('suggestions', 'Api\ApiV1Controller@accountSuggestions')->middleware('auth:api');
|
||||
Route::get('lists', 'Api\ApiV1Controller@accountLists')->middleware('auth:api');
|
||||
|
||||
Route::get('likes', 'ApiController@hydrateLikes');
|
||||
Route::post('media', 'ApiController@uploadMedia')->middleware('auth:api');
|
||||
|
|
Loading…
Reference in a new issue