Version 5.1 - All the GraphQL #32

Closed
timw4mail wants to merge 1160 commits from develop into master
10 changed files with 98 additions and 64 deletions
Showing only changes of commit a8110d4a90 - Show all commits

View File

@ -42,7 +42,7 @@
</aside> </aside>
<article class="text"> <article class="text">
<h2 class="toph"><a rel="external" href="<?= $data['url'] ?>"><?= $data['title'] ?></a></h2> <h2 class="toph"><a rel="external" href="<?= $data['url'] ?>"><?= $data['title'] ?></a></h2>
<?php foreach ($data['titles'] as $title): ?> <?php foreach ($data['titles_more'] as $title): ?>
<h3><?= $title ?></h3> <h3><?= $title ?></h3>
<?php endforeach ?> <?php endforeach ?>

View File

@ -95,6 +95,7 @@ query ($slug: String!) {
canonical canonical
localized localized
} }
#slug
} }
role role
} }
@ -106,6 +107,7 @@ query ($slug: String!) {
} }
} }
status status
#subType
synopsis synopsis
titles { titles {
canonical canonical

View File

@ -95,6 +95,7 @@ query ($id: ID!) {
canonical canonical
localized localized
} }
#slug
} }
role role
} }
@ -106,6 +107,7 @@ query ($id: ID!) {
} }
} }
status status
#subType
synopsis synopsis
titles { titles {
canonical canonical

View File

@ -22,6 +22,8 @@ query ($slug: String!) {
title title
} }
} }
# chapterCount
# volumeCount
characters { characters {
nodes { nodes {
character { character {
@ -91,6 +93,7 @@ query ($slug: String!) {
canonical canonical
localized localized
} }
#slug
} }
role role
} }
@ -102,6 +105,7 @@ query ($slug: String!) {
} }
} }
status status
#subType
synopsis synopsis
titles { titles {
canonical canonical

View File

@ -22,6 +22,8 @@ query ($id: ID!) {
title title
} }
} }
# chapterCount
# volumeCount
characters { characters {
nodes { nodes {
character { character {
@ -91,6 +93,7 @@ query ($id: ID!) {
canonical canonical
localized localized
} }
#slug
} }
role role
} }
@ -102,6 +105,7 @@ query ($id: ID!) {
} }
} }
status status
#subType
synopsis synopsis
titles { titles {
canonical canonical

View File

@ -1,64 +1,80 @@
# Requires authentication to select associated user query ($slug: String!) {
query { findProfileBySlug(slug: $slug) {
session { about
account { avatarImage {
email original {
id name
proSubscription { url
billingService width
tier height
} }
} }
profile { bannerImage {
about original {
avatarImage { name
original { url
name width
url height
width
height
}
} }
bannerImage { }
original { id
name name
url proMessage
width proTier
height slug
} stats {
} animeAmountConsumed {
id completed
name
proMessage
proTier
slug
url
waifu {
id id
image { media
original { recalculatedAt
name time
url units
width }
height animeCategoryBreakdown {
} categories
recalculatedAt
total
}
mangaAmountConsumed {
completed
id
media
recalculatedAt
units
}
mangaCategoryBreakdown {
categories
recalculatedAt
total
}
}
url
waifu {
id
image {
original {
name
url
width
height
} }
names { }
names {
canonical
alternatives
localized
}
primaryMedia {
slug
titles {
canonical canonical
alternatives alternatives
localized localized
} }
primaryMedia {
slug
titles {
canonical
alternatives
localized
}
}
slug
} }
waifuOrHusbando slug
} }
# waifuOrHusbando
} }
} }

View File

@ -114,7 +114,7 @@ final class AnimeTransformer extends AbstractTransformer {
'id' => $base['id'], 'id' => $base['id'],
'slug' => $base['slug'], 'slug' => $base['slug'],
'staff' => $staff, 'staff' => $staff,
'show_type' => 'TV', // TODO: get show type 'show_type' => 'TV', // $base['showType']
'status' => Kitsu::getAiringStatus($base['startDate'], $base['endDate']), 'status' => Kitsu::getAiringStatus($base['startDate'], $base['endDate']),
'streaming_links' => [], // Kitsu::parseStreamingLinks($item['included']), 'streaming_links' => [], // Kitsu::parseStreamingLinks($item['included']),
'synopsis' => $base['synopsis']['en'], 'synopsis' => $base['synopsis']['en'],

View File

@ -49,7 +49,8 @@ final class MangaTransformer extends AbstractTransformer {
sort($genres); sort($genres);
$title = $base['titles']['canonical']; $title = $base['titles']['canonical'];
$titles = Kitsu::filterLocalizedTitles($base['titles']); $titles = Kitsu::getTitles($base['titles']);
$titles_more = Kitsu::filterLocalizedTitles($base['titles']);
if (count($base['characters']['nodes']) > 0) if (count($base['characters']['nodes']) > 0)
{ {
@ -107,14 +108,18 @@ final class MangaTransformer extends AbstractTransformer {
'age_rating' => $base['ageRating'], 'age_rating' => $base['ageRating'],
'age_rating_guide' => $base['ageRatingGuide'], 'age_rating_guide' => $base['ageRatingGuide'],
'characters' => $characters, 'characters' => $characters,
// 'chapter_count' => $base['chapterCount'],
// 'volume_count' => $base['volumeCount'],
'cover_image' => $base['posterImage']['views'][1]['url'], 'cover_image' => $base['posterImage']['views'][1]['url'],
'genres' => $genres, 'genres' => $genres,
// 'manga_type' => $base['subType'],
'id' => $base['id'], 'id' => $base['id'],
'staff' => $staff, 'staff' => $staff,
'status' => Kitsu::getPublishingStatus($base['status'], $base['startDate'], $base['endDate']), 'status' => Kitsu::getPublishingStatus($base['status'], $base['startDate'], $base['endDate']),
'synopsis' => $base['synopsis']['en'], 'synopsis' => $base['synopsis']['en'],
'title' => $title, 'title' => $title,
'titles' => $titles, 'titles' => $titles,
'titles_more' => $titles_more,
'url' => "https://kitsu.io/manga/{$base['slug']}", 'url' => "https://kitsu.io/manga/{$base['slug']}",
]; ];

View File

@ -46,14 +46,10 @@ final class UserTransformer extends AbstractTransformer {
} }
unset($item); unset($item);
$waifu = []; $waifu = (array_key_exists('waifu', $rels)) ? [
if (array_key_exists('waifu', $rels)) 'label' => $attributes['waifuOrHusbando'],
{ 'character' => $rels['waifu']['attributes'],
$waifu = [ ] : [];
'label' => $attributes['waifuOrHusbando'],
'character' => $rels['waifu']['attributes'],
];
}
return User::from([ return User::from([
'about' => $attributes['about'], 'about' => $attributes['about'],

View File

@ -35,7 +35,7 @@ final class MangaPage extends AbstractType {
/** /**
* @var array * @var array
*/ */
public $characters; public array $characters;
/** /**
* @var int * @var int
@ -50,7 +50,7 @@ final class MangaPage extends AbstractType {
/** /**
* @var array * @var array
*/ */
public $genres; public array $genres;
/** /**
* @var string * @var string
@ -87,6 +87,11 @@ final class MangaPage extends AbstractType {
*/ */
public array $titles; public array $titles;
/**
* A potentially longer list of titles for the details page
*/
public array $titles_more;
/** /**
* @var string * @var string
*/ */