Version 5.1 - All the GraphQL #32
@ -123,13 +123,12 @@ trait AnilistTrait {
|
||||
*/
|
||||
public function runQuery(string $name, array $variables = []): array
|
||||
{
|
||||
$file = realpath(__DIR__ . "/GraphQL/Queries/{$name}.graphql");
|
||||
$file = realpath(__DIR__ . "/Queries/{$name}.graphql");
|
||||
if ( ! file_exists($file))
|
||||
{
|
||||
throw new LogicException('GraphQL query file does not exist.');
|
||||
}
|
||||
|
||||
// $query = str_replace(["\t", "\n"], ' ', file_get_contents($file));
|
||||
$query = file_get_contents($file);
|
||||
$body = [
|
||||
'query' => $query
|
||||
@ -157,13 +156,12 @@ trait AnilistTrait {
|
||||
*/
|
||||
public function mutateRequest (string $name, array $variables = []): Request
|
||||
{
|
||||
$file = realpath(__DIR__ . "/GraphQL/Mutations/{$name}.graphql");
|
||||
$file = realpath(__DIR__ . "/Mutations/{$name}.graphql");
|
||||
if (!file_exists($file))
|
||||
{
|
||||
throw new LogicException('GraphQL mutation file does not exist.');
|
||||
}
|
||||
|
||||
// $query = str_replace(["\t", "\n"], ' ', file_get_contents($file));
|
||||
$query = file_get_contents($file);
|
||||
|
||||
$body = [
|
||||
|
15
src/AnimeClient/API/Kitsu/.graphqlconfig
Normal file
15
src/AnimeClient/API/Kitsu/.graphqlconfig
Normal file
@ -0,0 +1,15 @@
|
||||
{
|
||||
"name": "Kitsu Schema",
|
||||
"schemaPath": "schema.graphql",
|
||||
"extensions": {
|
||||
"endpoints": {
|
||||
"Kitsu": {
|
||||
"url": "https://kitsu.io/api/graphql",
|
||||
"headers": {
|
||||
"user-agent": "JS GraphQL"
|
||||
},
|
||||
"introspect": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
{
|
||||
"name": "Kitsu Schema",
|
||||
"schemaPath": "schema.graphql",
|
||||
"extensions": {
|
||||
"endpoints": {
|
||||
"Anilist": {
|
||||
"url": "https://graphql.anilist.co",
|
||||
"headers": {
|
||||
"user-agent": "JS GraphQL"
|
||||
},
|
||||
"introspect": true
|
||||
},
|
||||
"Kitsu": {
|
||||
"url": "https://kitsu.io/api/graphql",
|
||||
"headers": {
|
||||
"user-agent": "JS GraphQL"
|
||||
},
|
||||
"introspect": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -193,13 +193,12 @@ final class KitsuRequestBuilder extends APIRequestBuilder {
|
||||
*/
|
||||
public function runQuery(string $name, array $variables = []): array
|
||||
{
|
||||
$file =__DIR__ . "/GraphQL/Queries/{$name}.graphql";
|
||||
$file = __DIR__ . "/Queries/{$name}.graphql";
|
||||
if ( ! file_exists($file))
|
||||
{
|
||||
throw new LogicException('GraphQL query file does not exist.');
|
||||
}
|
||||
|
||||
// $query = str_replace(["\t", "\n"], ' ', file_get_contents($file));
|
||||
$query = file_get_contents($file);
|
||||
$body = [
|
||||
'query' => $query
|
||||
@ -227,13 +226,12 @@ final class KitsuRequestBuilder extends APIRequestBuilder {
|
||||
*/
|
||||
public function mutateRequest (string $name, array $variables = []): Request
|
||||
{
|
||||
$file = __DIR__ . "/GraphQL/Mutations/{$name}.graphql";
|
||||
$file = __DIR__ . "/Mutations/{$name}.graphql";
|
||||
if ( ! file_exists($file))
|
||||
{
|
||||
throw new LogicException('GraphQL mutation file does not exist.');
|
||||
}
|
||||
|
||||
// $query = str_replace(["\t", "\n"], ' ', file_get_contents($file));
|
||||
$query = file_get_contents($file);
|
||||
$body = [
|
||||
'query' => $query
|
||||
|
@ -54,20 +54,6 @@ query ($slug: String!) {
|
||||
episodeCount
|
||||
episodeLength
|
||||
totalLength
|
||||
posterImage {
|
||||
original {
|
||||
height
|
||||
name
|
||||
url
|
||||
width
|
||||
}
|
||||
views {
|
||||
height
|
||||
name
|
||||
url
|
||||
width
|
||||
}
|
||||
}
|
||||
season
|
||||
sfw
|
||||
slug
|
@ -18,6 +18,10 @@ query ($slug: String!) {
|
||||
url
|
||||
}
|
||||
}
|
||||
titles {
|
||||
canonical
|
||||
}
|
||||
type
|
||||
},
|
||||
slug
|
||||
}
|
69
src/AnimeClient/API/Kitsu/Queries/PersonDetails.graphql
Normal file
69
src/AnimeClient/API/Kitsu/Queries/PersonDetails.graphql
Normal file
@ -0,0 +1,69 @@
|
||||
query ($id: ID!) {
|
||||
findPersonById(id: $id) {
|
||||
id
|
||||
birthday
|
||||
image {
|
||||
original {
|
||||
height
|
||||
name
|
||||
url
|
||||
width
|
||||
}
|
||||
views {
|
||||
height
|
||||
name
|
||||
url
|
||||
width
|
||||
}
|
||||
}
|
||||
names {
|
||||
alternatives
|
||||
canonical
|
||||
localized
|
||||
}
|
||||
voices {
|
||||
licensor {
|
||||
name
|
||||
}
|
||||
locale
|
||||
mediaCharacter {
|
||||
role
|
||||
character {
|
||||
id
|
||||
image {
|
||||
original {
|
||||
height
|
||||
name
|
||||
url
|
||||
width
|
||||
}
|
||||
}
|
||||
names {
|
||||
canonical
|
||||
}
|
||||
}
|
||||
media {
|
||||
id
|
||||
posterImage {
|
||||
original {
|
||||
height
|
||||
name
|
||||
url
|
||||
width
|
||||
}
|
||||
views {
|
||||
height
|
||||
name
|
||||
url
|
||||
width
|
||||
}
|
||||
}
|
||||
titles {
|
||||
canonical
|
||||
localized
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user