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