All in GraphQL #34
@ -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
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -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 = [
|
'id' => $id,
|
||||||
'data' => [
|
'notes' => $data['notes'],
|
||||||
'id' => $id,
|
'private' => (bool)$data['private'],
|
||||||
'type' => 'libraryEntries',
|
'progress' => (int)$data['progress'],
|
||||||
'attributes' => $data
|
'ratingTwenty' => (int)$data['ratingTwenty'],
|
||||||
]
|
'reconsumeCount' => (int)$data['reconsumeCount'],
|
||||||
];
|
'reconsuming' => (bool)$data['reconsuming'],
|
||||||
|
'status' => strtoupper($data['status']),
|
||||||
if (((int) $data->progress) === 0)
|
]);
|
||||||
{
|
|
||||||
$data->progress = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
$request = $this->requestBuilder->newRequest('PATCH', "library-entries/{$id}")
|
|
||||||
->setJsonBody($requestData);
|
|
||||||
|
|
||||||
if ($authHeader !== NULL)
|
|
||||||
{
|
|
||||||
$request = $request->setHeader('Authorization', $authHeader);
|
|
||||||
}
|
|
||||||
|
|
||||||
return $request->getFullRequest();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -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']),
|
||||||
|
@ -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']),
|
||||||
|
Loading…
Reference in New Issue
Block a user