Version 5.1 - All the GraphQL #32

Closed
timw4mail wants to merge 1160 commits from develop into master
6 changed files with 74 additions and 25 deletions
Showing only changes of commit f328420869 - Show all commits

View File

@ -43,6 +43,16 @@ final class ListItem extends AbstractListItem {
* @throws Throwable
*/
public function create(array $data): Request
{
return $this->requestBuilder->mutateRequest('CreateLibraryItem', [
'id' => $data['id'],
'status' => strtoupper($data['status']),
'type' => strtoupper($data['type']),
'userId' => $data['user_id'],
]);
}
public function createFull(array $data): Request
{
$body = [
'data' => [
@ -93,15 +103,9 @@ final class ListItem extends AbstractListItem {
*/
public function delete(string $id): Request
{
$authHeader = $this->getAuthHeader();
$request = $this->requestBuilder->newRequest('DELETE', "library-entries/{$id}");
if ($authHeader !== NULL)
{
$request = $request->setHeader('Authorization', $authHeader);
}
return $request->getFullRequest();
return $this->requestBuilder->mutateRequest('DeleteLibraryItem', [
'id' => $id
]);
}
/**

View File

@ -0,0 +1,19 @@
# Create full library item
# Flesh out a library item with data - most commonly used for syncing lists
# between APIs
mutation (
$userId: ID!
$id: ID!,
$mediaType: media_type!,
$status: MediaListStatus,
) {
createLibraryEntry (input: {
userId: $userId
mediaId: $id
mediaType: $mediaType
status: $status
}) {
mediaId
status
}
}

View File

@ -0,0 +1,27 @@
# Create minimal library item
# This is the more common use case, when adding an anime or manga to
# the user's library.
mutation (
$userId: ID!
$id: ID!,
$type: media_type!,
$status: LibraryEntryStatus!,
) {
createLibraryEntry (input: {
userId: $userId
mediaId: $id
mediaType: $type
status: $status
}) {
libraryEntry {
id
media {
type
}
user {
id
}
status
}
}
}

View File

@ -0,0 +1,7 @@
mutation ($id: ID!) {
deleteLibraryEntry(input: {id: $id}) {
libraryEntry {
id
}
}
}

View File

@ -27,8 +27,9 @@ query ($slug: String!) {
character {
id
names {
canonical
alternatives
canonical
localized
}
image {
original {
@ -96,7 +97,9 @@ query ($slug: String!) {
subtype
synopsis
titles {
alternatives
canonical
canonicalLocale
localized
}
totalLength

View File

@ -27,8 +27,9 @@ query ($id: ID!) {
character {
id
names {
canonical
alternatives
canonical
localized
}
image {
original {
@ -54,20 +55,6 @@ query ($id: ID!) {
episodeCount
episodeLength
totalLength
posterImage {
original {
height
name
url
width
}
views {
height
name
url
width
}
}
season
sfw
slug
@ -110,7 +97,9 @@ query ($id: ID!) {
subtype
synopsis
titles {
alternatives
canonical
canonicalLocale
localized
}
totalLength