fixed some more bugs

This commit is contained in:
ION606
2025-10-11 11:29:11 -04:00
parent b915ae88a4
commit 2659c51b02
6 changed files with 298 additions and 81 deletions
+91 -30
View File
@@ -141,34 +141,29 @@
},
"put": {
"operationId": "nextcloudUploadFile",
"summary": "Upload a file",
"description": "uploads a file into a target directory in nextcloud via webdav. requires a multipart/form-data body with the file part and the destination directory. the server will not overwrite existing files.",
"summary": "Upload a file (application/json, base64-encoded)",
"description": "Uploads a file into a target directory in nextcloud via webdav. the server will not overwrite existing files. the body must be application/json and include `fdir` and `file.buffer` (base64).",
"requestBody": {
"required": true,
"content": {
"multipart/form-data": {
"application/json": {
"schema": {
"type": "object",
"properties": {
"fdir": {
"type": "string",
"description": "destination directory path (e.g., /Documents)"
},
"createnewdirs": {
"type": "boolean",
"default": false,
"description": "if true and the directory does not exist, create it recursively before uploading"
},
"file": {
"type": "string",
"format": "binary",
"description": "the file contents"
"$ref": "#/components/schemas/NewFileMeta"
},
"examples": {
"json-base64": {
"value": {
"fdir": "/Documents",
"createnewdirs": false,
"file": {
"filename": "file",
"originalname": "photo.jpg",
"mimetype": "image/jpeg",
"size": 52345,
"buffer": "/9j/4AAQSkZJRgABAQAAAQABAAD... (truncated base64)"
}
}
},
"required": [
"fdir",
"file"
]
}
}
}
}
@@ -204,7 +199,7 @@
}
},
"400": {
"description": "missing file upload field",
"description": "missing file upload field or invalid base64",
"content": {
"application/json": {
"schema": {
@@ -216,7 +211,7 @@
},
"error": {
"type": "string",
"example": "missing file"
"example": "missing file or invalid buffer"
}
}
}
@@ -268,7 +263,7 @@
"post": {
"operationId": "nextcloudListDirectory",
"summary": "List a directory",
"description": "lists directory entries from nextcloud webdav. supports shallow or deep listing.",
"description": "Lists directory entries from nextcloud webdav. Supports shallow or deep listing.",
"requestBody": {
"required": true,
"content": {
@@ -284,6 +279,16 @@
"type": "boolean",
"default": false,
"description": "whether to recurse into subdirectories"
},
"startInd": {
"type": "number",
"default": 0,
"description": "start listing from this index (for pagination)"
},
"limit": {
"type": "number",
"default": 250,
"description": "maximum number of entries to return"
}
},
"required": [
@@ -331,7 +336,7 @@
"get": {
"operationId": "nextcloudGetOpenapi",
"summary": "Serve OpenAPI schema",
"description": "serves this specification (used by open webui when registering a tool server).",
"description": "Serves this specification (used by open webui when registering a tool server).",
"responses": {
"200": {
"description": "openapi document",
@@ -352,7 +357,7 @@
"schemas": {
"DirEntry": {
"type": "object",
"description": "entry returned by webdav client",
"description": "Entry returned by webdav client",
"properties": {
"filename": {
"type": "string",
@@ -395,7 +400,7 @@
},
"FileMeta": {
"type": "object",
"description": "metadata about a file (json-friendly alternative to raw bytes)",
"description": "Metadata about a file (json-friendly alternative to raw bytes)",
"properties": {
"filename": {
"type": "string"
@@ -438,6 +443,62 @@
"basename",
"type"
]
},
"NewFileMeta": {
"type": "object",
"properties": {
"fdir": {
"type": "string",
"description": "destination directory path (e.g., /Documents)"
},
"createnewdirs": {
"type": "boolean",
"default": false,
"description": "if true and the directory does not exist, create it recursively before uploading"
},
"file": {
"type": "object",
"description": "uploaded file metadata + contents (base64 if image or misc formats otherwise)",
"properties": {
"filename": {
"type": "string",
"description": "name of the form field associated with this file or client-side identifier"
},
"originalname": {
"type": "string",
"default": "",
"description": "name of the file on the uploader's computer"
},
"mimetype": {
"type": "string",
"default": "text/plain",
"description": "value of the Content-Type for this file, e.g. image/jpeg"
},
"size": {
"type": "integer",
"format": "int64",
"default": 0,
"description": "size of the file in bytes"
},
"buffer": {
"type": "string",
"format": "byte",
"contentEncoding": "any",
"contentMediaType": "application/octet-stream",
"description": "the contents of the file"
}
},
"required": [
"filename",
"mimetype",
"buffer"
]
}
},
"required": [
"fdir",
"file"
]
}
},
"responses": {
@@ -500,4 +561,4 @@
}
}
}
}
}