Version 5.1 - All the GraphQL #32

Closed
timw4mail wants to merge 1160 commits from develop into master
9 changed files with 290 additions and 8 deletions
Showing only changes of commit b3474ddff2 - Show all commits

View File

@ -0,0 +1,159 @@
query ($id: Int) {
Media(type: ANIME, idMal:$id) {
id
idMal
isAdult
season
title {
romaji
english
native
userPreferred
}
description(asHtml: true)
duration
format
status
chapters
volumes
genres
synonyms
countryOfOrigin
source
startDate {
year
month
day
}
endDate {
year
month
day
}
trailer {
id
site
}
coverImage {
large
medium
}
bannerImage
tags {
id
name
description
category
isGeneralSpoiler
isMediaSpoiler
isAdult
}
characters {
edges {
role
voiceActors {
id
name {
first
last
native
}
language
image {
large
medium
}
description(asHtml: true)
siteUrl
}
node {
id
name {
first
last
native
}
image {
large
medium
}
description
siteUrl
}
}
pageInfo {
total
perPage
currentPage
lastPage
hasNextPage
}
}
staff {
edges {
role
node {
id
name {
first
last
native
}
language
image {
large
medium
}
description(asHtml: true)
siteUrl
}
}
pageInfo {
total
perPage
currentPage
lastPage
hasNextPage
}
}
studios {
edges {
isMain
node {
name
siteUrl
}
}
pageInfo {
total
perPage
currentPage
lastPage
hasNextPage
}
}
externalLinks {
id
url
site
}
mediaListEntry {
id
userId
status
score
progress
progressVolumes
repeat
private
notes
}
streamingEpisodes {
title
thumbnail
url
site
}
siteUrl
}
}

View File

@ -0,0 +1,5 @@
query ($id: Int) {
Media (type: ANIME, malId: $id) {
id
}
}

View File

@ -0,0 +1,101 @@
query ($id: Int){
Media(type: MANGA, id: $id) {
id
idMal
isAdult
season
title {
romaji
english
native
userPreferred
}
description(asHtml:true)
duration
format
status
chapters
volumes
genres
synonyms
countryOfOrigin
source
startDate {
year
month
day
}
endDate {
year
month
day
}
trailer {
id
site
}
coverImage {
large
medium
}
bannerImage
tags {
id
name
description
category
isGeneralSpoiler
isMediaSpoiler
isAdult
}
characters {
edges {
id
}
nodes {
id
name {
first
last
native
}
image {
large
medium
}
description
siteUrl
}
pageInfo {
total
perPage
currentPage
lastPage
hasNextPage
}
}
externalLinks {
id
url
site
}
mediaListEntry {
id
userId
status
score
progress
progressVolumes
repeat
private
notes
}
streamingEpisodes {
title
thumbnail
url
site
}
siteUrl
}
}

View File

@ -0,0 +1,5 @@
query ($id: Int) {
Media (type: ANIME, malId: $id) {
id
}
}

View File

@ -24,6 +24,7 @@ query ($name: String) {
status status
episodes episodes
season season
seasonYear
genres genres
synonyms synonyms
countryOfOrigin countryOfOrigin

View File

@ -1,4 +1,4 @@
{query ($name: String) { query ($name: String) {
MediaListCollection(userName: $name, type: MANGA) { MediaListCollection(userName: $name, type: MANGA) {
lists { lists {
entries { entries {

View File

@ -16,6 +16,7 @@
namespace Aviat\AnimeClient\API\Anilist\Transformer; namespace Aviat\AnimeClient\API\Anilist\Transformer;
use Aviat\AnimeClient\Types\AnimeFormItem;
use Aviat\Ion\Transformer\AbstractTransformer; use Aviat\Ion\Transformer\AbstractTransformer;
class AnimeListTransformer extends AbstractTransformer { class AnimeListTransformer extends AbstractTransformer {
@ -24,4 +25,9 @@ class AnimeListTransformer extends AbstractTransformer {
{ {
} }
public function untransform(array $item): AnimeFormItem
{
return new AnimeFormItem($item);
}
} }

View File

@ -16,13 +16,18 @@
namespace Aviat\AnimeClient\API\Anilist\Transformer; namespace Aviat\AnimeClient\API\Anilist\Transformer;
use Aviat\AnimeClient\Types\MangaFormItem;
use Aviat\Ion\Transformer\AbstractTransformer; use Aviat\Ion\Transformer\AbstractTransformer;
class MangaListTransformer extends AbstractTransformer class MangaListTransformer extends AbstractTransformer {
{
public function transform($item) public function transform($item)
{ {
} }
public function untransform(array $item): MangaFormItem
{
return new MangaFormItem($item);
}
} }

View File

@ -17,7 +17,7 @@
namespace Aviat\AnimeClient\API\MAL\Transformer; namespace Aviat\AnimeClient\API\MAL\Transformer;
use Aviat\AnimeClient\API\Mapping\AnimeWatchingStatus; use Aviat\AnimeClient\API\Mapping\AnimeWatchingStatus;
use Aviat\AnimeClient\Types\{AnimeFormItem, AnimeFormItemData}; use Aviat\AnimeClient\Types\AnimeFormItem;
use Aviat\Ion\Transformer\AbstractTransformer; use Aviat\Ion\Transformer\AbstractTransformer;
/** /**
@ -43,10 +43,10 @@ final class AnimeListTransformer extends AbstractTransformer {
*/ */
public function untransform(array $item): AnimeFormItem public function untransform(array $item): AnimeFormItem
{ {
$map = new AnimeFormItem([ $map = [
'id' => $item['mal_id'], 'id' => $item['mal_id'],
'data' => new AnimeFormItemData([]), 'data' => [],
]); ];
foreach($item['data'] as $key => $value) foreach($item['data'] as $key => $value)
{ {
@ -81,6 +81,6 @@ final class AnimeListTransformer extends AbstractTransformer {
} }
} }
return $map; return new AnimeFormItem($map);
} }
} }