Version 5.1 - All the GraphQL #32
4
console
4
console
@ -9,8 +9,8 @@ use ConsoleKit\Console;
|
|||||||
|
|
||||||
$GLOBALS['_SERVER']['HTTP_HOST'] = 'localhost';
|
$GLOBALS['_SERVER']['HTTP_HOST'] = 'localhost';
|
||||||
|
|
||||||
define('APP_DIR', __DIR__ . '/app');
|
const APP_DIR = __DIR__ . '/app';
|
||||||
define('TEMPLATE_DIR', APP_DIR . '/templates');
|
const TEMPLATE_DIR = APP_DIR . '/templates';
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
// Start console script
|
// Start console script
|
||||||
|
@ -25,7 +25,7 @@ setlocale(LC_CTYPE, 'en_US');
|
|||||||
// Load composer autoloader
|
// Load composer autoloader
|
||||||
require_once __DIR__ . '/vendor/autoload.php';
|
require_once __DIR__ . '/vendor/autoload.php';
|
||||||
|
|
||||||
Debugger::$strictMode = E_ALL & ~E_DEPRECATED & ~E_USER_DEPRECATED; // all errors except deprecated notices
|
Debugger::$strictMode = E_ALL & ~E_DEPRECATED; // all errors except deprecated notices
|
||||||
Debugger::$showBar = false;
|
Debugger::$showBar = false;
|
||||||
Debugger::enable(Debugger::DEVELOPMENT, __DIR__ . '/app/logs');
|
Debugger::enable(Debugger::DEVELOPMENT, __DIR__ . '/app/logs');
|
||||||
|
|
||||||
|
@ -154,7 +154,7 @@ abstract class APIRequestBuilder {
|
|||||||
* Set a request header
|
* Set a request header
|
||||||
*
|
*
|
||||||
* @param string $name
|
* @param string $name
|
||||||
* @param string $value
|
* @param string|null $value
|
||||||
* @return self
|
* @return self
|
||||||
*/
|
*/
|
||||||
public function setHeader(string $name, string $value = NULL): self
|
public function setHeader(string $name, string $value = NULL): self
|
||||||
|
@ -70,7 +70,7 @@ abstract class AbstractListItem {
|
|||||||
* Delete a list item
|
* Delete a list item
|
||||||
*
|
*
|
||||||
* @param string $id - The id of the list item to delete
|
* @param string $id - The id of the list item to delete
|
||||||
* @return Request
|
* @return Request|null
|
||||||
*/
|
*/
|
||||||
abstract public function delete(string $id):?Request;
|
abstract public function delete(string $id):?Request;
|
||||||
}
|
}
|
@ -207,7 +207,7 @@ final class Model
|
|||||||
*
|
*
|
||||||
* @param FormItem $data
|
* @param FormItem $data
|
||||||
* @param string $type - Them media type (anime/manga)
|
* @param string $type - Them media type (anime/manga)
|
||||||
* @return Request
|
* @return Request|null
|
||||||
*/
|
*/
|
||||||
public function incrementListItem(FormItem $data, string $type): ?Request
|
public function incrementListItem(FormItem $data, string $type): ?Request
|
||||||
{
|
{
|
||||||
@ -225,7 +225,7 @@ final class Model
|
|||||||
*
|
*
|
||||||
* @param FormItem $data
|
* @param FormItem $data
|
||||||
* @param string $type - Them media type (anime/manga)
|
* @param string $type - Them media type (anime/manga)
|
||||||
* @return Request
|
* @return Request|null
|
||||||
*/
|
*/
|
||||||
public function updateListItem(FormItem $data, string $type): ?Request
|
public function updateListItem(FormItem $data, string $type): ?Request
|
||||||
{
|
{
|
||||||
@ -244,7 +244,7 @@ final class Model
|
|||||||
*
|
*
|
||||||
* @param string $malId - The id of the list item to remove
|
* @param string $malId - The id of the list item to remove
|
||||||
* @param string $type - Them media type (anime/manga)
|
* @param string $type - Them media type (anime/manga)
|
||||||
* @return Request
|
* @return Request|null
|
||||||
*/
|
*/
|
||||||
public function deleteListItem(string $malId, string $type): ?Request
|
public function deleteListItem(string $malId, string $type): ?Request
|
||||||
{
|
{
|
||||||
@ -262,7 +262,7 @@ final class Model
|
|||||||
*
|
*
|
||||||
* @param string $malId
|
* @param string $malId
|
||||||
* @param string $type - The media type (anime/manga)
|
* @param string $type - The media type (anime/manga)
|
||||||
* @return string
|
* @return string|null
|
||||||
*/
|
*/
|
||||||
public function getListIdFromMalId(string $malId, string $type): ?string
|
public function getListIdFromMalId(string $malId, string $type): ?string
|
||||||
{
|
{
|
||||||
@ -306,7 +306,7 @@ final class Model
|
|||||||
*
|
*
|
||||||
* @param string $malId
|
* @param string $malId
|
||||||
* @param string $type
|
* @param string $type
|
||||||
* @return string
|
* @return string|null
|
||||||
*/
|
*/
|
||||||
private function getMediaIdFromMalId(string $malId, string $type = 'ANIME'): ?string
|
private function getMediaIdFromMalId(string $malId, string $type = 'ANIME'): ?string
|
||||||
{
|
{
|
||||||
|
@ -257,24 +257,18 @@ final class RequestBuilder extends APIRequestBuilder {
|
|||||||
$validResponseCodes = [200, 201];
|
$validResponseCodes = [200, 201];
|
||||||
|
|
||||||
$logger = $this->container->getLogger('anilist-request');
|
$logger = $this->container->getLogger('anilist-request');
|
||||||
if ($logger !== NULL)
|
$logger?->debug('Anilist response', [
|
||||||
{
|
|
||||||
$logger->debug('Anilist response', [
|
|
||||||
'status' => $response->getStatus(),
|
'status' => $response->getStatus(),
|
||||||
'reason' => $response->getReason(),
|
'reason' => $response->getReason(),
|
||||||
'body' => $response->getBody(),
|
'body' => $response->getBody(),
|
||||||
'headers' => $response->getHeaders(),
|
'headers' => $response->getHeaders(),
|
||||||
//'requestHeaders' => $request->getHeaders(),
|
//'requestHeaders' => $request->getHeaders(),
|
||||||
]);
|
]);
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if ( ! \in_array($response->getStatus(), $validResponseCodes, TRUE))
|
if ( ! \in_array($response->getStatus(), $validResponseCodes, TRUE))
|
||||||
{
|
{
|
||||||
if ($logger !== NULL)
|
$logger?->warning('Non 200 response for POST api call', (array)$response->getBody());
|
||||||
{
|
|
||||||
$logger->warning('Non 200 response for POST api call', (array)$response->getBody());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$rawBody = wait($response->getBody()->buffer());
|
$rawBody = wait($response->getBody()->buffer());
|
||||||
|
@ -24,6 +24,7 @@ use Aviat\AnimeClient\Types\{AnimeListItem, FormItem};
|
|||||||
use Aviat\Ion\Transformer\AbstractTransformer;
|
use Aviat\Ion\Transformer\AbstractTransformer;
|
||||||
|
|
||||||
use DateTime;
|
use DateTime;
|
||||||
|
use DateTimeInterface;
|
||||||
|
|
||||||
class AnimeListTransformer extends AbstractTransformer {
|
class AnimeListTransformer extends AbstractTransformer {
|
||||||
|
|
||||||
@ -57,7 +58,7 @@ class AnimeListTransformer extends AbstractTransformer {
|
|||||||
: AnimeWatchingStatus::ANILIST_TO_KITSU[$item['status']],
|
: AnimeWatchingStatus::ANILIST_TO_KITSU[$item['status']],
|
||||||
'updatedAt' => (new DateTime())
|
'updatedAt' => (new DateTime())
|
||||||
->setTimestamp($item['updatedAt'])
|
->setTimestamp($item['updatedAt'])
|
||||||
->format(DateTime::W3C)
|
->format(DateTimeInterface::W3C)
|
||||||
],
|
],
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,7 @@ use Aviat\AnimeClient\Types\FormItem;
|
|||||||
use Aviat\Ion\Transformer\AbstractTransformer;
|
use Aviat\Ion\Transformer\AbstractTransformer;
|
||||||
|
|
||||||
use DateTime;
|
use DateTime;
|
||||||
|
use DateTimeInterface;
|
||||||
|
|
||||||
class MangaListTransformer extends AbstractTransformer {
|
class MangaListTransformer extends AbstractTransformer {
|
||||||
|
|
||||||
@ -58,7 +59,7 @@ class MangaListTransformer extends AbstractTransformer {
|
|||||||
: MangaReadingStatus::ANILIST_TO_KITSU[$item['status']],
|
: MangaReadingStatus::ANILIST_TO_KITSU[$item['status']],
|
||||||
'updatedAt' => (new DateTime())
|
'updatedAt' => (new DateTime())
|
||||||
->setTimestamp($item['updatedAt'])
|
->setTimestamp($item['updatedAt'])
|
||||||
->format(DateTime::W3C),
|
->format(DateTimeInterface::W3C),
|
||||||
]
|
]
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
@ -19,10 +19,8 @@ namespace Aviat\AnimeClient\API\Anilist\Types;
|
|||||||
use Aviat\AnimeClient\Types\AbstractType;
|
use Aviat\AnimeClient\Types\AbstractType;
|
||||||
|
|
||||||
class MediaListEntry extends AbstractType {
|
class MediaListEntry extends AbstractType {
|
||||||
/**
|
|
||||||
* @var int|string
|
public int|string $id;
|
||||||
*/
|
|
||||||
public $id;
|
|
||||||
|
|
||||||
public ?string $notes;
|
public ?string $notes;
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@ union ActivityUnion = ListActivity | MessageActivity | TextActivity
|
|||||||
union LikeableUnion = ActivityReply | ListActivity | MessageActivity | TextActivity | Thread | ThreadComment
|
union LikeableUnion = ActivityReply | ListActivity | MessageActivity | TextActivity | Thread | ThreadComment
|
||||||
|
|
||||||
"Notification union type"
|
"Notification union type"
|
||||||
union NotificationUnion = ActivityLikeNotification | ActivityMentionNotification | ActivityMessageNotification | ActivityReplyLikeNotification | ActivityReplyNotification | ActivityReplySubscribedNotification | AiringNotification | FollowingNotification | RelatedMediaAdditionNotification | ThreadCommentLikeNotification | ThreadCommentMentionNotification | ThreadCommentReplyNotification | ThreadCommentSubscribedNotification | ThreadLikeNotification
|
union NotificationUnion = ActivityLikeNotification | ActivityMentionNotification | ActivityMessageNotification | ActivityReplyLikeNotification | ActivityReplyNotification | ActivityReplySubscribedNotification | AiringNotification | FollowingNotification | MediaDataChangeNotification | MediaDeletionNotification | MediaMergeNotification | RelatedMediaAdditionNotification | ThreadCommentLikeNotification | ThreadCommentMentionNotification | ThreadCommentReplyNotification | ThreadCommentSubscribedNotification | ThreadLikeNotification
|
||||||
|
|
||||||
"Notification for when a activity is liked"
|
"Notification for when a activity is liked"
|
||||||
type ActivityLikeNotification {
|
type ActivityLikeNotification {
|
||||||
@ -227,6 +227,8 @@ type AniChartUser {
|
|||||||
type Character {
|
type Character {
|
||||||
"The character's age. Note this is a string, not an int, it may contain further text and additional ages."
|
"The character's age. Note this is a string, not an int, it may contain further text and additional ages."
|
||||||
age: String
|
age: String
|
||||||
|
"The characters blood type"
|
||||||
|
bloodType: String
|
||||||
"The character's birth date"
|
"The character's birth date"
|
||||||
dateOfBirth: FuzzyDate
|
dateOfBirth: FuzzyDate
|
||||||
"A general description of the character"
|
"A general description of the character"
|
||||||
@ -314,15 +316,21 @@ type CharacterName {
|
|||||||
middle: String
|
middle: String
|
||||||
"The character's full name in their native language"
|
"The character's full name in their native language"
|
||||||
native: String
|
native: String
|
||||||
|
"The currently authenticated users preferred name language. Default romaji for non-authenticated"
|
||||||
|
userPreferred: String
|
||||||
}
|
}
|
||||||
|
|
||||||
"A submission for a character that features in an anime or manga"
|
"A submission for a character that features in an anime or manga"
|
||||||
type CharacterSubmission {
|
type CharacterSubmission {
|
||||||
|
"Data Mod assigned to handle the submission"
|
||||||
|
assignee: User
|
||||||
"Character that the submission is referencing"
|
"Character that the submission is referencing"
|
||||||
character: Character
|
character: Character
|
||||||
createdAt: Int
|
createdAt: Int
|
||||||
"The id of the submission"
|
"The id of the submission"
|
||||||
id: Int!
|
id: Int!
|
||||||
|
"Whether the submission is locked"
|
||||||
|
locked: Boolean
|
||||||
"Inner details of submission status"
|
"Inner details of submission status"
|
||||||
notes: String
|
notes: String
|
||||||
source: String
|
source: String
|
||||||
@ -543,6 +551,7 @@ type InternalPage {
|
|||||||
sort: [AiringSort]
|
sort: [AiringSort]
|
||||||
): [AiringSchedule]
|
): [AiringSchedule]
|
||||||
characterSubmissions(
|
characterSubmissions(
|
||||||
|
assigneeId: Int,
|
||||||
characterId: Int,
|
characterId: Int,
|
||||||
"The order the results will be returned in"
|
"The order the results will be returned in"
|
||||||
sort: [SubmissionSort],
|
sort: [SubmissionSort],
|
||||||
@ -654,6 +663,8 @@ type InternalPage {
|
|||||||
id_not_in: [Int],
|
id_not_in: [Int],
|
||||||
"Filter by if the media's intended for 18+ adult audiences"
|
"Filter by if the media's intended for 18+ adult audiences"
|
||||||
isAdult: Boolean,
|
isAdult: Boolean,
|
||||||
|
"If the media is officially licensed or a self-published doujin release"
|
||||||
|
isLicensed: Boolean,
|
||||||
"Filter media by sites with a online streaming or reading license"
|
"Filter media by sites with a online streaming or reading license"
|
||||||
licensedBy: String,
|
licensedBy: String,
|
||||||
"Filter media by sites with a online streaming or reading license"
|
"Filter media by sites with a online streaming or reading license"
|
||||||
@ -772,6 +783,7 @@ type InternalPage {
|
|||||||
userName: String
|
userName: String
|
||||||
): [MediaList]
|
): [MediaList]
|
||||||
mediaSubmissions(
|
mediaSubmissions(
|
||||||
|
assigneeId: Int,
|
||||||
mediaId: Int,
|
mediaId: Int,
|
||||||
"The order the results will be returned in"
|
"The order the results will be returned in"
|
||||||
sort: [SubmissionSort],
|
sort: [SubmissionSort],
|
||||||
@ -864,7 +876,7 @@ type InternalPage {
|
|||||||
"Filter by user who created the recommendation"
|
"Filter by user who created the recommendation"
|
||||||
userId: Int
|
userId: Int
|
||||||
): [Recommendation]
|
): [Recommendation]
|
||||||
reports: [Report]
|
reports(reportedId: Int, reporterId: Int): [Report]
|
||||||
reviews(
|
reviews(
|
||||||
"Filter by Review id"
|
"Filter by Review id"
|
||||||
id: Int,
|
id: Int,
|
||||||
@ -906,6 +918,7 @@ type InternalPage {
|
|||||||
sort: [StaffSort]
|
sort: [StaffSort]
|
||||||
): [Staff]
|
): [Staff]
|
||||||
staffSubmissions(
|
staffSubmissions(
|
||||||
|
assigneeId: Int,
|
||||||
"The order the results will be returned in"
|
"The order the results will be returned in"
|
||||||
sort: [SubmissionSort],
|
sort: [SubmissionSort],
|
||||||
staffId: Int,
|
staffId: Int,
|
||||||
@ -958,9 +971,15 @@ type InternalPage {
|
|||||||
"Filter by the user id of the thread's creator"
|
"Filter by the user id of the thread's creator"
|
||||||
userId: Int
|
userId: Int
|
||||||
): [Thread]
|
): [Thread]
|
||||||
|
userBlockSearch(
|
||||||
|
"Filter by search query"
|
||||||
|
search: String
|
||||||
|
): [User]
|
||||||
users(
|
users(
|
||||||
"Filter by the user id"
|
"Filter by the user id"
|
||||||
id: Int,
|
id: Int,
|
||||||
|
"Filter to moderators only if true"
|
||||||
|
isModerator: Boolean,
|
||||||
"Filter by the name of the user"
|
"Filter by the name of the user"
|
||||||
name: String,
|
name: String,
|
||||||
"Filter by search query"
|
"Filter by search query"
|
||||||
@ -1073,6 +1092,8 @@ type Media {
|
|||||||
isAdult: Boolean
|
isAdult: Boolean
|
||||||
"If the media is marked as favourite by the current authenticated user"
|
"If the media is marked as favourite by the current authenticated user"
|
||||||
isFavourite: Boolean!
|
isFavourite: Boolean!
|
||||||
|
"If the media is blocked from being added to favourites"
|
||||||
|
isFavouriteBlocked: Boolean!
|
||||||
"If the media is officially licensed or a self-published doujin release"
|
"If the media is officially licensed or a self-published doujin release"
|
||||||
isLicensed: Boolean
|
isLicensed: Boolean
|
||||||
"Locked media may not be added to lists our favorited. This may be due to the entry pending for deletion or other reasons."
|
"Locked media may not be added to lists our favorited. This may be due to the entry pending for deletion or other reasons."
|
||||||
@ -1120,7 +1141,7 @@ type Media {
|
|||||||
siteUrl: String
|
siteUrl: String
|
||||||
"Source type the media was adapted from."
|
"Source type the media was adapted from."
|
||||||
source(
|
source(
|
||||||
"Provide 2 to use new version 2 of sources enum"
|
"Provide 2 or 3 to use new version 2 or 3 of sources enum"
|
||||||
version: Int
|
version: Int
|
||||||
): MediaSource
|
): MediaSource
|
||||||
"The staff who produced the media"
|
"The staff who produced the media"
|
||||||
@ -1205,6 +1226,40 @@ type MediaCoverImage {
|
|||||||
medium: String
|
medium: String
|
||||||
}
|
}
|
||||||
|
|
||||||
|
"Notification for when a media entry's data was changed in a significant way impacting users' list tracking"
|
||||||
|
type MediaDataChangeNotification {
|
||||||
|
"The reason for the media data change"
|
||||||
|
context: String
|
||||||
|
"The time the notification was created at"
|
||||||
|
createdAt: Int
|
||||||
|
"The id of the Notification"
|
||||||
|
id: Int!
|
||||||
|
"The media that received data changes"
|
||||||
|
media: Media
|
||||||
|
"The id of the media that received data changes"
|
||||||
|
mediaId: Int!
|
||||||
|
"The reason for the media data change"
|
||||||
|
reason: String
|
||||||
|
"The type of notification"
|
||||||
|
type: NotificationType
|
||||||
|
}
|
||||||
|
|
||||||
|
"Notification for when a media tracked in a user's list is deleted from the site"
|
||||||
|
type MediaDeletionNotification {
|
||||||
|
"The reason for the media deletion"
|
||||||
|
context: String
|
||||||
|
"The time the notification was created at"
|
||||||
|
createdAt: Int
|
||||||
|
"The title of the deleted media"
|
||||||
|
deletedMediaTitle: String
|
||||||
|
"The id of the Notification"
|
||||||
|
id: Int!
|
||||||
|
"The reason for the media deletion"
|
||||||
|
reason: String
|
||||||
|
"The type of notification"
|
||||||
|
type: NotificationType
|
||||||
|
}
|
||||||
|
|
||||||
"Media connection edge"
|
"Media connection edge"
|
||||||
type MediaEdge {
|
type MediaEdge {
|
||||||
"Media specific character name"
|
"Media specific character name"
|
||||||
@ -1352,6 +1407,26 @@ type MediaListTypeOptions {
|
|||||||
theme: Json @deprecated(reason: "This field has not yet been fully implemented and may change without warning")
|
theme: Json @deprecated(reason: "This field has not yet been fully implemented and may change without warning")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
"Notification for when a media entry is merged into another for a user who had it on their list"
|
||||||
|
type MediaMergeNotification {
|
||||||
|
"The reason for the media data change"
|
||||||
|
context: String
|
||||||
|
"The time the notification was created at"
|
||||||
|
createdAt: Int
|
||||||
|
"The title of the deleted media"
|
||||||
|
deletedMediaTitles: [String]
|
||||||
|
"The id of the Notification"
|
||||||
|
id: Int!
|
||||||
|
"The media that was merged into"
|
||||||
|
media: Media
|
||||||
|
"The id of the media that was merged into"
|
||||||
|
mediaId: Int!
|
||||||
|
"The reason for the media merge"
|
||||||
|
reason: String
|
||||||
|
"The type of notification"
|
||||||
|
type: NotificationType
|
||||||
|
}
|
||||||
|
|
||||||
"The ranking of a media in a particular time span and format compared to other media"
|
"The ranking of a media in a particular time span and format compared to other media"
|
||||||
type MediaRank {
|
type MediaRank {
|
||||||
"If the ranking is based on all time instead of a season/year"
|
"If the ranking is based on all time instead of a season/year"
|
||||||
@ -1393,12 +1468,16 @@ type MediaStreamingEpisode {
|
|||||||
|
|
||||||
"Media submission"
|
"Media submission"
|
||||||
type MediaSubmission {
|
type MediaSubmission {
|
||||||
|
"Data Mod assigned to handle the submission"
|
||||||
|
assignee: User
|
||||||
changes: [String]
|
changes: [String]
|
||||||
characters: [MediaSubmissionComparison]
|
characters: [MediaSubmissionComparison]
|
||||||
createdAt: Int
|
createdAt: Int
|
||||||
externalLinks: [MediaExternalLink]
|
externalLinks: [MediaExternalLink]
|
||||||
"The id of the submission"
|
"The id of the submission"
|
||||||
id: Int!
|
id: Int!
|
||||||
|
"Whether the submission is locked"
|
||||||
|
locked: Boolean
|
||||||
media: Media
|
media: Media
|
||||||
notes: String
|
notes: String
|
||||||
relations: [MediaEdge]
|
relations: [MediaEdge]
|
||||||
@ -1458,6 +1537,8 @@ type MediaTag {
|
|||||||
name: String!
|
name: String!
|
||||||
"The relevance ranking of the tag out of the 100 for this media"
|
"The relevance ranking of the tag out of the 100 for this media"
|
||||||
rank: Int
|
rank: Int
|
||||||
|
"The user who submitted the tag"
|
||||||
|
userId: Int
|
||||||
}
|
}
|
||||||
|
|
||||||
"The official titles of the media in various languages"
|
"The official titles of the media in various languages"
|
||||||
@ -1738,6 +1819,8 @@ type Mutation {
|
|||||||
comment: String,
|
comment: String,
|
||||||
"The comment id, required for updating"
|
"The comment id, required for updating"
|
||||||
id: Int,
|
id: Int,
|
||||||
|
"If the comment tree should be locked. (Mod Only)"
|
||||||
|
locked: Boolean,
|
||||||
"The id of thread comment to reply to"
|
"The id of thread comment to reply to"
|
||||||
parentCommentId: Int,
|
parentCommentId: Int,
|
||||||
"The id of thread the comment belongs to"
|
"The id of thread the comment belongs to"
|
||||||
@ -1872,6 +1955,8 @@ type Mutation {
|
|||||||
rowOrder: String,
|
rowOrder: String,
|
||||||
"The user's list scoring system"
|
"The user's list scoring system"
|
||||||
scoreFormat: ScoreFormat,
|
scoreFormat: ScoreFormat,
|
||||||
|
"The language the user wants to see staff and character names in"
|
||||||
|
staffNameLanguage: UserStaffNameLanguage,
|
||||||
"Timezone offset format: -?HH:MM"
|
"Timezone offset format: -?HH:MM"
|
||||||
timezone: String,
|
timezone: String,
|
||||||
"User's title language"
|
"User's title language"
|
||||||
@ -2094,6 +2179,8 @@ type Page {
|
|||||||
id_not_in: [Int],
|
id_not_in: [Int],
|
||||||
"Filter by if the media's intended for 18+ adult audiences"
|
"Filter by if the media's intended for 18+ adult audiences"
|
||||||
isAdult: Boolean,
|
isAdult: Boolean,
|
||||||
|
"If the media is officially licensed or a self-published doujin release"
|
||||||
|
isLicensed: Boolean,
|
||||||
"Filter media by sites with a online streaming or reading license"
|
"Filter media by sites with a online streaming or reading license"
|
||||||
licensedBy: String,
|
licensedBy: String,
|
||||||
"Filter media by sites with a online streaming or reading license"
|
"Filter media by sites with a online streaming or reading license"
|
||||||
@ -2368,6 +2455,8 @@ type Page {
|
|||||||
users(
|
users(
|
||||||
"Filter by the user id"
|
"Filter by the user id"
|
||||||
id: Int,
|
id: Int,
|
||||||
|
"Filter to moderators only if true"
|
||||||
|
isModerator: Boolean,
|
||||||
"Filter by the name of the user"
|
"Filter by the name of the user"
|
||||||
name: String,
|
name: String,
|
||||||
"Filter by search query"
|
"Filter by search query"
|
||||||
@ -2618,6 +2707,8 @@ type Query {
|
|||||||
id_not_in: [Int],
|
id_not_in: [Int],
|
||||||
"Filter by if the media's intended for 18+ adult audiences"
|
"Filter by if the media's intended for 18+ adult audiences"
|
||||||
isAdult: Boolean,
|
isAdult: Boolean,
|
||||||
|
"If the media is officially licensed or a self-published doujin release"
|
||||||
|
isLicensed: Boolean,
|
||||||
"Filter media by sites with a online streaming or reading license"
|
"Filter media by sites with a online streaming or reading license"
|
||||||
licensedBy: String,
|
licensedBy: String,
|
||||||
"Filter media by sites with a online streaming or reading license"
|
"Filter media by sites with a online streaming or reading license"
|
||||||
@ -2958,6 +3049,8 @@ type Query {
|
|||||||
User(
|
User(
|
||||||
"Filter by the user id"
|
"Filter by the user id"
|
||||||
id: Int,
|
id: Int,
|
||||||
|
"Filter to moderators only if true"
|
||||||
|
isModerator: Boolean,
|
||||||
"Filter by the name of the user"
|
"Filter by the name of the user"
|
||||||
name: String,
|
name: String,
|
||||||
"Filter by search query"
|
"Filter by search query"
|
||||||
@ -3014,6 +3107,7 @@ type RelatedMediaAdditionNotification {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Report {
|
type Report {
|
||||||
|
cleared: Boolean
|
||||||
"When the entry data was created"
|
"When the entry data was created"
|
||||||
createdAt: Int
|
createdAt: Int
|
||||||
id: Int!
|
id: Int!
|
||||||
@ -3179,6 +3273,8 @@ type SiteTrendEdge {
|
|||||||
type Staff {
|
type Staff {
|
||||||
"The person's age in years"
|
"The person's age in years"
|
||||||
age: Int
|
age: Int
|
||||||
|
"The persons blood type"
|
||||||
|
bloodType: String
|
||||||
"Media the actor voiced characters in. (Same data as characters with media as node instead of characters)"
|
"Media the actor voiced characters in. (Same data as characters with media as node instead of characters)"
|
||||||
characterMedia(
|
characterMedia(
|
||||||
onList: Boolean,
|
onList: Boolean,
|
||||||
@ -3291,6 +3387,8 @@ type StaffName {
|
|||||||
middle: String
|
middle: String
|
||||||
"The person's full name in their native language"
|
"The person's full name in their native language"
|
||||||
native: String
|
native: String
|
||||||
|
"The currently authenticated users preferred name language. Default romaji for non-authenticated"
|
||||||
|
userPreferred: String
|
||||||
}
|
}
|
||||||
|
|
||||||
"Voice actor role for a character"
|
"Voice actor role for a character"
|
||||||
@ -3314,9 +3412,13 @@ type StaffStats {
|
|||||||
|
|
||||||
"A submission for a staff that features in an anime or manga"
|
"A submission for a staff that features in an anime or manga"
|
||||||
type StaffSubmission {
|
type StaffSubmission {
|
||||||
|
"Data Mod assigned to handle the submission"
|
||||||
|
assignee: User
|
||||||
createdAt: Int
|
createdAt: Int
|
||||||
"The id of the submission"
|
"The id of the submission"
|
||||||
id: Int!
|
id: Int!
|
||||||
|
"Whether the submission is locked"
|
||||||
|
locked: Boolean
|
||||||
"Inner details of submission status"
|
"Inner details of submission status"
|
||||||
notes: String
|
notes: String
|
||||||
source: String
|
source: String
|
||||||
@ -3511,6 +3613,8 @@ type ThreadComment {
|
|||||||
id: Int!
|
id: Int!
|
||||||
"If the currently authenticated user liked the comment"
|
"If the currently authenticated user liked the comment"
|
||||||
isLiked: Boolean
|
isLiked: Boolean
|
||||||
|
"If the comment tree is locked and may not receive replies or edits"
|
||||||
|
isLocked: Boolean
|
||||||
"The amount of likes the comment has"
|
"The amount of likes the comment has"
|
||||||
likeCount: Int!
|
likeCount: Int!
|
||||||
"The users who liked the comment"
|
"The users who liked the comment"
|
||||||
@ -3651,6 +3755,8 @@ type User {
|
|||||||
"The user's banner images"
|
"The user's banner images"
|
||||||
bannerImage: String
|
bannerImage: String
|
||||||
bans: Json
|
bans: Json
|
||||||
|
"When the user's account was created. (Does not exist for accounts created before 2020)"
|
||||||
|
createdAt: Int
|
||||||
"Custom donation badge text"
|
"Custom donation badge text"
|
||||||
donatorBadge: String
|
donatorBadge: String
|
||||||
"The donation tier of the user"
|
"The donation tier of the user"
|
||||||
@ -3670,12 +3776,16 @@ type User {
|
|||||||
isFollowing: Boolean
|
isFollowing: Boolean
|
||||||
"The user's media list options"
|
"The user's media list options"
|
||||||
mediaListOptions: MediaListOptions
|
mediaListOptions: MediaListOptions
|
||||||
|
"The user's moderator roles if they are a site moderator"
|
||||||
|
moderatorRoles: [ModRole]
|
||||||
"If the user is a moderator or data moderator"
|
"If the user is a moderator or data moderator"
|
||||||
moderatorStatus: String
|
moderatorStatus: String @deprecated(reason: "Deprecated. Replaced with moderatorRoles field.")
|
||||||
"The name of the user"
|
"The name of the user"
|
||||||
name: String!
|
name: String!
|
||||||
"The user's general options"
|
"The user's general options"
|
||||||
options: UserOptions
|
options: UserOptions
|
||||||
|
"The user's previously used names."
|
||||||
|
previousNames: [UserPreviousName]
|
||||||
"The url for the user page on the AniList website"
|
"The url for the user page on the AniList website"
|
||||||
siteUrl: String
|
siteUrl: String
|
||||||
"The users anime & manga list statistics"
|
"The users anime & manga list statistics"
|
||||||
@ -3747,7 +3857,9 @@ type UserModData {
|
|||||||
alts: [User]
|
alts: [User]
|
||||||
bans: Json
|
bans: Json
|
||||||
counts: Json
|
counts: Json
|
||||||
|
email: String
|
||||||
ip: Json
|
ip: Json
|
||||||
|
privacy: Int
|
||||||
}
|
}
|
||||||
|
|
||||||
"A user's general options"
|
"A user's general options"
|
||||||
@ -3762,12 +3874,24 @@ type UserOptions {
|
|||||||
notificationOptions: [NotificationOption]
|
notificationOptions: [NotificationOption]
|
||||||
"Profile highlight color (blue, purple, pink, orange, red, green, gray)"
|
"Profile highlight color (blue, purple, pink, orange, red, green, gray)"
|
||||||
profileColor: String
|
profileColor: String
|
||||||
|
"The language the user wants to see staff and character names in"
|
||||||
|
staffNameLanguage: UserStaffNameLanguage
|
||||||
"The user's timezone offset (Auth user only)"
|
"The user's timezone offset (Auth user only)"
|
||||||
timezone: String
|
timezone: String
|
||||||
"The language the user wants to see media titles in"
|
"The language the user wants to see media titles in"
|
||||||
titleLanguage: UserTitleLanguage
|
titleLanguage: UserTitleLanguage
|
||||||
}
|
}
|
||||||
|
|
||||||
|
"A user's previous name"
|
||||||
|
type UserPreviousName {
|
||||||
|
"When the user first changed from this name."
|
||||||
|
createdAt: Int
|
||||||
|
"A previous name of the user."
|
||||||
|
name: String
|
||||||
|
"When the user most recently changed from this name."
|
||||||
|
updatedAt: Int
|
||||||
|
}
|
||||||
|
|
||||||
type UserReleaseYearStatistic {
|
type UserReleaseYearStatistic {
|
||||||
chaptersRead: Int!
|
chaptersRead: Int!
|
||||||
count: Int!
|
count: Int!
|
||||||
@ -4127,24 +4251,36 @@ enum MediaSort {
|
|||||||
|
|
||||||
"Source type the media was adapted from"
|
"Source type the media was adapted from"
|
||||||
enum MediaSource {
|
enum MediaSource {
|
||||||
"Version 2 only. Japanese Anime"
|
"Version 2+ only. Japanese Anime"
|
||||||
ANIME
|
ANIME
|
||||||
"Version 2 only. Self-published works"
|
"Version 3 only. Comics excluding manga"
|
||||||
|
COMIC
|
||||||
|
"Version 2+ only. Self-published works"
|
||||||
DOUJINSHI
|
DOUJINSHI
|
||||||
|
"Version 3 only. Games excluding video games"
|
||||||
|
GAME
|
||||||
"Written work published in volumes"
|
"Written work published in volumes"
|
||||||
LIGHT_NOVEL
|
LIGHT_NOVEL
|
||||||
|
"Version 3 only. Live action media such as movies or TV show"
|
||||||
|
LIVE_ACTION
|
||||||
"Asian comic book"
|
"Asian comic book"
|
||||||
MANGA
|
MANGA
|
||||||
"Version 2 only. Written works not published in volumes"
|
"Version 3 only. Multimedia project"
|
||||||
|
MULTIMEDIA_PROJECT
|
||||||
|
"Version 2+ only. Written works not published in volumes"
|
||||||
NOVEL
|
NOVEL
|
||||||
"An original production not based of another work"
|
"An original production not based of another work"
|
||||||
ORIGINAL
|
ORIGINAL
|
||||||
"Other"
|
"Other"
|
||||||
OTHER
|
OTHER
|
||||||
|
"Version 3 only. Picture book"
|
||||||
|
PICTURE_BOOK
|
||||||
"Video game"
|
"Video game"
|
||||||
VIDEO_GAME
|
VIDEO_GAME
|
||||||
"Video game driven primary by text and narrative"
|
"Video game driven primary by text and narrative"
|
||||||
VISUAL_NOVEL
|
VISUAL_NOVEL
|
||||||
|
"Version 3 only. Written works published online"
|
||||||
|
WEB_NOVEL
|
||||||
}
|
}
|
||||||
|
|
||||||
"The current releasing status of the media"
|
"The current releasing status of the media"
|
||||||
@ -4198,6 +4334,36 @@ enum ModActionType {
|
|||||||
RESET
|
RESET
|
||||||
}
|
}
|
||||||
|
|
||||||
|
"Mod role enums"
|
||||||
|
enum ModRole {
|
||||||
|
"An AniList administrator"
|
||||||
|
ADMIN
|
||||||
|
"An anime data moderator"
|
||||||
|
ANIME_DATA
|
||||||
|
"A community moderator"
|
||||||
|
COMMUNITY
|
||||||
|
"An AniList developer"
|
||||||
|
DEVELOPER
|
||||||
|
"A discord community moderator"
|
||||||
|
DISCORD_COMMUNITY
|
||||||
|
"A lead anime data moderator"
|
||||||
|
LEAD_ANIME_DATA
|
||||||
|
"A lead community moderator"
|
||||||
|
LEAD_COMMUNITY
|
||||||
|
"A head developer of AniList"
|
||||||
|
LEAD_DEVELOPER
|
||||||
|
"A lead manga data moderator"
|
||||||
|
LEAD_MANGA_DATA
|
||||||
|
"A lead social media moderator"
|
||||||
|
LEAD_SOCIAL_MEDIA
|
||||||
|
"A manga data moderator"
|
||||||
|
MANGA_DATA
|
||||||
|
"A retired moderator"
|
||||||
|
RETIRED
|
||||||
|
"A social media moderator"
|
||||||
|
SOCIAL_MEDIA
|
||||||
|
}
|
||||||
|
|
||||||
"Notification type enum"
|
"Notification type enum"
|
||||||
enum NotificationType {
|
enum NotificationType {
|
||||||
"A user has liked your activity"
|
"A user has liked your activity"
|
||||||
@ -4216,6 +4382,12 @@ enum NotificationType {
|
|||||||
AIRING
|
AIRING
|
||||||
"A user has followed you"
|
"A user has followed you"
|
||||||
FOLLOWING
|
FOLLOWING
|
||||||
|
"An anime or manga has had a data change that affects how a user may track it in their lists"
|
||||||
|
MEDIA_DATA_CHANGE
|
||||||
|
"An anime or manga on the user's list has been deleted from the site"
|
||||||
|
MEDIA_DELETION
|
||||||
|
"Anime or manga entries on the user's list have been merged into a single entry"
|
||||||
|
MEDIA_MERGE
|
||||||
"A new anime or manga has been added to the site where its related media is on the user's list"
|
"A new anime or manga has been added to the site where its related media is on the user's list"
|
||||||
RELATED_MEDIA_ADDITION
|
RELATED_MEDIA_ADDITION
|
||||||
"A user has liked your forum comment"
|
"A user has liked your forum comment"
|
||||||
@ -4399,6 +4571,16 @@ enum UserSort {
|
|||||||
WATCHED_TIME_DESC
|
WATCHED_TIME_DESC
|
||||||
}
|
}
|
||||||
|
|
||||||
|
"The language the user wants to see staff and character names in"
|
||||||
|
enum UserStaffNameLanguage {
|
||||||
|
"The staff or character's name in their native language"
|
||||||
|
NATIVE
|
||||||
|
"The romanization of the staff or character's native name"
|
||||||
|
ROMAJI
|
||||||
|
"The romanization of the staff or character's native name, with western name ordering"
|
||||||
|
ROMAJI_WESTERN
|
||||||
|
}
|
||||||
|
|
||||||
"User statistics sort enum"
|
"User statistics sort enum"
|
||||||
enum UserStatisticsSort {
|
enum UserStatisticsSort {
|
||||||
COUNT
|
COUNT
|
||||||
@ -4427,6 +4609,14 @@ enum UserTitleLanguage {
|
|||||||
ROMAJI_STYLISED
|
ROMAJI_STYLISED
|
||||||
}
|
}
|
||||||
|
|
||||||
|
"ISO 3166-1 alpha-2 country code"
|
||||||
|
scalar CountryCode
|
||||||
|
|
||||||
|
"8 digit long date integer (YYYYMMDD). Unknown dates represented by 0. E.g. 2016: 20160000, May 1976: 19760500"
|
||||||
|
scalar FuzzyDateInt
|
||||||
|
|
||||||
|
scalar Json
|
||||||
|
|
||||||
input AiringScheduleInput {
|
input AiringScheduleInput {
|
||||||
airingAt: Int
|
airingAt: Int
|
||||||
episode: Int
|
episode: Int
|
||||||
@ -4521,12 +4711,3 @@ input StaffNameInput {
|
|||||||
"The person's full name in their native language"
|
"The person's full name in their native language"
|
||||||
native: String
|
native: String
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
scalar Json
|
|
||||||
|
|
||||||
"ISO 3166-1 alpha-2 country code"
|
|
||||||
scalar CountryCode
|
|
||||||
|
|
||||||
"8 digit long date integer (YYYYMMDD). Unknown dates represented by 0. E.g. 2016: 20160000, May 1976: 19760500"
|
|
||||||
scalar FuzzyDateInt
|
|
@ -17,7 +17,6 @@
|
|||||||
namespace Aviat\AnimeClient\API;
|
namespace Aviat\AnimeClient\API;
|
||||||
|
|
||||||
use Psr\SimpleCache\CacheInterface;
|
use Psr\SimpleCache\CacheInterface;
|
||||||
use Psr\SimpleCache\InvalidArgumentException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper methods for dealing with the Cache
|
* Helper methods for dealing with the Cache
|
||||||
|
@ -23,7 +23,6 @@ use const Aviat\AnimeClient\SESSION_SEGMENT;
|
|||||||
use Aviat\AnimeClient\Kitsu as K;
|
use Aviat\AnimeClient\Kitsu as K;
|
||||||
use Aviat\AnimeClient\API\CacheTrait;
|
use Aviat\AnimeClient\API\CacheTrait;
|
||||||
use Aviat\Ion\Di\{ContainerAware, ContainerInterface};
|
use Aviat\Ion\Di\{ContainerAware, ContainerInterface};
|
||||||
use Aviat\Ion\Di\Exception\{ContainerException, NotFoundException};
|
|
||||||
use Aviat\Ion\Event;
|
use Aviat\Ion\Event;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -129,11 +128,11 @@ final class Auth {
|
|||||||
{
|
{
|
||||||
if (PHP_SAPI === 'cli')
|
if (PHP_SAPI === 'cli')
|
||||||
{
|
{
|
||||||
return $this->segment->get('auth_token', NULL)
|
return $this->segment->get('auth_token')
|
||||||
?? $this->cache->get(K::AUTH_TOKEN_CACHE_KEY, NULL);
|
?? $this->cache->get(K::AUTH_TOKEN_CACHE_KEY);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->segment->get('auth_token', NULL);
|
return $this->segment->get('auth_token');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -146,7 +145,7 @@ final class Auth {
|
|||||||
if (PHP_SAPI === 'cli')
|
if (PHP_SAPI === 'cli')
|
||||||
{
|
{
|
||||||
return $this->segment->get('refresh_token')
|
return $this->segment->get('refresh_token')
|
||||||
?? $this->cache->get(K::AUTH_TOKEN_REFRESH_CACHE_KEY, NULL);
|
?? $this->cache->get(K::AUTH_TOKEN_REFRESH_CACHE_KEY);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->segment->get('refresh_token');
|
return $this->segment->get('refresh_token');
|
||||||
|
@ -16,17 +16,10 @@
|
|||||||
|
|
||||||
namespace Aviat\AnimeClient\API\Kitsu;
|
namespace Aviat\AnimeClient\API\Kitsu;
|
||||||
|
|
||||||
use Aviat\Ion\Di\Exception\ContainerException;
|
|
||||||
use Aviat\Ion\Di\Exception\NotFoundException;
|
|
||||||
|
|
||||||
use function Amp\Promise\wait;
|
|
||||||
use function Aviat\AnimeClient\getResponse;
|
|
||||||
|
|
||||||
use Amp\Http\Client\Request;
|
use Amp\Http\Client\Request;
|
||||||
use Aviat\AnimeClient\API\AbstractListItem;
|
use Aviat\AnimeClient\API\AbstractListItem;
|
||||||
use Aviat\AnimeClient\Types\FormItemData;
|
use Aviat\AnimeClient\Types\FormItemData;
|
||||||
use Aviat\Ion\Di\ContainerAware;
|
use Aviat\Ion\Di\ContainerAware;
|
||||||
use Aviat\Ion\Json;
|
|
||||||
|
|
||||||
use Throwable;
|
use Throwable;
|
||||||
|
|
||||||
|
@ -44,6 +44,7 @@ use Aviat\Ion\{
|
|||||||
use Generator;
|
use Generator;
|
||||||
use function Amp\Promise\wait;
|
use function Amp\Promise\wait;
|
||||||
use function Aviat\AnimeClient\getApiClient;
|
use function Aviat\AnimeClient\getApiClient;
|
||||||
|
use const Aviat\AnimeClient\SESSION_SEGMENT;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Kitsu API Model
|
* Kitsu API Model
|
||||||
@ -707,9 +708,14 @@ final class Model {
|
|||||||
|
|
||||||
$rawData = Json::decode($json);
|
$rawData = Json::decode($json);
|
||||||
$data = $rawData['data']['findProfileBySlug']['library']['all'] ?? [];
|
$data = $rawData['data']['findProfileBySlug']['library']['all'] ?? [];
|
||||||
$page = $data['pageInfo'];
|
$page = $data['pageInfo'] ?? [];
|
||||||
if (empty($data))
|
if (empty($data))
|
||||||
{
|
{
|
||||||
|
// Clear session, in case the error is an invalid token.
|
||||||
|
$segment = $this->container->get('session')
|
||||||
|
->getSegment(SESSION_SEGMENT);
|
||||||
|
$segment->clear();
|
||||||
|
|
||||||
// @TODO Proper Error logging
|
// @TODO Proper Error logging
|
||||||
dump($rawData);
|
dump($rawData);
|
||||||
die();
|
die();
|
||||||
@ -719,7 +725,7 @@ final class Model {
|
|||||||
|
|
||||||
yield $emit($data['nodes']);
|
yield $emit($data['nodes']);
|
||||||
|
|
||||||
if ($page['hasNextPage'] === FALSE)
|
if ($page['hasNextPage'] !== TRUE)
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -18,7 +18,6 @@ namespace Aviat\AnimeClient\API\Kitsu;
|
|||||||
|
|
||||||
use Amp\Http\Client\Request;
|
use Amp\Http\Client\Request;
|
||||||
use Aviat\AnimeClient\Types\FormItem;
|
use Aviat\AnimeClient\Types\FormItem;
|
||||||
use Aviat\Banker\Exception\InvalidArgumentException;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Kitsu API calls that mutate data, C/U/D parts of CRUD
|
* Kitsu API calls that mutate data, C/U/D parts of CRUD
|
||||||
|
@ -192,16 +192,13 @@ final class RequestBuilder extends APIRequestBuilder {
|
|||||||
$request = $this->setUpRequest($type, $url, $options);
|
$request = $this->setUpRequest($type, $url, $options);
|
||||||
$response = getResponse($request);
|
$response = getResponse($request);
|
||||||
|
|
||||||
if ($logger !== NULL)
|
$logger?->debug('Kitsu API Response', [
|
||||||
{
|
|
||||||
$logger->debug('Kitsu API Response', [
|
|
||||||
'status' => $response->getStatus(),
|
'status' => $response->getStatus(),
|
||||||
'reason' => $response->getReason(),
|
'reason' => $response->getReason(),
|
||||||
'body' => $response->getBody(),
|
'body' => $response->getBody(),
|
||||||
'headers' => $response->getHeaders(),
|
'headers' => $response->getHeaders(),
|
||||||
'requestHeaders' => $request->getHeaders(),
|
'requestHeaders' => $request->getHeaders(),
|
||||||
]);
|
]);
|
||||||
}
|
|
||||||
|
|
||||||
return $response;
|
return $response;
|
||||||
}
|
}
|
||||||
|
@ -27,7 +27,7 @@ trait RequestBuilderTrait {
|
|||||||
* Set the request builder object
|
* Set the request builder object
|
||||||
*
|
*
|
||||||
* @param RequestBuilder $requestBuilder
|
* @param RequestBuilder $requestBuilder
|
||||||
* @return $this
|
* @return RequestBuilderTrait|ListItem|Model
|
||||||
*/
|
*/
|
||||||
public function setRequestBuilder(RequestBuilder $requestBuilder): self
|
public function setRequestBuilder(RequestBuilder $requestBuilder): self
|
||||||
{
|
{
|
||||||
|
@ -136,7 +136,7 @@ final class AnimeTransformer extends AbstractTransformer {
|
|||||||
'show_type' => $base['subtype'],
|
'show_type' => $base['subtype'],
|
||||||
'status' => Kitsu::getAiringStatus($base['startDate'], $base['endDate']),
|
'status' => Kitsu::getAiringStatus($base['startDate'], $base['endDate']),
|
||||||
'streaming_links' => Kitsu::parseStreamingLinks($base['streamingLinks']['nodes'] ?? []),
|
'streaming_links' => Kitsu::parseStreamingLinks($base['streamingLinks']['nodes'] ?? []),
|
||||||
'synopsis' => $base['description']['en'],
|
'synopsis' => $base['description']['en'] ?? '',
|
||||||
'title' => $title,
|
'title' => $title,
|
||||||
'titles' => $titles,
|
'titles' => $titles,
|
||||||
'titles_more' => $titles_more,
|
'titles_more' => $titles_more,
|
||||||
|
@ -16,7 +16,6 @@
|
|||||||
|
|
||||||
namespace Aviat\AnimeClient\Command;
|
namespace Aviat\AnimeClient\Command;
|
||||||
|
|
||||||
use Aviat\AnimeClient\Kitsu;
|
|
||||||
use Aviat\Ion\Di\Exception\ContainerException;
|
use Aviat\Ion\Di\Exception\ContainerException;
|
||||||
use Aviat\Ion\Di\Exception\NotFoundException;
|
use Aviat\Ion\Di\Exception\NotFoundException;
|
||||||
use function Aviat\AnimeClient\clearCache;
|
use function Aviat\AnimeClient\clearCache;
|
||||||
|
@ -203,7 +203,7 @@ final class SyncLists extends BaseCommand {
|
|||||||
*
|
*
|
||||||
* @param string $type
|
* @param string $type
|
||||||
* @param array $data
|
* @param array $data
|
||||||
* @return array|array[]
|
* @return array
|
||||||
*/
|
*/
|
||||||
protected function compare(string $type, array $data): array
|
protected function compare(string $type, array $data): array
|
||||||
{
|
{
|
||||||
|
@ -375,10 +375,10 @@ class Controller {
|
|||||||
* @param array $data
|
* @param array $data
|
||||||
* @param HtmlView|NULL $view
|
* @param HtmlView|NULL $view
|
||||||
* @param int $code
|
* @param int $code
|
||||||
* @throws InvalidArgumentException
|
|
||||||
* @return void
|
* @return void
|
||||||
|
*@throws InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
protected function outputHTML(string $template, array $data = [], $view = NULL, int $code = 200): void
|
protected function outputHTML(string $template, array $data = [], HtmlView $view = NULL, int $code = 200): void
|
||||||
{
|
{
|
||||||
if (NULL === $view)
|
if (NULL === $view)
|
||||||
{
|
{
|
||||||
|
@ -66,15 +66,13 @@ final class Anime extends BaseController {
|
|||||||
/**
|
/**
|
||||||
* Show a portion, or all of the anime list
|
* Show a portion, or all of the anime list
|
||||||
*
|
*
|
||||||
* @param string|int $status - The section of the list
|
* @param int|string $status - The section of the list
|
||||||
* @param string|null $view - List or cover view
|
* @param string|null $view - List or cover view
|
||||||
* @throws ContainerException
|
* @return void
|
||||||
* @throws NotFoundException
|
|
||||||
* @throws InvalidArgumentException
|
* @throws InvalidArgumentException
|
||||||
* @throws Throwable
|
* @throws Throwable
|
||||||
* @return void
|
|
||||||
*/
|
*/
|
||||||
public function index($status = KitsuWatchingStatus::WATCHING, ?string $view = NULL): void
|
public function index(int|string $status = KitsuWatchingStatus::WATCHING, ?string $view = NULL): void
|
||||||
{
|
{
|
||||||
if ( ! in_array($status, [
|
if ( ! in_array($status, [
|
||||||
'all',
|
'all',
|
||||||
@ -178,7 +176,7 @@ final class Anime extends BaseController {
|
|||||||
* @param string $id
|
* @param string $id
|
||||||
* @param string $status
|
* @param string $status
|
||||||
*/
|
*/
|
||||||
public function edit(string $id, $status = 'all'): void
|
public function edit(string $id, string $status = 'all'): void
|
||||||
{
|
{
|
||||||
$this->checkAuth();
|
$this->checkAuth();
|
||||||
|
|
||||||
|
@ -239,8 +239,6 @@ final class AnimeCollection extends BaseController {
|
|||||||
* Update a collection item
|
* Update a collection item
|
||||||
*
|
*
|
||||||
* @param array $data
|
* @param array $data
|
||||||
* @throws ContainerException
|
|
||||||
* @throws NotFoundException
|
|
||||||
*/
|
*/
|
||||||
protected function update(array $data): void
|
protected function update(array $data): void
|
||||||
{
|
{
|
||||||
|
@ -78,8 +78,6 @@ final class History extends BaseController {
|
|||||||
'url_type' => 'anime',
|
'url_type' => 'anime',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// $this->outputJSON($this->animeModel->getHistory());
|
|
||||||
// return;
|
|
||||||
$this->outputHTML('history', [
|
$this->outputHTML('history', [
|
||||||
'title' => $this->formatTitle(
|
'title' => $this->formatTitle(
|
||||||
$this->config->get('whose_list') . "'s Anime List",
|
$this->config->get('whose_list') . "'s Anime List",
|
||||||
@ -98,8 +96,6 @@ final class History extends BaseController {
|
|||||||
'url_type' => 'manga',
|
'url_type' => 'manga',
|
||||||
]);
|
]);
|
||||||
|
|
||||||
// $this->outputJSON($this->mangaModel->getHistory());
|
|
||||||
// return;
|
|
||||||
$this->outputHTML('history', [
|
$this->outputHTML('history', [
|
||||||
'title' => $this->formatTitle(
|
'title' => $this->formatTitle(
|
||||||
$this->config->get('whose_list') . "'s Manga List",
|
$this->config->get('whose_list') . "'s Manga List",
|
||||||
|
@ -16,8 +16,6 @@
|
|||||||
|
|
||||||
namespace Aviat\AnimeClient\Controller;
|
namespace Aviat\AnimeClient\Controller;
|
||||||
|
|
||||||
use Aviat\Ion\Di\Exception\{ContainerException, NotFoundException};
|
|
||||||
|
|
||||||
use function Amp\Promise\wait;
|
use function Amp\Promise\wait;
|
||||||
use function Aviat\AnimeClient\getResponse;
|
use function Aviat\AnimeClient\getResponse;
|
||||||
use function Aviat\AnimeClient\createPlaceholderImage;
|
use function Aviat\AnimeClient\createPlaceholderImage;
|
||||||
@ -39,7 +37,7 @@ final class Images extends BaseController {
|
|||||||
* @return void
|
* @return void
|
||||||
* @throws Throwable
|
* @throws Throwable
|
||||||
*/
|
*/
|
||||||
public function cache(string $type, string $file, $display = TRUE): void
|
public function cache(string $type, string $file, bool $display = TRUE): void
|
||||||
{
|
{
|
||||||
$currentUrl = (string)$this->request->getUri();
|
$currentUrl = (string)$this->request->getUri();
|
||||||
|
|
||||||
|
@ -64,10 +64,10 @@ final class Manga extends Controller {
|
|||||||
*
|
*
|
||||||
* @param string $status
|
* @param string $status
|
||||||
* @param string $view
|
* @param string $view
|
||||||
* @throws InvalidArgumentException
|
|
||||||
* @return void
|
* @return void
|
||||||
|
*@throws InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
public function index($status = 'all', $view = ''): void
|
public function index(string $status = 'all', string $view = ''): void
|
||||||
{
|
{
|
||||||
if ( ! in_array($status, [
|
if ( ! in_array($status, [
|
||||||
'all',
|
'all',
|
||||||
|
@ -52,8 +52,6 @@ final class People extends BaseController {
|
|||||||
*
|
*
|
||||||
* @param string $slug
|
* @param string $slug
|
||||||
* @return void
|
* @return void
|
||||||
* @throws ContainerException
|
|
||||||
* @throws NotFoundException
|
|
||||||
*/
|
*/
|
||||||
public function index(string $slug): void
|
public function index(string $slug): void
|
||||||
{
|
{
|
||||||
|
@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
namespace Aviat\AnimeClient;
|
namespace Aviat\AnimeClient;
|
||||||
|
|
||||||
|
use Aviat\AnimeClient\Enum\EventType;
|
||||||
|
use Aviat\Ion\Event;
|
||||||
use Aviat\Ion\Json;
|
use Aviat\Ion\Json;
|
||||||
use Aura\Router\{
|
use Aura\Router\{
|
||||||
Map,
|
Map,
|
||||||
@ -27,7 +29,6 @@ use Aviat\AnimeClient\API\FailedResponseException;
|
|||||||
use Aviat\Ion\Di\ContainerInterface;
|
use Aviat\Ion\Di\ContainerInterface;
|
||||||
use Aviat\Ion\Friend;
|
use Aviat\Ion\Friend;
|
||||||
use Aviat\Ion\Type\StringType;
|
use Aviat\Ion\Type\StringType;
|
||||||
use JetBrains\PhpStorm\ArrayShape;
|
|
||||||
use LogicException;
|
use LogicException;
|
||||||
use ReflectionException;
|
use ReflectionException;
|
||||||
|
|
||||||
@ -117,7 +118,7 @@ final class Dispatcher extends RoutingBase {
|
|||||||
* @return void
|
* @return void
|
||||||
* @throws ReflectionException
|
* @throws ReflectionException
|
||||||
*/
|
*/
|
||||||
public function __invoke($route = NULL): void
|
public function __invoke(object $route = NULL): void
|
||||||
{
|
{
|
||||||
$logger = $this->container->getLogger();
|
$logger = $this->container->getLogger();
|
||||||
|
|
||||||
@ -136,7 +137,7 @@ final class Dispatcher extends RoutingBase {
|
|||||||
{
|
{
|
||||||
// If not route was matched, return an appropriate http
|
// If not route was matched, return an appropriate http
|
||||||
// error message
|
// error message
|
||||||
$errorRoute = (array)$this->getErrorParams();
|
$errorRoute = $this->getErrorParams();
|
||||||
$controllerName = DEFAULT_CONTROLLER;
|
$controllerName = DEFAULT_CONTROLLER;
|
||||||
$actionMethod = $errorRoute['action_method'];
|
$actionMethod = $errorRoute['action_method'];
|
||||||
$params = $errorRoute['params'];
|
$params = $errorRoute['params'];
|
||||||
@ -278,17 +279,14 @@ final class Dispatcher extends RoutingBase {
|
|||||||
*/
|
*/
|
||||||
protected function call(string $controllerName, string $method, array $params): void
|
protected function call(string $controllerName, string $method, array $params): void
|
||||||
{
|
{
|
||||||
$logger = $this->container->getLogger('default');
|
$logger = $this->container->getLogger();
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
$controller = new $controllerName($this->container);
|
$controller = new $controllerName($this->container);
|
||||||
|
|
||||||
// Run the appropriate controller method
|
// Run the appropriate controller method
|
||||||
if ($logger !== NULL)
|
$logger?->debug('Dispatcher - controller arguments', $params);
|
||||||
{
|
|
||||||
$logger->debug('Dispatcher - controller arguments', $params);
|
|
||||||
}
|
|
||||||
|
|
||||||
$params = array_values($params);
|
$params = array_values($params);
|
||||||
$controller->$method(...$params);
|
$controller->$method(...$params);
|
||||||
@ -360,7 +358,7 @@ final class Dispatcher extends RoutingBase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Select controller based on the current url, and apply its relevent routes
|
* Select controller based on the current url, and apply its relevant routes
|
||||||
*
|
*
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
|
@ -16,17 +16,8 @@
|
|||||||
|
|
||||||
namespace Aviat\AnimeClient\Model;
|
namespace Aviat\AnimeClient\Model;
|
||||||
|
|
||||||
use Aviat\AnimeClient\API\ParallelAPIRequest;
|
|
||||||
use Aviat\AnimeClient\API\Mapping\AnimeWatchingStatus;
|
use Aviat\AnimeClient\API\Mapping\AnimeWatchingStatus;
|
||||||
use Aviat\AnimeClient\Types\{
|
use Aviat\AnimeClient\Types\Anime as AnimeType;
|
||||||
Anime as AnimeType,
|
|
||||||
FormItem,
|
|
||||||
AnimeListItem
|
|
||||||
};
|
|
||||||
use Aviat\Ion\Json;
|
|
||||||
|
|
||||||
use Throwable;
|
|
||||||
use function is_array;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Model for handling requests dealing with the anime list
|
* Model for handling requests dealing with the anime list
|
||||||
@ -64,7 +55,7 @@ class Anime extends API {
|
|||||||
{
|
{
|
||||||
$data = $this->kitsuModel->getFullOrganizedAnimeList();
|
$data = $this->kitsuModel->getFullOrganizedAnimeList();
|
||||||
|
|
||||||
foreach($data as $section => &$list)
|
foreach($data as &$list)
|
||||||
{
|
{
|
||||||
$this->sortByName($list, 'anime');
|
$this->sortByName($list, 'anime');
|
||||||
}
|
}
|
||||||
|
@ -578,7 +578,7 @@ final class AnimeCollection extends Collection {
|
|||||||
* @param string $animeId The current anime
|
* @param string $animeId The current anime
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
private function updateGenres($animeId): void
|
private function updateGenres(string $animeId): void
|
||||||
{
|
{
|
||||||
if ($this->db === NULL)
|
if ($this->db === NULL)
|
||||||
{
|
{
|
||||||
|
@ -46,8 +46,6 @@ class Util {
|
|||||||
* Set up the Util class
|
* Set up the Util class
|
||||||
*
|
*
|
||||||
* @param ContainerInterface $container
|
* @param ContainerInterface $container
|
||||||
* @throws ContainerException
|
|
||||||
* @throws NotFoundException
|
|
||||||
*/
|
*/
|
||||||
public function __construct(ContainerInterface $container)
|
public function __construct(ContainerInterface $container)
|
||||||
{
|
{
|
||||||
|
@ -45,10 +45,10 @@ class Config implements ConfigInterface {
|
|||||||
/**
|
/**
|
||||||
* Does the config item exist?
|
* Does the config item exist?
|
||||||
*
|
*
|
||||||
* @param string|int|array $key
|
* @param array|int|string $key
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function has($key): bool
|
public function has(array|int|string $key): bool
|
||||||
{
|
{
|
||||||
return $this->map->hasKey($key);
|
return $this->map->hasKey($key);
|
||||||
}
|
}
|
||||||
@ -60,7 +60,7 @@ class Config implements ConfigInterface {
|
|||||||
* @return mixed
|
* @return mixed
|
||||||
* @throws ConfigException
|
* @throws ConfigException
|
||||||
*/
|
*/
|
||||||
public function get($key = NULL)
|
public function get(array|string $key = NULL): mixed
|
||||||
{
|
{
|
||||||
if (\is_array($key))
|
if (\is_array($key))
|
||||||
{
|
{
|
||||||
@ -73,10 +73,10 @@ class Config implements ConfigInterface {
|
|||||||
/**
|
/**
|
||||||
* Remove a config value
|
* Remove a config value
|
||||||
*
|
*
|
||||||
* @param string|array $key
|
* @param array|string $key
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function delete($key): void
|
public function delete(array|string $key): void
|
||||||
{
|
{
|
||||||
if (\is_array($key))
|
if (\is_array($key))
|
||||||
{
|
{
|
||||||
@ -92,12 +92,12 @@ class Config implements ConfigInterface {
|
|||||||
/**
|
/**
|
||||||
* Set a config value
|
* Set a config value
|
||||||
*
|
*
|
||||||
* @param integer|string|array $key
|
* @param array|integer|string $key
|
||||||
* @param mixed $value
|
* @param mixed $value
|
||||||
* @throws InvalidArgumentException
|
|
||||||
* @return ConfigInterface
|
* @return ConfigInterface
|
||||||
|
*@throws InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
public function set($key, $value): ConfigInterface
|
public function set(array|int|string $key, mixed $value): ConfigInterface
|
||||||
{
|
{
|
||||||
if (\is_array($key))
|
if (\is_array($key))
|
||||||
{
|
{
|
||||||
|
@ -23,10 +23,10 @@ interface ConfigInterface {
|
|||||||
/**
|
/**
|
||||||
* Does the config item exist?
|
* Does the config item exist?
|
||||||
*
|
*
|
||||||
* @param string|int|array $key
|
* @param array|int|string $key
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function has($key): bool;
|
public function has(array|int|string $key): bool;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a config value
|
* Get a config value
|
||||||
@ -34,23 +34,23 @@ interface ConfigInterface {
|
|||||||
* @param array|string|null $key
|
* @param array|string|null $key
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function get($key = NULL);
|
public function get(array|string $key = NULL): mixed;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set a config value
|
* Set a config value
|
||||||
*
|
*
|
||||||
* @param integer|string|array $key
|
* @param array|integer|string $key
|
||||||
* @param mixed $value
|
* @param mixed $value
|
||||||
* @throws \InvalidArgumentException
|
|
||||||
* @return ConfigInterface
|
* @return ConfigInterface
|
||||||
|
* @throws \InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
public function set($key, $value): self;
|
public function set(array|int|string $key, mixed $value): self;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Remove a config value
|
* Remove a config value
|
||||||
*
|
*
|
||||||
* @param string|array $key
|
* @param array|string $key
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function delete($key): void;
|
public function delete(array|string $key): void;
|
||||||
}
|
}
|
@ -51,7 +51,7 @@ abstract class Enum {
|
|||||||
* @return boolean
|
* @return boolean
|
||||||
* @throws ReflectionException
|
* @throws ReflectionException
|
||||||
*/
|
*/
|
||||||
public static function isValid($key): bool
|
public static function isValid(mixed $key): bool
|
||||||
{
|
{
|
||||||
$values = array_values(static::getConstList());
|
$values = array_values(static::getConstList());
|
||||||
return in_array($key, $values, TRUE);
|
return in_array($key, $values, TRUE);
|
||||||
|
@ -31,7 +31,7 @@ class Friend {
|
|||||||
* Object to create a friend of
|
* Object to create a friend of
|
||||||
* @var mixed
|
* @var mixed
|
||||||
*/
|
*/
|
||||||
private $_friend_;
|
private mixed $_friend_;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reflection class of the object
|
* Reflection class of the object
|
||||||
@ -46,7 +46,7 @@ class Friend {
|
|||||||
* @throws InvalidArgumentException
|
* @throws InvalidArgumentException
|
||||||
* @throws \ReflectionException
|
* @throws \ReflectionException
|
||||||
*/
|
*/
|
||||||
public function __construct($obj)
|
public function __construct(mixed $obj)
|
||||||
{
|
{
|
||||||
if ( ! \is_object($obj))
|
if ( ! \is_object($obj))
|
||||||
{
|
{
|
||||||
@ -63,7 +63,7 @@ class Friend {
|
|||||||
* @param string $key
|
* @param string $key
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function __get(string $key)
|
public function __get(string $key): mixed
|
||||||
{
|
{
|
||||||
if ($this->__isset($key))
|
if ($this->__isset($key))
|
||||||
{
|
{
|
||||||
@ -96,7 +96,7 @@ class Friend {
|
|||||||
* @param mixed $value
|
* @param mixed $value
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public function __set(string $key, $value)
|
public function __set(string $key, mixed $value)
|
||||||
{
|
{
|
||||||
if ($this->__isset($key))
|
if ($this->__isset($key))
|
||||||
{
|
{
|
||||||
|
@ -93,7 +93,7 @@ class HttpView implements HttpViewInterface{
|
|||||||
* @param string|string[] $value
|
* @param string|string[] $value
|
||||||
* @return HttpView
|
* @return HttpView
|
||||||
*/
|
*/
|
||||||
public function addHeader(string $name, $value): self
|
public function addHeader(string $name, array|string $value): self
|
||||||
{
|
{
|
||||||
$this->response = $this->response->withHeader($name, $value);
|
$this->response = $this->response->withHeader($name, $value);
|
||||||
return $this;
|
return $this;
|
||||||
@ -105,7 +105,7 @@ class HttpView implements HttpViewInterface{
|
|||||||
* @param mixed $string
|
* @param mixed $string
|
||||||
* @return HttpViewInterface
|
* @return HttpViewInterface
|
||||||
*/
|
*/
|
||||||
public function setOutput($string): HttpViewInterface
|
public function setOutput(mixed $string): HttpViewInterface
|
||||||
{
|
{
|
||||||
$this->response->getBody()->write($string);
|
$this->response->getBody()->write($string);
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ interface ViewInterface {
|
|||||||
* @param mixed $string
|
* @param mixed $string
|
||||||
* @return ViewInterface
|
* @return ViewInterface
|
||||||
*/
|
*/
|
||||||
public function setOutput($string): self;
|
public function setOutput(mixed $string): self;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Append additional output.
|
* Append additional output.
|
||||||
@ -54,7 +54,7 @@ interface ViewInterface {
|
|||||||
* @param string|string[] $value
|
* @param string|string[] $value
|
||||||
* @return ViewInterface
|
* @return ViewInterface
|
||||||
*/
|
*/
|
||||||
public function addHeader(string $name, $value): self;
|
public function addHeader(string $name, array|string $value): self;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the current output as a string. Does not
|
* Get the current output as a string. Does not
|
||||||
|
@ -20,7 +20,7 @@ use Aviat\Ion\Config;
|
|||||||
|
|
||||||
class ConfigTest extends IonTestCase {
|
class ConfigTest extends IonTestCase {
|
||||||
|
|
||||||
protected $config;
|
protected Config $config;
|
||||||
|
|
||||||
public function setUp(): void
|
public function setUp(): void
|
||||||
{
|
{
|
||||||
@ -66,12 +66,6 @@ class ConfigTest extends IonTestCase {
|
|||||||
$this->assertEquals('great', $this->config->get(['apple', 'sauce', 'is']), "Array argument get for config failed.");
|
$this->assertEquals('great', $this->config->get(['apple', 'sauce', 'is']), "Array argument get for config failed.");
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testConfigBadSet(): void
|
|
||||||
{
|
|
||||||
$this->expectException('InvalidArgumentException');
|
|
||||||
$this->config->set(NULL, FALSE);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function dataConfigDelete(): array
|
public function dataConfigDelete(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
|
Loading…
Reference in New Issue
Block a user