mirror of
https://github.com/jikan-me/jikan-rest.git
synced 2025-02-20 11:23:35 +08:00
- anime schedules - validation and corrections - refactorings around "augmentResponse" - macro usage instead
37 lines
1.1 KiB
PHP
37 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Contracts;
|
|
|
|
use App\Support\CachedData;
|
|
use Illuminate\Http\JsonResponse;
|
|
use Illuminate\Http\Response;
|
|
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
|
|
|
/**
|
|
* Representation of a service which knows about cached MAL scraper results.
|
|
*/
|
|
interface CachedScraperService
|
|
{
|
|
/**
|
|
* Finds cached scraper results by cacheKey, if not found scrapes them from MAL via the provided callback.
|
|
* @param string $cacheKey
|
|
* @param \Closure $getMalDataCallback
|
|
* @param int|null $page
|
|
* @return CachedData
|
|
*/
|
|
public function findList(string $cacheKey, \Closure $getMalDataCallback, ?int $page = null): CachedData;
|
|
|
|
/**
|
|
* Finds cached scraper results by id in the database, if not found scrapes them from MAL.
|
|
* @param int $id
|
|
* @param string $cacheKey
|
|
* @return CachedData
|
|
* @throws NotFoundHttpException
|
|
*/
|
|
public function find(int $id, string $cacheKey): CachedData;
|
|
|
|
public function findByKey(string $key, mixed $val, string $cacheKey): CachedData;
|
|
|
|
public function get(string $cacheKey): CachedData;
|
|
}
|