@@ 56-75 (lines=20) @@ | ||
53 | * @param array $data |
|
54 | * @return array|false |
|
55 | */ |
|
56 | public function update($data) |
|
57 | { |
|
58 | $auth = $this->container->get('auth'); |
|
59 | if ( ! $auth->is_authenticated() || ! array_key_exists('id', $data)) |
|
60 | { |
|
61 | return FALSE; |
|
62 | } |
|
63 | ||
64 | $id = $data['id']; |
|
65 | $data['auth_token'] = $auth->get_auth_token(); |
|
66 | ||
67 | $response = $this->client->post("libraries/{$id}", [ |
|
68 | 'form_params' => $data |
|
69 | ]); |
|
70 | ||
71 | return [ |
|
72 | 'statusCode' => $response->getStatusCode(), |
|
73 | 'body' => Json::decode($response->getBody(), TRUE) |
|
74 | ]; |
|
75 | } |
|
76 | ||
77 | /** |
|
78 | * Remove an anime from a list |
|
@@ 83-102 (lines=20) @@ | ||
80 | * @param array $data |
|
81 | * @return array |
|
82 | */ |
|
83 | public function delete($data) |
|
84 | { |
|
85 | $auth = $this->container->get('auth'); |
|
86 | if ( ! $auth->is_authenticated() || ! array_key_exists('id', $data)) |
|
87 | { |
|
88 | return FALSE; |
|
89 | } |
|
90 | ||
91 | $id = $data['id']; |
|
92 | $data['auth_token'] = $auth->get_auth_token(); |
|
93 | ||
94 | $response = $this->client->post("libraries/{$id}/remove", [ |
|
95 | 'form_params' => $data |
|
96 | ]); |
|
97 | ||
98 | return [ |
|
99 | 'statusCode' => $response->getStatusCode(), |
|
100 | 'body' => Json::decode($response->getBody(), TRUE) |
|
101 | ]; |
|
102 | } |
|
103 | ||
104 | /** |
|
105 | * Get the full set of anime lists |