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>
<article class="text">
<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>
<?php endforeach ?>

View File

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

View File

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

View File

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

View File

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

View File

@ -1,64 +1,80 @@
# Requires authentication to select associated user
query {
session {
account {
email
id
proSubscription {
billingService
tier
query ($slug: String!) {
findProfileBySlug(slug: $slug) {
about
avatarImage {
original {
name
url
width
height
}
}
profile {
about
avatarImage {
original {
name
url
width
height
}
bannerImage {
original {
name
url
width
height
}
bannerImage {
original {
name
url
width
height
}
}
id
name
proMessage
proTier
slug
url
waifu {
}
id
name
proMessage
proTier
slug
stats {
animeAmountConsumed {
completed
id
image {
original {
name
url
width
height
}
media
recalculatedAt
time
units
}
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
alternatives
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'],
'slug' => $base['slug'],
'staff' => $staff,
'show_type' => 'TV', // TODO: get show type
'show_type' => 'TV', // $base['showType']
'status' => Kitsu::getAiringStatus($base['startDate'], $base['endDate']),
'streaming_links' => [], // Kitsu::parseStreamingLinks($item['included']),
'synopsis' => $base['synopsis']['en'],

View File

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

View File

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

View File

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