Version 5.1 - All the GraphQL #32

Closed
timw4mail wants to merge 1160 commits from develop into master
3 changed files with 26 additions and 5 deletions
Showing only changes of commit b6dc104947 - Show all commits

View File

@ -21,10 +21,14 @@ use function Amp\{all, wait};
use Amp\Artax\{Client, Request};
use Aviat\AnimeClient\API\{
CacheTrait,
Enum\AnimeWatchingStatus\Title,
JsonAPI,
Kitsu as K,
Mapping\AnimeWatchingStatus
Mapping\AnimeWatchingStatus,
Mapping\MangaReadingStatus
};
use Aviat\AnimeClient\API\Enum\{
AnimeWatchingStatus\Title,
MangaReadingStatus\Kitsu as KitsuReadingStatus
};
use Aviat\AnimeClient\API\Kitsu\Transformer\{
AnimeTransformer,
@ -334,7 +338,6 @@ class Model {
public function getFullOrganizedAnimeList(): array
{
$cacheItem = $this->cache->getItem(self::FULL_TRANSFORMED_LIST_CACHE_KEY);
if ( ! $cacheItem->isHit())
@ -402,6 +405,19 @@ class Model {
return $cacheItem->get();
}
public function getFullOrganizedMangaList(): array
{
$statuses = KitsuReadingStatus::getConstList();
$output = [];
foreach ($statuses as $status)
{
$mappedStatus = MangaReadingStatus::KITSU_TO_TITLE[$status];
$output[$mappedStatus] = $this->getMangaList($status);
}
return $output;
}
/**
* Get the manga list for the configured user
*

View File

@ -84,7 +84,7 @@ class SyncKitsuWithMal extends BaseCommand {
for ($i = 0; $i < $count; $i++)
{
$offset = $i * $size;
$requests[] = $this->kitsuModel->getFullAnimeList($size, $offset);
$requests[] = $this->kitsuModel->getPagedAnimeList($size, $offset);
}
$promiseArray = (new Client())->requestMulti($requests);
@ -151,7 +151,7 @@ class SyncKitsuWithMal extends BaseCommand {
public function filterKitsuList()
{
$data = $this->getKitsuList();
$data = $this->kitsuModel->getFullAnimeList();
$includes = JsonAPI::organizeIncludes($data['included']);
$includes['mappings'] = $this->filterMappings($includes['mappings']);

View File

@ -56,6 +56,11 @@ class Manga extends API
*/
public function getList($status)
{
if ($status === 'All')
{
return $this->kitsuModel->getFullOrganizedMangaList();
}
$APIstatus = MangaReadingStatus::TITLE_TO_KITSU[$status];
$data = $this->kitsuModel->getMangaList($APIstatus);
return $this->mapByStatus($data)[$status];