mirror of
https://github.com/koel/koel
synced 2024-12-21 10:03:10 +00:00
ab4f2210d1
* Add the API documentation * Apply fixes from StyleCI (#871)
36 lines
1 KiB
PHP
36 lines
1 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Controllers\API;
|
|
|
|
use App\Http\Requests\API\YouTubeSearchRequest;
|
|
use App\Models\Song;
|
|
use App\Services\YouTubeService;
|
|
use Illuminate\Http\JsonResponse;
|
|
|
|
/**
|
|
* @group YouTube integration
|
|
*/
|
|
class YouTubeController extends Controller
|
|
{
|
|
private $youTubeService;
|
|
|
|
public function __construct(YouTubeService $youTubeService)
|
|
{
|
|
$this->youTubeService = $youTubeService;
|
|
}
|
|
|
|
/**
|
|
* Search for YouTube videos.
|
|
*
|
|
* Search YouTube for videos related to a song (using its title and artist name).
|
|
*
|
|
* @bodyParam pageToken string The [`nextPageToken`](https://developers.google.com/youtube/v3/guides/implementation/pagination), if applicable.
|
|
* @responseFile responses/youTube.searchVideosRelatedToSong.json
|
|
*
|
|
* @return JsonResponse
|
|
*/
|
|
public function searchVideosRelatedToSong(YouTubeSearchRequest $request, Song $song)
|
|
{
|
|
return response()->json($this->youTubeService->searchVideosRelatedToSong($song, $request->pageToken));
|
|
}
|
|
}
|