All in GraphQL #34

Merged
timw4mail merged 87 commits from develop into master 2020-12-01 10:07:49 -05:00
3 changed files with 102 additions and 16 deletions
Showing only changes of commit 980e2726c5 - Show all commits

View File

@ -390,27 +390,18 @@ final class Model {
private function getListCount(string $type, string $status = ''): int
{
$options = [
'query' => [
'filter' => [
'user_id' => $this->getUserId(),
'kind' => $type,
],
'page' => [
'limit' => 1
],
'sort' => '-updated_at'
]
$args = [
'type' => strtoupper($type),
'slug' => $this->getUsername()
];
if ( ! empty($status))
if ($status !== '')
{
$options['query']['filter']['status'] = $status;
$args['status'] = strtoupper($status);
}
$response = $this->requestBuilder->getRequest('library-entries', $options);
$res = $this->requestBuilder->runQuery('GetLibraryCount', $args);
return $response['meta']['count'];
return $res['data']['findProfileBySlug']['library']['all']['totalCount'];
}
/**

View File

@ -0,0 +1,86 @@
query ($slug: String!, $type: media_type!, $status: [LibraryEntryStatus!]) {
findProfileBySlug(slug: $slug) {
library {
all(mediaType: $type, status: $status) {
# pageInfo {
# endCursor
# hasNextPage
# hasPreviousPage
# startCursor
# }
totalCount
nodes {
id
notes
nsfw
private
progress
progressedAt
rating
reconsumeCount
reconsuming
status
media {
id
ageRating
ageRatingGuide
categories {
nodes {
title
}
}
mappings {
nodes {
externalId
externalSite
}
}
posterImage {
original {
height
name
url
width
}
views {
height
name
url
width
}
}
sfw
slug
status
type
titles {
canonical
localized
alternatives
}
...on Anime {
episodeCount
streamingLinks {
nodes {
dubs
subs
regions
streamer {
id
siteName
}
url
}
}
subtype
}
...on Manga {
chapterCount
subtype
}
}
}
}
}
}
}

View File

@ -0,0 +1,9 @@
query ($slug: String!, $type: media_type!, $status: [LibraryEntryStatus!]) {
findProfileBySlug(slug: $slug) {
library {
all(mediaType: $type, status: $status) {
totalCount
}
}
}
}