]> source.dussan.org Git - nextcloud-server.git/commitdiff
docs(preview): Improve API parameter descriptions 45288/head
authorprovokateurin <kate@provokateurin.de>
Mon, 13 May 2024 10:47:24 +0000 (12:47 +0200)
committerprovokateurin <kate@provokateurin.de>
Mon, 13 May 2024 10:47:24 +0000 (12:47 +0200)
Signed-off-by: provokateurin <kate@provokateurin.de>
core/Controller/PreviewController.php
core/openapi.json

index 7ab22dceaa2a482ddabe879981d4ec900565bfc1..301bc13438146b0f6ec39bca693685537dbdd0e1 100644 (file)
@@ -61,11 +61,11 @@ class PreviewController extends Controller {
         * Get a preview by file path
         *
         * @param string $file Path of the file
-        * @param int $x Width of the preview
-        * @param int $y Height of the preview
-        * @param bool $a Whether to not crop the preview
+        * @param int $x Width of the preview. A width of -1 will use the original image width.
+        * @param int $y Height of the preview. A height of -1 will use the original image height.
+        * @param bool $a Preserve the aspect ratio
         * @param bool $forceIcon Force returning an icon
-        * @param string $mode How to crop the image
+        * @param 'fill'|'cover' $mode How to crop the image
         * @param bool $mimeFallback Whether to fallback to the mime icon if no preview is available
         * @return FileDisplayResponse<Http::STATUS_OK, array{Content-Type: string}>|DataResponse<Http::STATUS_BAD_REQUEST|Http::STATUS_FORBIDDEN|Http::STATUS_NOT_FOUND, array<empty>, array{}>|RedirectResponse<Http::STATUS_SEE_OTHER, array{}>
         *
@@ -105,11 +105,11 @@ class PreviewController extends Controller {
         * Get a preview by file ID
         *
         * @param int $fileId ID of the file
-        * @param int $x Width of the preview
-        * @param int $y Height of the preview
-        * @param bool $a Whether to not crop the preview
+        * @param int $x Width of the preview. A width of -1 will use the original image width.
+        * @param int $y Height of the preview. A height of -1 will use the original image height.
+        * @param bool $a Preserve the aspect ratio
         * @param bool $forceIcon Force returning an icon
-        * @param string $mode How to crop the image
+        * @param 'fill'|'cover' $mode How to crop the image
         * @param bool $mimeFallback Whether to fallback to the mime icon if no preview is available
         * @return FileDisplayResponse<Http::STATUS_OK, array{Content-Type: string}>|DataResponse<Http::STATUS_BAD_REQUEST|Http::STATUS_FORBIDDEN|Http::STATUS_NOT_FOUND, array<empty>, array{}>|RedirectResponse<Http::STATUS_SEE_OTHER, array{}>
         *
index 37c32cb74042b6c4f7b5dd575c08cf01dfc93db9..1c7b2caeeac420f7de543bec964d77cba2fdc618 100644 (file)
                     {
                         "name": "x",
                         "in": "query",
-                        "description": "Width of the preview",
+                        "description": "Width of the preview. A width of -1 will use the original image width.",
                         "schema": {
                             "type": "integer",
                             "format": "int64",
                     {
                         "name": "y",
                         "in": "query",
-                        "description": "Height of the preview",
+                        "description": "Height of the preview. A height of -1 will use the original image height.",
                         "schema": {
                             "type": "integer",
                             "format": "int64",
                     {
                         "name": "a",
                         "in": "query",
-                        "description": "Whether to not crop the preview",
+                        "description": "Preserve the aspect ratio",
                         "schema": {
                             "type": "integer",
                             "default": 0,
                         "description": "How to crop the image",
                         "schema": {
                             "type": "string",
-                            "default": "fill"
+                            "default": "fill",
+                            "enum": [
+                                "fill",
+                                "cover"
+                            ]
                         }
                     },
                     {
                     {
                         "name": "x",
                         "in": "query",
-                        "description": "Width of the preview",
+                        "description": "Width of the preview. A width of -1 will use the original image width.",
                         "schema": {
                             "type": "integer",
                             "format": "int64",
                     {
                         "name": "y",
                         "in": "query",
-                        "description": "Height of the preview",
+                        "description": "Height of the preview. A height of -1 will use the original image height.",
                         "schema": {
                             "type": "integer",
                             "format": "int64",
                     {
                         "name": "a",
                         "in": "query",
-                        "description": "Whether to not crop the preview",
+                        "description": "Preserve the aspect ratio",
                         "schema": {
                             "type": "integer",
                             "default": 0,
                         "description": "How to crop the image",
                         "schema": {
                             "type": "string",
-                            "default": "fill"
+                            "default": "fill",
+                            "enum": [
+                                "fill",
+                                "cover"
+                            ]
                         }
                     },
                     {