Version 5.1 - All the GraphQL #32

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

View File

@ -0,0 +1,32 @@
mutation(
$id: ID!,
$notes: String,
$private: Boolean,
$progress: Int,
$ratingTwenty: Int,
$reconsumeCount: Int!,
$reconsuming: Boolean,
$status: LibraryEntryStatus!,
) {
updateLibraryEntry(input: {
id: $id,
notes: $notes
private: $private
progress: $progress
rating: $ratingTwenty
reconsumeCount: $reconsumeCount
reconsuming: $reconsuming
status: $status
}) {
libraryEntry {
id
notes
private
progress
rating
reconsumeCount
reconsuming
status
}
}
}

View File

@ -151,29 +151,16 @@ final class ListItem extends AbstractListItem {
*/ */
public function update(string $id, FormItemData $data): Request public function update(string $id, FormItemData $data): Request
{ {
$authHeader = $this->getAuthHeader(); return $this->requestBuilder->mutateRequest('UpdateLibraryItem', [
$requestData = [
'data' => [
'id' => $id, 'id' => $id,
'type' => 'libraryEntries', 'notes' => $data['notes'],
'attributes' => $data 'private' => (bool)$data['private'],
] 'progress' => (int)$data['progress'],
]; 'ratingTwenty' => (int)$data['ratingTwenty'],
'reconsumeCount' => (int)$data['reconsumeCount'],
if (((int) $data->progress) === 0) 'reconsuming' => (bool)$data['reconsuming'],
{ 'status' => strtoupper($data['status']),
$data->progress = 0; ]);
}
$request = $this->requestBuilder->newRequest('PATCH', "library-entries/{$id}")
->setJsonBody($requestData);
if ($authHeader !== NULL)
{
$request = $request->setHeader('Authorization', $authHeader);
}
return $request->getFullRequest();
} }
/** /**

View File

@ -255,7 +255,7 @@ class Anime extends API {
$results = $requester->makeRequests(); $results = $requester->makeRequests();
$body = Json::decode($results['kitsu']); $body = Json::decode($results['kitsu']);
$statusCode = array_key_exists('error', $body) ? 400: 200; $statusCode = array_key_exists('errors', $body) ? 400: 200;
return [ return [
'body' => Json::decode($results['kitsu']), 'body' => Json::decode($results['kitsu']),

View File

@ -171,7 +171,7 @@ class Manga extends API {
$results = $requester->makeRequests(); $results = $requester->makeRequests();
$body = Json::decode($results['kitsu']); $body = Json::decode($results['kitsu']);
$statusCode = array_key_exists('error', $body) ? 400: 200; $statusCode = array_key_exists('errors', $body) ? 400: 200;
return [ return [
'body' => Json::decode($results['kitsu']), 'body' => Json::decode($results['kitsu']),