// Package docs Code generated by swaggo/swag. DO NOT EDIT package docs import "github.com/swaggo/swag" const docTemplate = `{ "schemes": {{ marshal .Schemes }}, "swagger": "2.0", "info": { "description": "{{escape .Description}}", "title": "{{.Title}}", "contact": {}, "version": "{{.Version}}" }, "host": "{{.Host}}", "basePath": "{{.BasePath}}", "paths": { "/api/preview": { "get": { "description": "Returns a preview image based on the requested path and size.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Resources" ], "summary": "Get image preview", "parameters": [ { "type": "string", "description": "File path of the image to preview", "name": "path", "in": "query", "required": true }, { "type": "string", "description": "Preview size ('small' or 'large'). Default is based on server config.", "name": "size", "in": "query" } ], "responses": { "200": { "description": "Preview image content", "schema": { "type": "file" } }, "202": { "description": "Download permissions required", "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "400": { "description": "Invalid request path", "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "404": { "description": "File not found", "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "415": { "description": "Unsupported file type for preview", "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "500": { "description": "Internal server error", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } } }, "/api/raw": { "get": { "description": "Returns the raw content of a file, multiple files, or a directory. Supports downloading files as archives in various formats.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Resources" ], "summary": "Get raw content of a file, multiple files, or directory", "parameters": [ { "type": "string", "description": "Comma-separated list of specific files within the directory (required)", "name": "files", "in": "query", "required": true }, { "type": "boolean", "description": "If true, sets 'Content-Disposition' to 'inline'. Otherwise, defaults to 'attachment'.", "name": "inline", "in": "query" }, { "type": "string", "description": "Compression algorithm for archiving multiple files or directories. Options: 'zip' and 'tar.gz'. Default is 'zip'.", "name": "algo", "in": "query" } ], "responses": { "200": { "description": "Raw file or directory content, or archive for multiple files", "schema": { "type": "file" } }, "202": { "description": "Download permissions required", "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "400": { "description": "Invalid request path", "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "404": { "description": "File or directory not found", "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "500": { "description": "Internal server error", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } } }, "/api/resources": { "get": { "description": "Returns metadata and optionally file contents for a specified resource path.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Resources" ], "summary": "Get resource information", "parameters": [ { "type": "string", "description": "Path to the resource", "name": "path", "in": "query", "required": true }, { "type": "string", "description": "Source name for the desired source, default is used if not provided", "name": "source", "in": "query" }, { "type": "string", "description": "Name for the desired source, default is used if not provided", "name": "source", "in": "query" }, { "type": "string", "description": "Include file content if true", "name": "content", "in": "query" }, { "type": "string", "description": "Optional checksum validation", "name": "checksum", "in": "query" } ], "responses": { "200": { "description": "Resource metadata", "schema": { "$ref": "#/definitions/files.FileInfo" } }, "404": { "description": "Resource not found", "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "500": { "description": "Internal server error", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } }, "put": { "description": "Updates an existing file at the specified path.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Resources" ], "summary": "Update a file resource", "parameters": [ { "type": "string", "description": "Path to the resource", "name": "path", "in": "query", "required": true }, { "type": "string", "description": "Source name for the desired source, default is used if not provided", "name": "source", "in": "query" }, { "type": "string", "description": "Name for the desired source, default is used if not provided", "name": "source", "in": "query" } ], "responses": { "200": { "description": "Resource updated successfully" }, "403": { "description": "Forbidden", "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "404": { "description": "Resource not found", "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "405": { "description": "Method not allowed", "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "500": { "description": "Internal server error", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } }, "post": { "description": "Creates a new resource or uploads a file at the specified path. Supports file uploads and directory creation.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Resources" ], "summary": "Create or upload a resource", "parameters": [ { "type": "string", "description": "Path to the resource", "name": "path", "in": "query", "required": true }, { "type": "string", "description": "Source name for the desired source, default is used if not provided", "name": "source", "in": "query" }, { "type": "string", "description": "Name for the desired source, default is used if not provided", "name": "source", "in": "query" }, { "type": "boolean", "description": "Override existing file if true", "name": "override", "in": "query" } ], "responses": { "200": { "description": "Resource created successfully" }, "403": { "description": "Forbidden", "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "404": { "description": "Resource not found", "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "409": { "description": "Conflict - Resource already exists", "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "500": { "description": "Internal server error", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } }, "delete": { "description": "Deletes a resource located at the specified path.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Resources" ], "summary": "Delete a resource", "parameters": [ { "type": "string", "description": "Path to the resource", "name": "path", "in": "query", "required": true }, { "type": "string", "description": "Source name for the desired source, default is used if not provided", "name": "source", "in": "query" }, { "type": "string", "description": "Name for the desired source, default is used if not provided", "name": "source", "in": "query" } ], "responses": { "200": { "description": "Resource deleted successfully" }, "403": { "description": "Forbidden", "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "404": { "description": "Resource not found", "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "500": { "description": "Internal server error", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } }, "patch": { "description": "Moves or renames a resource to a new destination.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Resources" ], "summary": "Patch resource (move/rename)", "parameters": [ { "type": "string", "description": "Path from resource", "name": "from", "in": "query", "required": true }, { "type": "string", "description": "Source name for the desired source, default is used if not provided", "name": "source", "in": "query" }, { "type": "string", "description": "Destination path for the resource", "name": "destination", "in": "query", "required": true }, { "type": "string", "description": "Action to perform (copy, rename)", "name": "action", "in": "query", "required": true }, { "type": "boolean", "description": "Overwrite if destination exists", "name": "overwrite", "in": "query" }, { "type": "boolean", "description": "Rename if destination exists", "name": "rename", "in": "query" } ], "responses": { "200": { "description": "Resource moved/renamed successfully" }, "403": { "description": "Forbidden", "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "404": { "description": "Resource not found", "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "409": { "description": "Conflict - Destination exists", "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "500": { "description": "Internal server error", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } } }, "/api/search": { "get": { "description": "Searches for files matching the provided query. Returns file paths and metadata based on the user's session and scope.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Search" ], "summary": "Search Files", "parameters": [ { "type": "string", "description": "Search query", "name": "query", "in": "query", "required": true }, { "type": "string", "description": "path within user scope to search, for example '/first/second' to search within the second directory only", "name": "scope", "in": "query" }, { "type": "string", "description": "User session ID, add unique value to prevent collisions", "name": "SessionId", "in": "header" } ], "responses": { "200": { "description": "List of search results", "schema": { "type": "array", "items": { "$ref": "#/definitions/files.SearchResult" } } }, "400": { "description": "Bad Request", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } } }, "/api/settings": { "get": { "description": "Returns the current configuration settings for signup, user directories, rules, frontend, and commands.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Settings" ], "summary": "Get system settings", "responses": { "200": { "description": "System settings data", "schema": { "$ref": "#/definitions/http.settingsData" } } } }, "put": { "description": "Updates the system configuration settings for signup, user directories, rules, frontend, and commands.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Settings" ], "summary": "Update system settings", "parameters": [ { "description": "Settings data to update", "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/http.settingsData" } } ], "responses": { "200": { "description": "Settings updated successfully" }, "400": { "description": "Bad request - failed to decode body", "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "500": { "description": "Internal server error", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } } }, "/api/share": { "get": { "description": "Retrieves all share links associated with a specific resource path for the current user.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Shares" ], "summary": "Get share links by path", "parameters": [ { "type": "string", "description": "Resource path for which to retrieve share links", "name": "path", "in": "query", "required": true } ], "responses": { "200": { "description": "List of share links for the specified path", "schema": { "type": "array", "items": { "$ref": "#/definitions/share.Link" } } }, "500": { "description": "Internal server error", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } } }, "/api/shares": { "get": { "description": "Returns a list of share links for the current user, or all links if the user is an admin.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Shares" ], "summary": "List share links", "responses": { "200": { "description": "List of share links", "schema": { "type": "array", "items": { "$ref": "#/definitions/share.Link" } } }, "500": { "description": "Internal server error", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } }, "post": { "description": "Creates a new share link with an optional expiration time and password protection.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Shares" ], "summary": "Create a share link", "parameters": [ { "description": "Share link creation parameters", "name": "body", "in": "body", "required": true, "schema": { "$ref": "#/definitions/share.CreateBody" } } ], "responses": { "200": { "description": "Created share link", "schema": { "$ref": "#/definitions/share.Link" } }, "400": { "description": "Bad request - failed to decode body", "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "500": { "description": "Internal server error", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } } }, "/api/shares/{hash}": { "delete": { "description": "Deletes a share link specified by its hash.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Shares" ], "summary": "Delete a share link", "parameters": [ { "type": "string", "description": "Hash of the share link to delete", "name": "hash", "in": "path", "required": true } ], "responses": { "200": { "description": "Share link deleted successfully" }, "400": { "description": "Bad request - missing or invalid hash", "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "500": { "description": "Internal server error", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } } }, "/api/usage": { "get": { "description": "Returns the total and used disk space for a specified directory.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Resources" ], "summary": "Get disk usage", "parameters": [ { "type": "string", "description": "Source name for the desired source, default is used if not provided", "name": "source", "in": "query" } ], "responses": { "200": { "description": "Disk usage details", "schema": { "$ref": "#/definitions/http.DiskUsageResponse" } }, "404": { "description": "Directory not found", "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "500": { "description": "Internal server error", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } } }, "/api/users": { "post": { "description": "Adds a new user to the system.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Users" ], "summary": "Create a new user", "parameters": [ { "description": "User data to create a new user", "name": "data", "in": "body", "required": true, "schema": { "$ref": "#/definitions/users.User" } } ], "responses": { "201": { "description": "Created user", "schema": { "$ref": "#/definitions/users.User" } }, "400": { "description": "Bad Request", "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "500": { "description": "Internal Server Error", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } } }, "/api/users/{id}": { "get": { "description": "Returns a user's details based on their ID.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Users" ], "summary": "Retrieve a user by ID", "parameters": [ { "type": "integer", "description": "User ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "User details", "schema": { "$ref": "#/definitions/users.User" } }, "403": { "description": "Forbidden", "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "404": { "description": "Not Found", "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "500": { "description": "Internal Server Error", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } }, "put": { "description": "Updates the details of a user identified by ID.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Users" ], "summary": "Update a user's details", "parameters": [ { "type": "integer", "description": "User ID", "name": "id", "in": "path", "required": true }, { "description": "User data to update", "name": "data", "in": "body", "required": true, "schema": { "$ref": "#/definitions/users.User" } } ], "responses": { "200": { "description": "Updated user details", "schema": { "$ref": "#/definitions/users.User" } }, "400": { "description": "Bad Request", "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "403": { "description": "Forbidden", "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "500": { "description": "Internal Server Error", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } }, "delete": { "description": "Deletes a user identified by their ID.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Users" ], "summary": "Delete a user by ID", "parameters": [ { "type": "integer", "description": "User ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "User deleted successfully" }, "403": { "description": "Forbidden", "schema": { "type": "object", "additionalProperties": { "type": "string" } } }, "500": { "description": "Internal Server Error", "schema": { "type": "object", "additionalProperties": { "type": "string" } } } } } }, "/health": { "get": { "description": "Returns the health status of the API.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "Health" ], "summary": "Health Check", "responses": { "200": { "description": "successful health check response", "schema": { "$ref": "#/definitions/http.HttpResponse" } } } } } }, "definitions": { "files.FileInfo": { "type": "object", "properties": { "files": { "description": "files in the directory", "type": "array", "items": { "$ref": "#/definitions/files.ItemInfo" } }, "folders": { "description": "folders in the directory", "type": "array", "items": { "$ref": "#/definitions/files.ItemInfo" } }, "hidden": { "description": "whether the file is hidden", "type": "boolean" }, "modified": { "description": "modification time", "type": "string" }, "name": { "description": "name of the file", "type": "string" }, "path": { "description": "path scoped to the associated index", "type": "string" }, "size": { "description": "length in bytes for regular files", "type": "integer" }, "type": { "description": "type of the file, either \"directory\" or a file mimetype", "type": "string" } } }, "files.ItemInfo": { "type": "object", "properties": { "hidden": { "description": "whether the file is hidden", "type": "boolean" }, "modified": { "description": "modification time", "type": "string" }, "name": { "description": "name of the file", "type": "string" }, "size": { "description": "length in bytes for regular files", "type": "integer" }, "type": { "description": "type of the file, either \"directory\" or a file mimetype", "type": "string" } } }, "files.SearchResult": { "type": "object", "properties": { "path": { "type": "string" }, "size": { "type": "integer" }, "type": { "type": "string" } } }, "http.DiskUsageResponse": { "type": "object", "properties": { "total": { "type": "integer" }, "used": { "type": "integer" } } }, "http.HttpResponse": { "type": "object", "properties": { "message": { "type": "string" }, "status": { "type": "integer" }, "token": { "type": "string" } } }, "http.settingsData": { "type": "object", "properties": { "commands": { "type": "object", "additionalProperties": { "type": "array", "items": { "type": "string" } } }, "createUserDir": { "type": "boolean" }, "defaults": { "$ref": "#/definitions/settings.UserDefaults" }, "frontend": { "$ref": "#/definitions/settings.Frontend" }, "rules": { "type": "array", "items": { "$ref": "#/definitions/users.Rule" } }, "signup": { "type": "boolean" }, "userHomeBasePath": { "type": "string" } } }, "settings.ExternalLink": { "type": "object", "properties": { "text": { "type": "string" }, "title": { "type": "string" }, "url": { "type": "string" } } }, "settings.Frontend": { "type": "object", "properties": { "color": { "type": "string" }, "disableDefaultLinks": { "type": "boolean" }, "disableUsedPercentage": { "type": "boolean" }, "externalLinks": { "type": "array", "items": { "$ref": "#/definitions/settings.ExternalLink" } }, "files": { "type": "string" }, "name": { "type": "string" } } }, "settings.UserDefaults": { "type": "object", "properties": { "commands": { "type": "array", "items": { "type": "string" } }, "darkMode": { "type": "boolean" }, "dateFormat": { "type": "boolean" }, "disableOnlyOfficeExt": { "type": "string" }, "disableSettings": { "type": "boolean" }, "gallerySize": { "type": "integer" }, "locale": { "type": "string" }, "lockPassword": { "type": "boolean" }, "perm": { "$ref": "#/definitions/users.Permissions" }, "permissions": { "$ref": "#/definitions/users.Permissions" }, "quickDownload": { "type": "boolean" }, "rules": { "type": "array", "items": { "$ref": "#/definitions/users.Rule" } }, "scope": { "type": "string" }, "showHidden": { "type": "boolean" }, "singleClick": { "type": "boolean" }, "sorting": { "type": "object", "properties": { "asc": { "type": "boolean" }, "by": { "type": "string" } } }, "stickySidebar": { "type": "boolean" }, "themeColor": { "type": "string" }, "viewMode": { "type": "string" } } }, "share.CreateBody": { "type": "object", "properties": { "expires": { "type": "string" }, "password": { "type": "string" }, "unit": { "type": "string" } } }, "share.Link": { "type": "object", "properties": { "expire": { "type": "integer" }, "hash": { "type": "string" }, "password_hash": { "type": "string" }, "path": { "type": "string" }, "token": { "description": "Token is a random value that will only be set when PasswordHash is set. It is\nURL-Safe and is used to download links in password-protected shares via a\nquery arg.", "type": "string" }, "userID": { "type": "integer" } } }, "users.AuthToken": { "type": "object", "properties": { "Permissions": { "$ref": "#/definitions/users.Permissions" }, "belongsTo": { "type": "integer" }, "createdAt": { "type": "integer" }, "expiresAt": { "type": "integer" }, "key": { "type": "string" }, "name": { "type": "string" } } }, "users.Permissions": { "type": "object", "properties": { "admin": { "type": "boolean" }, "api": { "type": "boolean" }, "create": { "type": "boolean" }, "delete": { "type": "boolean" }, "download": { "type": "boolean" }, "execute": { "type": "boolean" }, "modify": { "type": "boolean" }, "rename": { "type": "boolean" }, "share": { "type": "boolean" } } }, "users.Regexp": { "type": "object", "properties": { "raw": { "type": "string" } } }, "users.Rule": { "type": "object", "properties": { "allow": { "type": "boolean" }, "id": { "type": "string" }, "path": { "type": "string" }, "regex": { "type": "boolean" }, "regexp": { "$ref": "#/definitions/users.Regexp" } } }, "users.Sorting": { "type": "object", "properties": { "asc": { "type": "boolean" }, "by": { "type": "string" } } }, "users.User": { "type": "object", "properties": { "apiKeys": { "type": "object", "additionalProperties": { "$ref": "#/definitions/users.AuthToken" } }, "commands": { "type": "array", "items": { "type": "string" } }, "darkMode": { "type": "boolean" }, "dateFormat": { "type": "boolean" }, "disableOnlyOfficeExt": { "type": "string" }, "disableSettings": { "type": "boolean" }, "gallerySize": { "type": "integer" }, "id": { "type": "integer" }, "locale": { "type": "string" }, "lockPassword": { "type": "boolean" }, "password": { "type": "string" }, "perm": { "$ref": "#/definitions/users.Permissions" }, "quickDownload": { "type": "boolean" }, "rules": { "type": "array", "items": { "$ref": "#/definitions/users.Rule" } }, "scope": { "type": "string" }, "showHidden": { "type": "boolean" }, "singleClick": { "type": "boolean" }, "sorting": { "$ref": "#/definitions/users.Sorting" }, "stickySidebar": { "type": "boolean" }, "themeColor": { "type": "string" }, "username": { "type": "string" }, "viewMode": { "type": "string" } } } } }` // SwaggerInfo holds exported Swagger Info so clients can modify it var SwaggerInfo = &swag.Spec{ Version: "", Host: "", BasePath: "", Schemes: []string{}, Title: "", Description: "", InfoInstanceName: "swagger", SwaggerTemplate: docTemplate, LeftDelim: "{{", RightDelim: "}}", }