| @@ 1264-1301 (lines=38) @@ | ||
| 1261 | * |
|
| 1262 | * @see https://docs.microsoft.com/en-us/rest/api/storageservices/get-directory-properties |
|
| 1263 | */ |
|
| 1264 | public function getDirectoryPropertiesAsync( |
|
| 1265 | $share, |
|
| 1266 | $path, |
|
| 1267 | FileServiceOptions $options = null |
|
| 1268 | ) { |
|
| 1269 | Validate::isString($share, 'share'); |
|
| 1270 | Validate::isString($path, 'path'); |
|
| 1271 | ||
| 1272 | $method = Resources::HTTP_GET; |
|
| 1273 | $headers = array(); |
|
| 1274 | $postParams = array(); |
|
| 1275 | $queryParams = array(Resources::QP_REST_TYPE => 'directory'); |
|
| 1276 | $path = $this->createPath($share, $path); |
|
| 1277 | ||
| 1278 | if (is_null($options)) { |
|
| 1279 | $options = new FileServiceOptions(); |
|
| 1280 | } |
|
| 1281 | ||
| 1282 | $this->addOptionalQueryParam( |
|
| 1283 | $queryParams, |
|
| 1284 | Resources::QP_TIMEOUT, |
|
| 1285 | $options->getTimeout() |
|
| 1286 | ); |
|
| 1287 | ||
| 1288 | return $this->sendAsync( |
|
| 1289 | $method, |
|
| 1290 | $headers, |
|
| 1291 | $queryParams, |
|
| 1292 | $postParams, |
|
| 1293 | $path, |
|
| 1294 | Resources::STATUS_OK, |
|
| 1295 | Resources::EMPTY_STRING, |
|
| 1296 | $options |
|
| 1297 | )->then(function ($response) { |
|
| 1298 | $parsed = HttpFormatter::formatHeaders($response->getHeaders()); |
|
| 1299 | return GetDirectoryPropertiesResult::create($parsed); |
|
| 1300 | }, null); |
|
| 1301 | } |
|
| 1302 | ||
| 1303 | /** |
|
| 1304 | * Gets a directory's metadata from the given share and path. |
|
| @@ 1334-1377 (lines=44) @@ | ||
| 1331 | * |
|
| 1332 | * @see https://docs.microsoft.com/en-us/rest/api/storageservices/get-directory-metadata |
|
| 1333 | */ |
|
| 1334 | public function getDirectoryMetadataAsync( |
|
| 1335 | $share, |
|
| 1336 | $path, |
|
| 1337 | FileServiceOptions $options = null |
|
| 1338 | ) { |
|
| 1339 | Validate::isString($share, 'share'); |
|
| 1340 | Validate::isString($path, 'path'); |
|
| 1341 | ||
| 1342 | $method = Resources::HTTP_GET; |
|
| 1343 | $headers = array(); |
|
| 1344 | $postParams = array(); |
|
| 1345 | $queryParams = array(Resources::QP_REST_TYPE => 'directory'); |
|
| 1346 | $path = $this->createPath($share, $path); |
|
| 1347 | ||
| 1348 | if (is_null($options)) { |
|
| 1349 | $options = new FileServiceOptions(); |
|
| 1350 | } |
|
| 1351 | ||
| 1352 | $this->addOptionalQueryParam( |
|
| 1353 | $queryParams, |
|
| 1354 | Resources::QP_COMP, |
|
| 1355 | 'metadata' |
|
| 1356 | ); |
|
| 1357 | ||
| 1358 | $this->addOptionalQueryParam( |
|
| 1359 | $queryParams, |
|
| 1360 | Resources::QP_TIMEOUT, |
|
| 1361 | $options->getTimeout() |
|
| 1362 | ); |
|
| 1363 | ||
| 1364 | return $this->sendAsync( |
|
| 1365 | $method, |
|
| 1366 | $headers, |
|
| 1367 | $queryParams, |
|
| 1368 | $postParams, |
|
| 1369 | $path, |
|
| 1370 | Resources::STATUS_OK, |
|
| 1371 | Resources::EMPTY_STRING, |
|
| 1372 | $options |
|
| 1373 | )->then(function ($response) { |
|
| 1374 | $parsed = HttpFormatter::formatHeaders($response->getHeaders()); |
|
| 1375 | return GetDirectoryMetadataResult::create($parsed); |
|
| 1376 | }, null); |
|
| 1377 | } |
|
| 1378 | ||
| 1379 | /** |
|
| 1380 | * Sets a directory's metadata from the given share and path. |
|
| @@ 1785-1822 (lines=38) @@ | ||
| 1782 | * |
|
| 1783 | * @see https://docs.microsoft.com/en-us/rest/api/storageservices/get-file-properties |
|
| 1784 | */ |
|
| 1785 | public function getFilePropertiesAsync( |
|
| 1786 | $share, |
|
| 1787 | $path, |
|
| 1788 | FileServiceOptions $options = null |
|
| 1789 | ) { |
|
| 1790 | Validate::isString($share, 'share'); |
|
| 1791 | Validate::isString($path, 'path'); |
|
| 1792 | ||
| 1793 | $method = Resources::HTTP_HEAD; |
|
| 1794 | $headers = array(); |
|
| 1795 | $queryParams = array(); |
|
| 1796 | $postParams = array(); |
|
| 1797 | $path = $this->createPath($share, $path); |
|
| 1798 | ||
| 1799 | if (is_null($options)) { |
|
| 1800 | $options = new FileServiceOptions(); |
|
| 1801 | } |
|
| 1802 | ||
| 1803 | $this->addOptionalQueryParam( |
|
| 1804 | $queryParams, |
|
| 1805 | Resources::QP_TIMEOUT, |
|
| 1806 | $options->getTimeout() |
|
| 1807 | ); |
|
| 1808 | ||
| 1809 | return $this->sendAsync( |
|
| 1810 | $method, |
|
| 1811 | $headers, |
|
| 1812 | $queryParams, |
|
| 1813 | $postParams, |
|
| 1814 | $path, |
|
| 1815 | Resources::STATUS_OK, |
|
| 1816 | Resources::EMPTY_STRING, |
|
| 1817 | $options |
|
| 1818 | )->then(function ($response) { |
|
| 1819 | $parsed = HttpFormatter::formatHeaders($response->getHeaders()); |
|
| 1820 | return FileProperties::createFromHttpHeaders($parsed); |
|
| 1821 | }, null); |
|
| 1822 | } |
|
| 1823 | ||
| 1824 | /** |
|
| 1825 | * Sets properties on the file. |
|
| @@ 1968-2011 (lines=44) @@ | ||
| 1965 | * |
|
| 1966 | * @see https://docs.microsoft.com/en-us/rest/api/storageservices/get-file-metadata |
|
| 1967 | */ |
|
| 1968 | public function getFileMetadataAsync( |
|
| 1969 | $share, |
|
| 1970 | $path, |
|
| 1971 | FileServiceOptions $options = null |
|
| 1972 | ) { |
|
| 1973 | Validate::isString($share, 'share'); |
|
| 1974 | Validate::isString($path, 'path'); |
|
| 1975 | ||
| 1976 | $method = Resources::HTTP_GET; |
|
| 1977 | $headers = array(); |
|
| 1978 | $postParams = array(); |
|
| 1979 | $queryParams = array(); |
|
| 1980 | $path = $this->createPath($share, $path); |
|
| 1981 | ||
| 1982 | if (is_null($options)) { |
|
| 1983 | $options = new FileServiceOptions(); |
|
| 1984 | } |
|
| 1985 | ||
| 1986 | $this->addOptionalQueryParam( |
|
| 1987 | $queryParams, |
|
| 1988 | Resources::QP_COMP, |
|
| 1989 | 'metadata' |
|
| 1990 | ); |
|
| 1991 | ||
| 1992 | $this->addOptionalQueryParam( |
|
| 1993 | $queryParams, |
|
| 1994 | Resources::QP_TIMEOUT, |
|
| 1995 | $options->getTimeout() |
|
| 1996 | ); |
|
| 1997 | ||
| 1998 | return $this->sendAsync( |
|
| 1999 | $method, |
|
| 2000 | $headers, |
|
| 2001 | $queryParams, |
|
| 2002 | $postParams, |
|
| 2003 | $path, |
|
| 2004 | Resources::STATUS_OK, |
|
| 2005 | Resources::EMPTY_STRING, |
|
| 2006 | $options |
|
| 2007 | )->then(function ($response) { |
|
| 2008 | $parsed = HttpFormatter::formatHeaders($response->getHeaders()); |
|
| 2009 | return GetFileMetadataResult::create($parsed); |
|
| 2010 | }, null); |
|
| 2011 | } |
|
| 2012 | ||
| 2013 | /** |
|
| 2014 | * Sets a file's metadata from the given share and path. |
|
| @@ 898-940 (lines=43) @@ | ||
| 895 | * |
|
| 896 | * @return \GuzzleHttp\Promise\PromiseInterface |
|
| 897 | */ |
|
| 898 | public function getTableAsync( |
|
| 899 | $table, |
|
| 900 | GetTableOptions $options = null |
|
| 901 | ) { |
|
| 902 | Validate::isString($table, 'table'); |
|
| 903 | Validate::notNullOrEmpty($table, 'table'); |
|
| 904 | ||
| 905 | $method = Resources::HTTP_GET; |
|
| 906 | $headers = array(); |
|
| 907 | $postParams = array(); |
|
| 908 | $queryParams = array(); |
|
| 909 | $path = "Tables('$table')"; |
|
| 910 | ||
| 911 | if (is_null($options)) { |
|
| 912 | $options = new GetTableOptions(); |
|
| 913 | } |
|
| 914 | ||
| 915 | $this->addOptionalHeader( |
|
| 916 | $headers, |
|
| 917 | Resources::CONTENT_TYPE, |
|
| 918 | Resources::JSON_CONTENT_TYPE |
|
| 919 | ); |
|
| 920 | $this->addOptionalHeader( |
|
| 921 | $headers, |
|
| 922 | Resources::ACCEPT_HEADER, |
|
| 923 | $options->getAccept() |
|
| 924 | ); |
|
| 925 | ||
| 926 | $odataSerializer = $this->odataSerializer; |
|
| 927 | ||
| 928 | return $this->sendAsync( |
|
| 929 | $method, |
|
| 930 | $headers, |
|
| 931 | $queryParams, |
|
| 932 | $postParams, |
|
| 933 | $path, |
|
| 934 | Resources::STATUS_OK, |
|
| 935 | Resources::EMPTY_STRING, |
|
| 936 | $options |
|
| 937 | )->then(function ($response) use ($odataSerializer) { |
|
| 938 | return GetTableResult::create($response->getBody(), $odataSerializer); |
|
| 939 | }, null); |
|
| 940 | } |
|
| 941 | ||
| 942 | /** |
|
| 943 | * Deletes the specified table and any data it contains. |
|