{
    "openapi": "3.0.0",
    "info": {
        "title": "Simple HTTP Server API overview",
        "version": "1.0.0"
    },
    "paths": {
        "/api/file/list": {
            "get": {
                "summary": "List folder contents",
                "parameters": [
                    {
                        "name": "path",
                        "in": "query",
                        "description": "Path to the folder to list",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "sort",
                        "in": "query",
                        "description": "Sort files and folders by",
                        "required": false,
                        "schema": {
                            "type": "string",
                            "enum": [
                                "modified",
                                "size",
                                "name",
                                "gallery"
                            ],
                            "default": "name"
                        }
                    },
                    {
                        "name": "sort-reversed",
                        "in": "query",
                        "description": "List files and folders recursively",
                        "required": false,
                        "schema": {
                            "type": "boolean",
                            "default": false
                        }
                    },
                    {
                        "name": "search",
                        "in": "query",
                        "description": "Search for files and folders by pattern. Windows Explorer-style wildcards are supported. (Added since shttps v2.4.0)",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "List of files and folders in the requested folder",
                        "content": {
                            "application/json": {
                                "examples": {
                                    "Folder content response": {
                                        "value": [
                                            {
                                                "name": "test",
                                                "length": "0 B",
                                                "modified": 1724499979721,
                                                "directory": true
                                            },
                                            {
                                                "name": "index.html",
                                                "length": "6.3 KB",
                                                "modified": 1724183230522,
                                                "directory": false
                                            },
                                            {
                                                "name": "main.js",
                                                "length": "897.0 B",
                                                "modified": 1724181745625,
                                                "directory": false
                                            }
                                        ]
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Requested folder not found",
                        "content": {
                            "text/plain": {
                                "examples": {
                                    "Not found": {
                                        "value": "Not found"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/file/upload": {
            "put": {
                "summary": "Upload file",
                "parameters": [
                    {
                        "name": "path",
                        "in": "query",
                        "description": "Path to the folder where to upload the file[s]",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "requestBody": {
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "files[]": {
                                        "type": "array",
                                        "items": {
                                            "type": "string",
                                            "format": "binary"
                                        },
                                        "description": "Array of files to upload (represented by relative paths to the \"path\" query parameter)"
                                    },
                                    "emptyDirs[]": {
                                        "type": "array",
                                        "items": {
                                            "type": "string"
                                        }
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "204": {
                        "description": "File uploaded successfully",
                        "content": {
                            "text/plain": {
                                "examples": {
                                    "File uploaded": {
                                        "value": "No Content"
                                    }
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Bad Request"
                    },
                    "403": {
                        "description": "Editing not allowed"
                    }
                }
            }
        },
        "/api/file/download": {
            "get": {
                "summary": "Download file",
                "parameters": [
                    {
                        "name": "path",
                        "in": "query",
                        "description": "Path to the file to download",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "File content",
                        "content": {
                            "application/octet-stream": {
                                "examples": {
                                    "File content": {
                                        "value": "Hello, world!"
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Requested file not found",
                        "content": {
                            "text/plain": {
                                "examples": {
                                    "Not found": {
                                        "value": "Not found"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/file/delete": {
            "delete": {
                "summary": "Delete file or folder",
                "requestBody": {
                    "description": "Describe root folder and child files and folders to delete",
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "path": {
                                        "type": "string"
                                    },
                                    "files": {
                                        "type": "array",
                                        "items": {
                                            "type": "string"
                                        }
                                    }
                                }
                            },
                            "examples": {
                                "Request to delete two files indide \"/test\" folder": {
                                    "value": {
                                        "path": "/test",
                                        "files": [
                                            "index.html",
                                            "main.js"
                                        ]
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "204": {
                        "description": "File or folder deleted successfully",
                        "content": {
                            "text/plain": {
                                "examples": {
                                    "File or folder deleted": {
                                        "value": "No Content"
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Requested file or folder not found",
                        "content": {
                            "text/plain": {
                                "examples": {
                                    "Not found": {
                                        "value": "Not found"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/file/rename": {
            "post": {
                "summary": "Rename file or folder",
                "requestBody": {
                    "description": "Describe old file name (with path) and new file name (without path)",
                    "required": true,
                    "content": {
                        "application/x-www-form-urlencoded": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "path": {
                                        "type": "string"
                                    },
                                    "name": {
                                        "type": "string"
                                    }
                                }
                            },
                            "examples": {
                                "Request to rename file \"/test/index.html\" to \"index2.html\"": {
                                    "value": {
                                        "path": "/test/index.html",
                                        "name": "index2.html"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "204": {
                        "description": "File or folder renamed successfully",
                        "content": {
                            "text/plain": {
                                "examples": {
                                    "File or folder renamed": {
                                        "value": "No Content"
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Requested file or folder not found",
                        "content": {
                            "text/plain": {
                                "examples": {
                                    "Not found": {
                                        "value": "Not found"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/file/move": {
            "post": {
                "summary": "Move or copy array of files and folders to a new location",
                "requestBody": {
                    "description": "Describe action (move or copy), files (and folders) and target path",
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "action": {
                                        "type": "string",
                                        "enum": [
                                            "move",
                                            "copy"
                                        ]
                                    },
                                    "files": {
                                        "type": "array",
                                        "items": {
                                            "type": "string"
                                        }
                                    },
                                    "path": {
                                        "type": "string"
                                    }
                                }
                            },
                            "examples": {
                                "Request to move two files indide \"/test\" folder to \"/test2\" folder": {
                                    "value": {
                                        "action": "move",
                                        "files": [
                                            "/test/index.html",
                                            "/test/main.js"
                                        ],
                                        "path": "/test2"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "204": {
                        "description": "Files and/or folders moved successfully",
                        "content": {
                            "text/plain": {
                                "examples": {
                                    "File or folder moved": {
                                        "value": "No Content"
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Requested file or folder not found",
                        "content": {
                            "text/plain": {
                                "examples": {
                                    "Not found": {
                                        "value": "Not found"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/file/new-folder": {
            "post": {
                "summary": "Create new folder",
                "requestBody": {
                    "description": "Describe path where to create new folder and folder name",
                    "required": true,
                    "content": {
                        "application/x-www-form-urlencoded": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "path": {
                                        "type": "string"
                                    },
                                    "name": {
                                        "type": "string"
                                    }
                                }
                            },
                            "examples": {
                                "Request to create new folder inside \"/test\" with name \"new-folder\"": {
                                    "value": {
                                        "path": "/test",
                                        "name": "new-folder"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "204": {
                        "description": "Folder created successfully",
                        "content": {
                            "text/plain": {
                                "examples": {
                                    "Folder created": {
                                        "value": "No Content"
                                    }
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Requested path not found",
                        "content": {
                            "text/plain": {
                                "examples": {
                                    "Not found": {
                                        "value": "Not found"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/file/zip": {
            "post": {
                "summary": "Download ZIP archive with files and folders",
                "requestBody": {
                    "description": "Describe files and folders to include in the ZIP archive",
                    "required": true,
                    "content": {
                        "application/x-www-form-urlencoded": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "files": {
                                        "type": "string",
                                        "required": true,
                                        "description": "Json-encoded array of files and folders to include in the ZIP archive"
                                    },
                                    "path": {
                                        "type": "string",
                                        "required": true,
                                        "description": "Path to the folder where mentioned files and folders are located"
                                    },
                                    "outFileName": {
                                        "type": "string",
                                        "required": false,
                                        "description": "Name of the output file. (Added since shttps v2.0.1)"
                                    },
                                    "level": {
                                        "type": "integer",
                                        "required": false,
                                        "description": "Level of compression. 0 - no compression, 1 - fast compression, 9 - best compression. (Added since shttps v2.1.0)"
                                    },
                                    "uncompressed": {
                                        "type": "string",
                                        "required": false,
                                        "description": "Comma separated list of file extensions that will not be compressed (STORED mode). (Added since shttps v2.1.0)"
                                    }
                                }
                            },
                            "examples": {
                                "Request to create ZIP archive with \"index.html\" file and \"js\" folder that are located in \"/www\" folder": {
                                    "value": {
                                        "files": [
                                            "index.html",
                                            "js"
                                        ],
                                        "path": "/www",
                                        "outFileName": "archive.zip",
                                        "level": 9,
                                        "uncompressed": "avi,mp3"
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "ZIP archive content",
                        "content": {
                            "application/zip": {
                                "schema": {
                                    "type": "string",
                                    "format": "binary"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Requested path not found",
                        "content": {
                            "text/plain": {
                                "examples": {
                                    "Not found": {
                                        "value": "Not found"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/api/file/thumbnail": {
            "get": {
                "summary": "Get thumbnail for image or video file",
                "description": "Currently only 512x384 webp thumbnails are supported (or jpg/png for java version)",
                "parameters": [
                    {
                        "name": "path",
                        "in": "query",
                        "description": "Path to the image file",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Thumbnail image",
                        "content": {
                            "image/webp": {
                                "schema": {
                                    "type": "string",
                                    "format": "binary"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Requested image file not found",
                        "content": {
                            "text/plain": {
                                "examples": {
                                    "Not found": {
                                        "value": "Not found"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}