Documentation
¶
Overview ¶
Package handler provides HTTP handlers for the MarkHub REST API.
Index ¶
- type AddFolderRequest
- type FileHandler
- type FileResponse
- type RemoveFolderRequest
- type TreeHandler
- func (h *TreeHandler) AddFolder(c *gin.Context)
- func (h *TreeHandler) GetFolders(c *gin.Context)
- func (h *TreeHandler) GetTree(c *gin.Context)
- func (h *TreeHandler) RemoveFolder(c *gin.Context)
- func (h *TreeHandler) UpdateFolder(c *gin.Context)
- func (h *TreeHandler) UpdateGlobalExclude(c *gin.Context)
- func (h *TreeHandler) UpdateRepoExclude(c *gin.Context)
- type TreeNode
- type UpdateFolderRequest
- type UpdateGlobalExcludeRequest
- type UpdateRepoExcludeRequest
- type WSHandler
- type WSMessage
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AddFolderRequest ¶
type AddFolderRequest struct {
Path string `json:"path" binding:"required"`
Alias string `json:"alias"`
GitRef string `json:"git_ref"`
SubPath string `json:"sub_path"`
Exclude []string `json:"exclude"`
}
AddFolderRequest represents a request to add a folder
type FileHandler ¶
type FileHandler struct {
// contains filtered or unexported fields
}
FileHandler handles file content API requests
func NewFileHandler ¶
func NewFileHandler(cfg *config.Config) *FileHandler
NewFileHandler creates a new file handler
func (*FileHandler) GetFile ¶
func (h *FileHandler) GetFile(c *gin.Context)
GetFile returns the rendered HTML for a markdown file
func (*FileHandler) GetRaw ¶
func (h *FileHandler) GetRaw(c *gin.Context)
GetRaw returns the raw markdown content
type FileResponse ¶
type FileResponse struct {
Path string `json:"path"`
Title string `json:"title"`
HTML string `json:"html"`
TOC []markdown.TOCItem `json:"toc"`
ModTime time.Time `json:"modTime"`
FolderID int `json:"folderId"`
}
FileResponse represents the response for a file request
type RemoveFolderRequest ¶
type RemoveFolderRequest struct {
Index int `json:"index"`
}
RemoveFolderRequest represents a request to remove a folder (by index)
type TreeHandler ¶
type TreeHandler struct {
// contains filtered or unexported fields
}
TreeHandler handles directory tree API requests
func NewTreeHandler ¶
func NewTreeHandler(cfg *config.Config) *TreeHandler
NewTreeHandler creates a new tree handler
func (*TreeHandler) AddFolder ¶
func (h *TreeHandler) AddFolder(c *gin.Context)
AddFolder adds a new folder to the configuration
func (*TreeHandler) GetFolders ¶
func (h *TreeHandler) GetFolders(c *gin.Context)
GetFolders returns the list of configured folders, global excludes, and repo excludes
func (*TreeHandler) GetTree ¶
func (h *TreeHandler) GetTree(c *gin.Context)
GetTree returns the directory tree structure for all configured folders
func (*TreeHandler) RemoveFolder ¶
func (h *TreeHandler) RemoveFolder(c *gin.Context)
RemoveFolder removes a folder from the configuration by index
func (*TreeHandler) UpdateFolder ¶
func (h *TreeHandler) UpdateFolder(c *gin.Context)
UpdateFolder updates a folder's settings by index
func (*TreeHandler) UpdateGlobalExclude ¶
func (h *TreeHandler) UpdateGlobalExclude(c *gin.Context)
UpdateGlobalExclude updates the global exclude patterns
func (*TreeHandler) UpdateRepoExclude ¶
func (h *TreeHandler) UpdateRepoExclude(c *gin.Context)
UpdateRepoExclude updates the exclude patterns for a specific repo path
type TreeNode ¶
type TreeNode struct {
Name string `json:"name"`
Type string `json:"type"`
Path string `json:"path,omitempty"`
Alias string `json:"alias,omitempty"`
FolderID int `json:"folderId,omitempty"`
Children []*TreeNode `json:"children,omitempty"`
ModTime *time.Time `json:"modTime,omitempty"`
Size int64 `json:"size,omitempty"`
IsRepoGroup bool `json:"isRepoGroup,omitempty"`
}
TreeNode represents a file or directory in the tree
type UpdateFolderRequest ¶
type UpdateFolderRequest struct {
Index int `json:"index"`
Alias string `json:"alias" binding:"required"`
GitRef string `json:"git_ref"`
SubPath string `json:"sub_path"`
Exclude []string `json:"exclude"`
}
UpdateFolderRequest represents a request to update a folder (identified by index)
type UpdateGlobalExcludeRequest ¶
type UpdateGlobalExcludeRequest struct {
Exclude []string `json:"exclude"`
}
UpdateGlobalExcludeRequest represents a request to update global excludes
type UpdateRepoExcludeRequest ¶
type UpdateRepoExcludeRequest struct {
Path string `json:"path" binding:"required"`
Exclude []string `json:"exclude"`
}
UpdateRepoExcludeRequest represents a request to update repo-level excludes
type WSHandler ¶
type WSHandler struct {
// contains filtered or unexported fields
}
WSHandler handles WebSocket connections for hot reload
func (*WSHandler) OnFileChange ¶
OnFileChange is called when a file change is detected