| @@ 352-378 (lines=27) @@ | ||
| 349 | * |
|
| 350 | * @return Slice |
|
| 351 | */ |
|
| 352 | public function update(string $user, string $name, Slice $options = null): Slice |
|
| 353 | { |
|
| 354 | if (!$options) |
|
| 355 | { |
|
| 356 | $options = $this->fake(); |
|
| 357 | } |
|
| 358 | ||
| 359 | $token = $this->getToken( |
|
| 360 | $user, |
|
| 361 | $options->getData('scope', '') |
|
| 362 | ); |
|
| 363 | ||
| 364 | $options->allow404 = true; |
|
| 365 | ||
| 366 | $urlUpload = $this->slice->getRequired('app.url.upload'); |
|
| 367 | $options->url = Path::slash($urlUpload) . $name; |
|
| 368 | ||
| 369 | return $this->apiSend( |
|
| 370 | $this->uploadSlice($token, $options), |
|
| 371 | function () use ($user, $options) { |
|
| 372 | return $this->uploadSlice( |
|
| 373 | $this->tokenUpdate($user, $options), |
|
| 374 | $options |
|
| 375 | ); |
|
| 376 | } |
|
| 377 | ); |
|
| 378 | } |
|
| 379 | ||
| 380 | /** |
|
| 381 | * @param string $user |
|
| @@ 387-415 (lines=29) @@ | ||
| 384 | * |
|
| 385 | * @return Slice|null |
|
| 386 | */ |
|
| 387 | public function delete(string $user, string $name, Slice $options = null) |
|
| 388 | { |
|
| 389 | if (!$options) |
|
| 390 | { |
|
| 391 | $options = $this->fake(); |
|
| 392 | } |
|
| 393 | ||
| 394 | $token = $this->getToken( |
|
| 395 | $user, |
|
| 396 | $options->getData('scope', '') |
|
| 397 | ); |
|
| 398 | ||
| 399 | $options->allow404 = true; |
|
| 400 | ||
| 401 | $urlUpload = $this->slice->getRequired('app.url.upload'); |
|
| 402 | $options->url = Path::slash($urlUpload) . $name; |
|
| 403 | ||
| 404 | $options->method = 'delete'; |
|
| 405 | ||
| 406 | return $this->apiSend( |
|
| 407 | $this->uploadSlice($token, $options), |
|
| 408 | function () use ($user, $options) { |
|
| 409 | return $this->uploadSlice( |
|
| 410 | $this->tokenUpdate($user, $options), |
|
| 411 | $options |
|
| 412 | ); |
|
| 413 | } |
|
| 414 | ); |
|
| 415 | } |
|
| 416 | ||
| 417 | /** |
|
| 418 | * @param Slice $slice |
|