| @@ 345-361 (lines=17) @@ | ||
| 342 | * @link https://www.dropbox.com/developers/documentation/http/documentation#files-list_folder |
|
| 343 | * |
|
| 344 | */ |
|
| 345 | public function listFolder($path = null, array $params = []) |
|
| 346 | { |
|
| 347 | //Specify the root folder as an |
|
| 348 | //empty string rather than as "/" |
|
| 349 | if ($path === '/') { |
|
| 350 | $path = ""; |
|
| 351 | } |
|
| 352 | ||
| 353 | //Set the path |
|
| 354 | $params['path'] = $path; |
|
| 355 | ||
| 356 | //Get File Metadata |
|
| 357 | $response = $this->postToAPI('/files/list_folder', $params); |
|
| 358 | ||
| 359 | //Make and Return the Model |
|
| 360 | return $this->makeModelFromResponse($response); |
|
| 361 | } |
|
| 362 | ||
| 363 | /** |
|
| 364 | * Paginate through all files and retrieve updates to the folder, |
|
| @@ 468-485 (lines=18) @@ | ||
| 465 | * @link https://www.dropbox.com/developers/documentation/http/documentation#files-search |
|
| 466 | * |
|
| 467 | */ |
|
| 468 | public function search($path, $query, array $params = []) |
|
| 469 | { |
|
| 470 | //Specify the root folder as an |
|
| 471 | //empty string rather than as "/" |
|
| 472 | if ($path === '/') { |
|
| 473 | $path = ""; |
|
| 474 | } |
|
| 475 | ||
| 476 | //Set the path and query |
|
| 477 | $params['path'] = $path; |
|
| 478 | $params['query'] = $query; |
|
| 479 | ||
| 480 | //Fetch Search Results |
|
| 481 | $response = $this->postToAPI('/files/search', $params); |
|
| 482 | ||
| 483 | //Make and Return the Model |
|
| 484 | return $this->makeModelFromResponse($response); |
|
| 485 | } |
|
| 486 | ||
| 487 | /** |
|
| 488 | * Search a folder for files/folders |
|
| @@ 498-518 (lines=21) @@ | ||
| 495 | * |
|
| 496 | * @return \Kunnu\Dropbox\Models\SearchResults |
|
| 497 | */ |
|
| 498 | public function searchV2($query, array $params = []) |
|
| 499 | { |
|
| 500 | //Specify the root folder as an |
|
| 501 | //empty string rather than as "/" |
|
| 502 | if ($path === '/') { |
|
| 503 | $path = ""; |
|
| 504 | } |
|
| 505 | ||
| 506 | //Set the path and query |
|
| 507 | $params['query'] = $query; |
|
| 508 | ||
| 509 | if( !array_key_exists( 'include_highlights', $params ) ){ |
|
| 510 | $params['include_highlights'] = false; |
|
| 511 | } |
|
| 512 | ||
| 513 | //Fetch Search Results |
|
| 514 | $response = $this->postToAPI('/files/search_v2', $params); |
|
| 515 | ||
| 516 | //Make and Return the Model |
|
| 517 | return $this->makeModelFromResponse($response); |
|
| 518 | } |
|
| 519 | ||
| 520 | /** |
|
| 521 | * Create a folder at the given path |
|