| @@ 327-343 (lines=17) @@ | ||
| 324 | * |
|
| 325 | * @return \Dropbox\Models\MetadataCollection |
|
| 326 | */ |
|
| 327 | public function listFolder(string $path = '', array $params = []) |
|
| 328 | { |
|
| 329 | //Specify the root folder as an |
|
| 330 | //empty string rather than as "/" |
|
| 331 | if ($path === '/') { |
|
| 332 | $path = ""; |
|
| 333 | } |
|
| 334 | ||
| 335 | //Set the path |
|
| 336 | $params['path'] = $path; |
|
| 337 | ||
| 338 | //Get File Metadata |
|
| 339 | $response = $this->postToAPI('/files/list_folder', $params); |
|
| 340 | ||
| 341 | //Make and Return the Model |
|
| 342 | return $this->makeModelFromResponse($response); |
|
| 343 | } |
|
| 344 | ||
| 345 | /** |
|
| 346 | * Paginate through all files and retrieve updates to the folder, |
|
| @@ 450-467 (lines=18) @@ | ||
| 447 | * |
|
| 448 | * @return \Dropbox\Models\SearchResults |
|
| 449 | */ |
|
| 450 | public function search(string $path = '', $query, array $params = []) |
|
| 451 | { |
|
| 452 | //Specify the root folder as an |
|
| 453 | //empty string rather than as "/" |
|
| 454 | if ($path === '/') { |
|
| 455 | $path = ""; |
|
| 456 | } |
|
| 457 | ||
| 458 | //Set the path and query |
|
| 459 | $params['path'] = $path; |
|
| 460 | $params['query'] = $query; |
|
| 461 | ||
| 462 | //Fetch Search Results |
|
| 463 | $response = $this->postToAPI('/files/search', $params); |
|
| 464 | ||
| 465 | //Make and Return the Model |
|
| 466 | return $this->makeModelFromResponse($response); |
|
| 467 | } |
|
| 468 | ||
| 469 | /** |
|
| 470 | * Create a folder at the given path |
|
| @@ 212-227 (lines=16) @@ | ||
| 209 | * @link https://www.dropbox.com/developers/documentation/http/documentation#files-get_metadata |
|
| 210 | * |
|
| 211 | */ |
|
| 212 | public function getMetadata(string $path = '', array $params = []) |
|
| 213 | { |
|
| 214 | //Root folder is unsupported |
|
| 215 | if ('/' === $path || '' === $path) { |
|
| 216 | throw new DropboxClientException("Metadata for the root folder is unsupported."); |
|
| 217 | } |
|
| 218 | ||
| 219 | //Set the path |
|
| 220 | $params['path'] = $path; |
|
| 221 | ||
| 222 | //Get File Metadata |
|
| 223 | $response = $this->postToAPI('/files/get_metadata', $params); |
|
| 224 | ||
| 225 | //Make and Return the Model |
|
| 226 | return $this->makeModelFromResponse($response); |
|
| 227 | } |
|
| 228 | ||
| 229 | /** |
|
| 230 | * Make a HTTP POST Request to the API endpoint type |
|