mirror of
https://github.com/jikan-me/jikan-rest.git
synced 2025-02-20 11:23:35 +08:00
32 lines
913 B
PHP
32 lines
913 B
PHP
<?php
|
|
|
|
namespace App\Features;
|
|
|
|
use App\Dto\MangaNewsLookupCommand;
|
|
use Illuminate\Http\JsonResponse;
|
|
use Illuminate\Support\Collection;
|
|
use App\Support\CachedData;
|
|
use Jikan\MyAnimeList\MalClient;
|
|
use Jikan\Request\Manga\MangaNewsRequest;
|
|
|
|
/**
|
|
* @extends RequestHandlerWithScraperCache<MangaNewsLookupCommand, JsonResponse>
|
|
*/
|
|
final class MangaNewsLookupHandler extends RequestHandlerWithScraperCache
|
|
{
|
|
public function requestClass(): string
|
|
{
|
|
return MangaNewsLookupCommand::class;
|
|
}
|
|
|
|
protected function getScraperData(string $requestFingerPrint, Collection $requestParams): CachedData
|
|
{
|
|
$id = $requestParams->get("id");
|
|
return $this->scraperService->findList(
|
|
$requestFingerPrint,
|
|
fn(MalClient $jikan, ?int $page = null) => $jikan->getNewsList(new MangaNewsRequest($id, $page)),
|
|
$requestParams->get("page", 1)
|
|
);
|
|
}
|
|
}
|