Groundwork for some upcoming API updates

This commit is contained in:
Timothy Warren 2020-07-30 15:16:24 -04:00
parent 455b551683
commit a8110d4a90
10 changed files with 98 additions and 64 deletions

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,15 +1,5 @@
# Requires authentication to select associated user query ($slug: String!) {
query { findProfileBySlug(slug: $slug) {
session {
account {
email
id
proSubscription {
billingService
tier
}
}
profile {
about about
avatarImage { avatarImage {
original { original {
@ -32,6 +22,33 @@ query {
proMessage proMessage
proTier proTier
slug slug
stats {
animeAmountConsumed {
completed
id
media
recalculatedAt
time
units
}
animeCategoryBreakdown {
categories
recalculatedAt
total
}
mangaAmountConsumed {
completed
id
media
recalculatedAt
units
}
mangaCategoryBreakdown {
categories
recalculatedAt
total
}
}
url url
waifu { waifu {
id id
@ -58,7 +75,6 @@ query {
} }
slug slug
} }
waifuOrHusbando # 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))
{
$waifu = [
'label' => $attributes['waifuOrHusbando'], 'label' => $attributes['waifuOrHusbando'],
'character' => $rels['waifu']['attributes'], '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
*/ */