Media Endpoint improvements
For the code, media related stuff is now in its own controller Added support for querying the most recent file uploaded
This commit is contained in:
parent
2193e96274
commit
4f2d3b7c2b
6 changed files with 496 additions and 338 deletions
52
app/Http/Responses/MicropubResponses.php
Normal file
52
app/Http/Responses/MicropubResponses.php
Normal file
|
@ -0,0 +1,52 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Http\Responses;
|
||||
|
||||
use Illuminate\Http\JsonResponse;
|
||||
|
||||
class MicropubResponses
|
||||
{
|
||||
/**
|
||||
* Generate a response to be returned when the token has insufficient scope.
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function insufficientScopeResponse(): JsonResponse
|
||||
{
|
||||
return response()->json([
|
||||
'response' => 'error',
|
||||
'error' => 'insufficient_scope',
|
||||
'error_description' => 'The token’s scope does not have the necessary requirements.',
|
||||
], 401);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a response to be returned when the token is invalid.
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function invalidTokenResponse(): JsonResponse
|
||||
{
|
||||
return response()->json([
|
||||
'response' => 'error',
|
||||
'error' => 'invalid_token',
|
||||
'error_description' => 'The provided token did not pass validation',
|
||||
], 400);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a response to be returned when the token has no scope.
|
||||
*
|
||||
* @return JsonResponse
|
||||
*/
|
||||
public function tokenHasNoScopeResponse(): JsonResponse
|
||||
{
|
||||
return response()->json([
|
||||
'response' => 'error',
|
||||
'error' => 'invalid_request',
|
||||
'error_description' => 'The provided token has no scopes',
|
||||
], 400);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue