1
0
Fork 0
forked from mirror/pixelfed

Add /api/v1/lists endpoint

This commit is contained in:
Daniel Supernault 2019-09-25 22:08:22 -06:00
parent e52aeeedad
commit 2a106c4e12
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7
2 changed files with 31 additions and 9 deletions

View file

@ -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

View file

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