2018-10-20 21:46:12 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Http\Controllers\API\Interaction;
|
|
|
|
|
|
|
|
use App\Repositories\InteractionRepository;
|
|
|
|
use App\Services\InteractionService;
|
|
|
|
use Illuminate\Http\Request;
|
|
|
|
|
2018-12-09 21:24:43 +00:00
|
|
|
/**
|
|
|
|
* @group 3. Song interactions
|
|
|
|
*/
|
2018-10-20 21:46:12 +00:00
|
|
|
class RecentlyPlayedController extends Controller
|
|
|
|
{
|
|
|
|
private $interactionRepository;
|
|
|
|
|
|
|
|
public function __construct(InteractionService $interactionService, InteractionRepository $interactionRepository)
|
|
|
|
{
|
|
|
|
parent::__construct($interactionService);
|
|
|
|
$this->interactionRepository = $interactionRepository;
|
|
|
|
}
|
|
|
|
|
2018-12-09 21:24:43 +00:00
|
|
|
/**
|
|
|
|
* Get recently played songs.
|
|
|
|
*
|
|
|
|
* Get a list of songs recently played by the current user.
|
|
|
|
*
|
|
|
|
* @queryParam count The maximum number of songs to be returned. Example: 2
|
|
|
|
* @response ["0146d01afb742b01f28ab8b556f9a75d", "c741133cb8d1982a5c60b1ce2a1e6e47"]
|
|
|
|
*/
|
2018-10-20 21:46:12 +00:00
|
|
|
public function index(Request $request, ?int $count = null)
|
|
|
|
{
|
|
|
|
return response()->json($this->interactionRepository->getRecentlyPlayed($request->user(), $count));
|
|
|
|
}
|
|
|
|
}
|