| @@ 193-208 (lines=16) @@ | ||
| 190 | * @param array $ids |
|
| 191 | * @return bool |
|
| 192 | */ |
|
| 193 | public function setImages($id, array $ids) |
|
| 194 | { |
|
| 195 | if (empty($ids)) { |
|
| 196 | throw new \InvalidArgumentException('Images ids must be not empty array'); |
|
| 197 | } |
|
| 198 | ||
| 199 | $postData = []; |
|
| 200 | $postData['ids'] = implode(',', $ids); |
|
| 201 | ||
| 202 | $response = $this->httpClient->post( |
|
| 203 | 'album/' . $id, |
|
| 204 | $postData |
|
| 205 | ); |
|
| 206 | ||
| 207 | return $response->getBody()['success']; |
|
| 208 | } |
|
| 209 | ||
| 210 | /** |
|
| 211 | * Adds images to an album |
|
| @@ 217-232 (lines=16) @@ | ||
| 214 | * @param array $ids |
|
| 215 | * @return bool |
|
| 216 | */ |
|
| 217 | public function addImages($id, array $ids) |
|
| 218 | { |
|
| 219 | if (empty($ids)) { |
|
| 220 | throw new \InvalidArgumentException('Images ids must be not empty array'); |
|
| 221 | } |
|
| 222 | ||
| 223 | $postData = []; |
|
| 224 | $postData['ids'] = implode(',', $ids); |
|
| 225 | ||
| 226 | $response = $this->httpClient->post( |
|
| 227 | 'album/' . $id . '/add', |
|
| 228 | $postData |
|
| 229 | ); |
|
| 230 | ||
| 231 | return $response->getBody()['success']; |
|
| 232 | } |
|
| 233 | ||
| 234 | /** |
|
| 235 | * Removes images from an album |
|
| @@ 241-256 (lines=16) @@ | ||
| 238 | * @param array $ids |
|
| 239 | * @return bool |
|
| 240 | */ |
|
| 241 | public function removeImages($id, array $ids) |
|
| 242 | { |
|
| 243 | if (empty($ids)) { |
|
| 244 | throw new \InvalidArgumentException('Images ids must be not empty array'); |
|
| 245 | } |
|
| 246 | ||
| 247 | $postData = []; |
|
| 248 | $postData['ids'] = implode(',', $ids); |
|
| 249 | ||
| 250 | $response = $this->httpClient->delete( |
|
| 251 | 'album/' . $id . '/remove_images', |
|
| 252 | $postData |
|
| 253 | ); |
|
| 254 | ||
| 255 | return $response->getBody()['success']; |
|
| 256 | } |
|
| 257 | } |
|