aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files/lib/Controller/ApiController.php
diff options
context:
space:
mode:
Diffstat (limited to 'apps/files/lib/Controller/ApiController.php')
-rw-r--r--apps/files/lib/Controller/ApiController.php14
1 files changed, 14 insertions, 0 deletions
diff --git a/apps/files/lib/Controller/ApiController.php b/apps/files/lib/Controller/ApiController.php
index f2329fc384b..604cf9a3c64 100644
--- a/apps/files/lib/Controller/ApiController.php
+++ b/apps/files/lib/Controller/ApiController.php
@@ -257,6 +257,20 @@ class ApiController extends Controller {
return new DataResponse(['files' => $files]);
}
+
+ /**
+ * Returns the current logged-in user's storage stats.
+ *
+ * @NoAdminRequired
+ *
+ * @param ?string $dir the directory to get the storage stats from
+ * @return JSONResponse
+ */
+ public function getStorageStats($dir = '/'): JSONResponse {
+ $storageInfo = \OC_Helper::getStorageInfo($dir ?: '/');
+ return new JSONResponse(['message' => 'ok', 'data' => $storageInfo]);
+ }
+
/**
* Change the default sort mode
*