Files
lemma/server/docs/docs.go
2024-12-19 23:59:27 +01:00

1791 lines
60 KiB
Go

// 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": {},
"license": {
"name": "Apache 2.0",
"url": "http://www.apache.org/licenses/LICENSE-2.0.html"
},
"version": "{{.Version}}"
},
"host": "{{.Host}}",
"basePath": "{{.BasePath}}",
"paths": {
"/admin/stats": {
"get": {
"security": [
{
"CookieAuth": []
}
],
"description": "Get system-wide statistics as an admin",
"produces": [
"application/json"
],
"tags": [
"Admin"
],
"summary": "Get system statistics",
"operationId": "adminGetSystemStats",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.SystemStats"
}
},
"500": {
"description": "Failed to get file stats",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
}
}
}
},
"/admin/users": {
"get": {
"security": [
{
"CookieAuth": []
}
],
"description": "Returns the list of all users",
"produces": [
"application/json"
],
"tags": [
"Admin"
],
"summary": "List all users",
"operationId": "adminListUsers",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/models.User"
}
}
},
"500": {
"description": "Failed to list users",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
}
}
},
"post": {
"security": [
{
"CookieAuth": []
}
],
"description": "Create a new user as an admin",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Admin"
],
"summary": "Create a new user",
"operationId": "adminCreateUser",
"parameters": [
{
"description": "User details",
"name": "user",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/handlers.CreateUserRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/models.User"
}
},
"400": {
"description": "Password must be at least 8 characters",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"409": {
"description": "Email already exists",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"500": {
"description": "Failed to initialize user workspace",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
}
}
}
},
"/admin/users/{userId}": {
"get": {
"security": [
{
"CookieAuth": []
}
],
"description": "Get a specific user as an admin",
"produces": [
"application/json"
],
"tags": [
"Admin"
],
"summary": "Get a specific user",
"operationId": "adminGetUser",
"parameters": [
{
"type": "integer",
"description": "User ID",
"name": "userId",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/models.User"
}
},
"400": {
"description": "Invalid user ID",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"404": {
"description": "User not found",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
}
}
},
"put": {
"security": [
{
"CookieAuth": []
}
],
"description": "Update a specific user as an admin",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"Admin"
],
"summary": "Update a specific user",
"operationId": "adminUpdateUser",
"parameters": [
{
"type": "integer",
"description": "User ID",
"name": "userId",
"in": "path",
"required": true
},
{
"description": "User details",
"name": "user",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/handlers.UpdateUserRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/models.User"
}
},
"400": {
"description": "Invalid request body",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"404": {
"description": "User not found",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"500": {
"description": "Failed to update user",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
}
}
},
"delete": {
"security": [
{
"CookieAuth": []
}
],
"description": "Delete a specific user as an admin",
"tags": [
"Admin"
],
"summary": "Delete a specific user",
"operationId": "adminDeleteUser",
"parameters": [
{
"type": "integer",
"description": "User ID",
"name": "userId",
"in": "path",
"required": true
}
],
"responses": {
"204": {
"description": "No Content"
},
"400": {
"description": "Cannot delete your own account",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"403": {
"description": "Cannot delete other admin users",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"404": {
"description": "User not found",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"500": {
"description": "Failed to delete user",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
}
}
}
},
"/admin/workspaces": {
"get": {
"security": [
{
"CookieAuth": []
}
],
"description": "List all workspaces and their stats as an admin",
"produces": [
"application/json"
],
"tags": [
"Admin"
],
"summary": "List all workspaces",
"operationId": "adminListWorkspaces",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/handlers.WorkspaceStats"
}
}
},
"500": {
"description": "Failed to get file stats",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
}
}
}
},
"/auth/login": {
"post": {
"description": "Logs in a user and returns a session with access and refresh tokens",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"auth"
],
"summary": "Login",
"parameters": [
{
"description": "Login request",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/handlers.LoginRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.LoginResponse"
},
"headers": {
"X-CSRF-Token": {
"type": "string",
"description": "CSRF token for future requests"
}
}
},
"400": {
"description": "Email and password are required",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"401": {
"description": "Invalid credentials",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"500": {
"description": "Failed to generate CSRF token",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
}
}
}
},
"/auth/logout": {
"post": {
"description": "Log out invalidates the user's session",
"tags": [
"auth"
],
"summary": "Logout",
"operationId": "logout",
"responses": {
"204": {
"description": "No Content"
},
"400": {
"description": "Session ID required",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"500": {
"description": "Failed to logout",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
}
}
}
},
"/auth/me": {
"get": {
"security": [
{
"CookieAuth": []
}
],
"description": "Returns the current authenticated user",
"produces": [
"application/json"
],
"tags": [
"auth"
],
"summary": "Get current user",
"operationId": "getCurrentUser",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/models.User"
}
},
"404": {
"description": "User not found",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
}
}
}
},
"/auth/refresh": {
"post": {
"description": "Refreshes the access token using the refresh token",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"auth"
],
"summary": "Refresh token",
"operationId": "refreshToken",
"responses": {
"200": {
"description": "OK",
"headers": {
"X-CSRF-Token": {
"type": "string",
"description": "New CSRF token"
}
}
},
"400": {
"description": "Refresh token required",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"401": {
"description": "Invalid refresh token",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"500": {
"description": "Failed to generate CSRF token",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
}
}
}
},
"/profile": {
"put": {
"security": [
{
"CookieAuth": []
}
],
"description": "Updates the user's profile",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"users"
],
"summary": "Update profile",
"operationId": "updateProfile",
"parameters": [
{
"description": "Profile update request",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/handlers.UpdateProfileRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/models.User"
}
},
"400": {
"description": "Current password is required to change email",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"401": {
"description": "Current password is incorrect",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"404": {
"description": "User not found",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"409": {
"description": "Email already in use",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"500": {
"description": "Failed to update profile",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
}
}
},
"delete": {
"security": [
{
"CookieAuth": []
}
],
"description": "Deletes the user's account and all associated data",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"users"
],
"summary": "Delete account",
"operationId": "deleteAccount",
"parameters": [
{
"description": "Account deletion request",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/handlers.DeleteAccountRequest"
}
}
],
"responses": {
"204": {
"description": "No Content - Account deleted successfully"
},
"400": {
"description": "Invalid request body",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"401": {
"description": "Password is incorrect",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"403": {
"description": "Cannot delete the last admin account",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"404": {
"description": "User not found",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"500": {
"description": "Failed to delete account",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
}
}
}
},
"/workspaces": {
"get": {
"security": [
{
"CookieAuth": []
}
],
"description": "Lists all workspaces for the current user",
"produces": [
"application/json"
],
"tags": [
"workspaces"
],
"summary": "List workspaces",
"operationId": "listWorkspaces",
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/models.Workspace"
}
}
},
"500": {
"description": "Failed to list workspaces",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
}
}
},
"post": {
"security": [
{
"CookieAuth": []
}
],
"description": "Creates a new workspace",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"workspaces"
],
"summary": "Create workspace",
"operationId": "createWorkspace",
"parameters": [
{
"description": "Workspace",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/models.Workspace"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/models.Workspace"
}
},
"400": {
"description": "Invalid workspace",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"500": {
"description": "Failed to setup git repo",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
}
}
}
},
"/workspaces/last": {
"get": {
"security": [
{
"CookieAuth": []
}
],
"description": "Returns the name of the last opened workspace",
"produces": [
"application/json"
],
"tags": [
"workspaces"
],
"summary": "Get last workspace name",
"operationId": "getLastWorkspaceName",
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.LastWorkspaceNameResponse"
}
},
"500": {
"description": "Failed to get last workspace",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
}
}
},
"put": {
"security": [
{
"CookieAuth": []
}
],
"description": "Updates the name of the last opened workspace",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"workspaces"
],
"summary": "Update last workspace name",
"operationId": "updateLastWorkspaceName",
"responses": {
"204": {
"description": "No Content - Last workspace updated successfully"
},
"400": {
"description": "Invalid request body",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"500": {
"description": "Failed to update last workspace",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
}
}
}
},
"/workspaces/{workspace_name}": {
"get": {
"security": [
{
"CookieAuth": []
}
],
"description": "Returns the current workspace",
"produces": [
"application/json"
],
"tags": [
"workspaces"
],
"summary": "Get workspace",
"operationId": "getWorkspace",
"parameters": [
{
"type": "string",
"description": "Workspace name",
"name": "workspace_name",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/models.Workspace"
}
},
"500": {
"description": "Internal server error",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
}
}
},
"put": {
"security": [
{
"CookieAuth": []
}
],
"description": "Updates the current workspace",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"workspaces"
],
"summary": "Update workspace",
"operationId": "updateWorkspace",
"parameters": [
{
"type": "string",
"description": "Workspace name",
"name": "workspace_name",
"in": "path",
"required": true
},
{
"description": "Workspace",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/models.Workspace"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/models.Workspace"
}
},
"400": {
"description": "Invalid request body",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"500": {
"description": "Failed to setup git repo",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
}
}
},
"delete": {
"security": [
{
"CookieAuth": []
}
],
"description": "Deletes the current workspace",
"produces": [
"application/json"
],
"tags": [
"workspaces"
],
"summary": "Delete workspace",
"operationId": "deleteWorkspace",
"parameters": [
{
"type": "string",
"description": "Workspace name",
"name": "workspace_name",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.DeleteWorkspaceResponse"
}
},
"400": {
"description": "Cannot delete the last workspace",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"500": {
"description": "Failed to commit transaction",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
}
}
}
},
"/workspaces/{workspace_name}/files": {
"get": {
"security": [
{
"CookieAuth": []
}
],
"description": "Lists all files in the user's workspace",
"produces": [
"application/json"
],
"tags": [
"files"
],
"summary": "List files",
"operationId": "listFiles",
"parameters": [
{
"type": "string",
"description": "Workspace name",
"name": "workspace_name",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"type": "array",
"items": {
"$ref": "#/definitions/storage.FileNode"
}
}
},
"500": {
"description": "Failed to list files",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
}
}
}
},
"/workspaces/{workspace_name}/files/last": {
"get": {
"security": [
{
"CookieAuth": []
}
],
"description": "Returns the path of the last opened file in the user's workspace",
"produces": [
"application/json"
],
"tags": [
"files"
],
"summary": "Get last opened file",
"operationId": "getLastOpenedFile",
"parameters": [
{
"type": "string",
"description": "Workspace name",
"name": "workspace_name",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.LastOpenedFileResponse"
}
},
"400": {
"description": "Invalid file path",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"500": {
"description": "Failed to get last opened file",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
}
}
},
"put": {
"security": [
{
"CookieAuth": []
}
],
"description": "Updates the last opened file in the user's workspace",
"consumes": [
"application/json"
],
"produces": [
"application/json"
],
"tags": [
"files"
],
"summary": "Update last opened file",
"operationId": "updateLastOpenedFile",
"parameters": [
{
"type": "string",
"description": "Workspace name",
"name": "workspace_name",
"in": "path",
"required": true
},
{
"description": "Update last opened file request",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/handlers.UpdateLastOpenedFileRequest"
}
}
],
"responses": {
"204": {
"description": "No Content - Last opened file updated successfully"
},
"400": {
"description": "Invalid file path",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"404": {
"description": "File not found",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"500": {
"description": "Failed to update file",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
}
}
}
},
"/workspaces/{workspace_name}/files/lookup": {
"get": {
"security": [
{
"CookieAuth": []
}
],
"description": "Returns the paths of files with the given name in the user's workspace",
"produces": [
"application/json"
],
"tags": [
"files"
],
"summary": "Lookup file by name",
"operationId": "lookupFileByName",
"parameters": [
{
"type": "string",
"description": "Workspace name",
"name": "workspace_name",
"in": "path",
"required": true
},
{
"type": "string",
"description": "File name",
"name": "filename",
"in": "query",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.LookupResponse"
}
},
"400": {
"description": "Filename is required",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"404": {
"description": "File not found",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
}
}
}
},
"/workspaces/{workspace_name}/files/{file_path}": {
"get": {
"security": [
{
"CookieAuth": []
}
],
"description": "Returns the content of a file in the user's workspace",
"produces": [
"text/plain"
],
"tags": [
"files"
],
"summary": "Get file content",
"operationId": "getFileContent",
"parameters": [
{
"type": "string",
"description": "Workspace name",
"name": "workspace_name",
"in": "path",
"required": true
},
{
"type": "string",
"description": "File path",
"name": "file_path",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "Raw file content",
"schema": {
"type": "string"
}
},
"400": {
"description": "Invalid file path",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"404": {
"description": "File not found",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"500": {
"description": "Failed to write response",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
}
}
},
"post": {
"security": [
{
"CookieAuth": []
}
],
"description": "Saves the content of a file in the user's workspace",
"consumes": [
"text/plain"
],
"produces": [
"application/json"
],
"tags": [
"files"
],
"summary": "Save file",
"operationId": "saveFile",
"parameters": [
{
"type": "string",
"description": "Workspace name",
"name": "workspace_name",
"in": "path",
"required": true
},
{
"type": "string",
"description": "File path",
"name": "file_path",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.SaveFileResponse"
}
},
"400": {
"description": "Invalid file path",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"500": {
"description": "Failed to save file",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
}
}
},
"delete": {
"security": [
{
"CookieAuth": []
}
],
"description": "Deletes a file in the user's workspace",
"tags": [
"files"
],
"summary": "Delete file",
"operationId": "deleteFile",
"parameters": [
{
"type": "string",
"description": "Workspace name",
"name": "workspace_name",
"in": "path",
"required": true
},
{
"type": "string",
"description": "File path",
"name": "file_path",
"in": "path",
"required": true
}
],
"responses": {
"204": {
"description": "No Content - File deleted successfully"
},
"400": {
"description": "Invalid file path",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"404": {
"description": "File not found",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"500": {
"description": "Failed to delete file",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
}
}
}
},
"/workspaces/{workspace_name}/git/commit": {
"post": {
"security": [
{
"CookieAuth": []
}
],
"description": "Stages, commits, and pushes changes to the remote repository",
"produces": [
"application/json"
],
"tags": [
"git"
],
"summary": "Stage, commit, and push changes",
"operationId": "stageCommitAndPush",
"parameters": [
{
"type": "string",
"description": "Workspace name",
"name": "workspace_name",
"in": "path",
"required": true
},
{
"description": "Commit request",
"name": "body",
"in": "body",
"required": true,
"schema": {
"$ref": "#/definitions/handlers.CommitRequest"
}
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.CommitResponse"
}
},
"400": {
"description": "Commit message is required",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
},
"500": {
"description": "Failed to stage, commit, and push changes",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
}
}
}
},
"/workspaces/{workspace_name}/git/pull": {
"post": {
"security": [
{
"CookieAuth": []
}
],
"description": "Pulls changes from the remote repository",
"produces": [
"application/json"
],
"tags": [
"git"
],
"summary": "Pull changes from remote",
"operationId": "pullChanges",
"parameters": [
{
"type": "string",
"description": "Workspace name",
"name": "workspace_name",
"in": "path",
"required": true
}
],
"responses": {
"200": {
"description": "OK",
"schema": {
"$ref": "#/definitions/handlers.PullResponse"
}
},
"500": {
"description": "Failed to pull changes",
"schema": {
"$ref": "#/definitions/handlers.ErrorResponse"
}
}
}
}
}
},
"definitions": {
"handlers.CommitRequest": {
"type": "object",
"properties": {
"message": {
"type": "string",
"example": "Initial commit"
}
}
},
"handlers.CommitResponse": {
"type": "object",
"properties": {
"commitHash": {
"type": "string",
"example": "a1b2c3d4"
}
}
},
"handlers.CreateUserRequest": {
"type": "object",
"properties": {
"displayName": {
"type": "string"
},
"email": {
"type": "string"
},
"password": {
"type": "string"
},
"role": {
"$ref": "#/definitions/models.UserRole"
}
}
},
"handlers.DeleteAccountRequest": {
"type": "object",
"properties": {
"password": {
"type": "string"
}
}
},
"handlers.DeleteWorkspaceResponse": {
"type": "object",
"properties": {
"nextWorkspaceName": {
"type": "string"
}
}
},
"handlers.ErrorResponse": {
"type": "object",
"properties": {
"message": {
"type": "string"
}
}
},
"handlers.LastOpenedFileResponse": {
"type": "object",
"properties": {
"lastOpenedFilePath": {
"type": "string"
}
}
},
"handlers.LastWorkspaceNameResponse": {
"type": "object",
"properties": {
"lastWorkspaceName": {
"type": "string"
}
}
},
"handlers.LoginRequest": {
"type": "object",
"properties": {
"email": {
"type": "string"
},
"password": {
"type": "string"
}
}
},
"handlers.LoginResponse": {
"type": "object",
"properties": {
"expiresAt": {
"type": "string"
},
"sessionId": {
"type": "string"
},
"user": {
"$ref": "#/definitions/models.User"
}
}
},
"handlers.LookupResponse": {
"type": "object",
"properties": {
"paths": {
"type": "array",
"items": {
"type": "string"
}
}
}
},
"handlers.PullResponse": {
"type": "object",
"properties": {
"message": {
"type": "string",
"example": "Pulled changes from remote"
}
}
},
"handlers.SaveFileResponse": {
"type": "object",
"properties": {
"filePath": {
"type": "string"
},
"size": {
"type": "integer"
},
"updatedAt": {
"type": "string"
}
}
},
"handlers.SystemStats": {
"type": "object",
"properties": {
"activeUsers": {
"description": "Users with activity in last 30 days",
"type": "integer"
},
"totalFiles": {
"type": "integer"
},
"totalSize": {
"type": "integer"
},
"totalUsers": {
"type": "integer"
},
"totalWorkspaces": {
"type": "integer"
}
}
},
"handlers.UpdateLastOpenedFileRequest": {
"type": "object",
"properties": {
"filePath": {
"type": "string"
}
}
},
"handlers.UpdateProfileRequest": {
"type": "object",
"properties": {
"currentPassword": {
"type": "string"
},
"displayName": {
"type": "string"
},
"email": {
"type": "string"
},
"newPassword": {
"type": "string"
}
}
},
"handlers.UpdateUserRequest": {
"type": "object",
"properties": {
"displayName": {
"type": "string"
},
"email": {
"type": "string"
},
"password": {
"type": "string"
},
"role": {
"$ref": "#/definitions/models.UserRole"
}
}
},
"handlers.WorkspaceStats": {
"type": "object",
"properties": {
"totalFiles": {
"type": "integer"
},
"totalSize": {
"type": "integer"
},
"userEmail": {
"type": "string"
},
"userID": {
"type": "integer"
},
"workspaceCreatedAt": {
"type": "string"
},
"workspaceID": {
"type": "integer"
},
"workspaceName": {
"type": "string"
}
}
},
"models.User": {
"type": "object",
"required": [
"email",
"id",
"role"
],
"properties": {
"createdAt": {
"type": "string"
},
"displayName": {
"type": "string"
},
"email": {
"type": "string"
},
"id": {
"type": "integer",
"minimum": 1
},
"lastWorkspaceId": {
"type": "integer"
},
"role": {
"enum": [
"admin",
"editor",
"viewer"
],
"allOf": [
{
"$ref": "#/definitions/models.UserRole"
}
]
}
}
},
"models.UserRole": {
"type": "string",
"enum": [
"admin",
"editor",
"viewer"
],
"x-enum-varnames": [
"RoleAdmin",
"RoleEditor",
"RoleViewer"
]
},
"models.Workspace": {
"type": "object",
"required": [
"id",
"name",
"userId"
],
"properties": {
"autoSave": {
"type": "boolean"
},
"createdAt": {
"type": "string"
},
"gitAutoCommit": {
"type": "boolean"
},
"gitCommitEmail": {
"type": "string"
},
"gitCommitMsgTemplate": {
"type": "string"
},
"gitCommitName": {
"type": "string"
},
"gitEnabled": {
"type": "boolean"
},
"gitToken": {
"type": "string"
},
"gitUrl": {
"type": "string"
},
"gitUser": {
"type": "string"
},
"id": {
"type": "integer",
"minimum": 1
},
"lastOpenedFilePath": {
"type": "string"
},
"name": {
"type": "string"
},
"showHiddenFiles": {
"type": "boolean"
},
"theme": {
"description": "Integrated settings",
"type": "string",
"enum": [
"light",
"dark"
]
},
"userId": {
"type": "integer",
"minimum": 1
}
}
},
"storage.FileNode": {
"type": "object",
"properties": {
"children": {
"type": "array",
"items": {
"$ref": "#/definitions/storage.FileNode"
}
},
"id": {
"type": "string"
},
"name": {
"type": "string"
},
"path": {
"type": "string"
}
}
}
},
"securityDefinitions": {
"CookieAuth": {
"type": "apiKey",
"name": "access_token",
"in": "cookie"
}
}
}`
// SwaggerInfo holds exported Swagger Info so clients can modify it
var SwaggerInfo = &swag.Spec{
Version: "1.0",
Host: "",
BasePath: "/api/v1",
Schemes: []string{},
Title: "Lemma API",
Description: "This is the API for Lemma markdown note taking app.",
InfoInstanceName: "swagger",
SwaggerTemplate: docTemplate,
LeftDelim: "{{",
RightDelim: "}}",
}
func init() {
swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo)
}