Documentation
¶
Index ¶
- func NewRouter(commentService *service.CommentService) *mux.Router
- type APIResponse
- type CommentHandler
- func (h *CommentHandler) CreateComment(w http.ResponseWriter, r *http.Request)
- func (h *CommentHandler) DeleteComment(w http.ResponseWriter, r *http.Request)
- func (h *CommentHandler) GetComment(w http.ResponseWriter, r *http.Request)
- func (h *CommentHandler) GetCommentChildren(w http.ResponseWriter, r *http.Request)
- func (h *CommentHandler) GetCommentPath(w http.ResponseWriter, r *http.Request)
- func (h *CommentHandler) GetCommentStats(w http.ResponseWriter, r *http.Request)
- func (h *CommentHandler) GetCommentTree(w http.ResponseWriter, r *http.Request)
- func (h *CommentHandler) GetCommentsByRoot(w http.ResponseWriter, r *http.Request)
- func (h *CommentHandler) GetCommentsByUser(w http.ResponseWriter, r *http.Request)
- func (h *CommentHandler) GetCommentsWithVotes(w http.ResponseWriter, r *http.Request)
- func (h *CommentHandler) GetTopComments(w http.ResponseWriter, r *http.Request)
- func (h *CommentHandler) GetUserCommentCount(w http.ResponseWriter, r *http.Request)
- func (h *CommentHandler) RemoveVote(w http.ResponseWriter, r *http.Request)
- func (h *CommentHandler) SearchComments(w http.ResponseWriter, r *http.Request)
- func (h *CommentHandler) UpdateComment(w http.ResponseWriter, r *http.Request)
- func (h *CommentHandler) VoteComment(w http.ResponseWriter, r *http.Request)
- type PaginatedResponse
- type Pagination
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type APIResponse ¶
type APIResponse struct {
Success bool `json:"success"`
Data interface{} `json:"data,omitempty"`
Error string `json:"error,omitempty"`
Message string `json:"message,omitempty"`
}
APIResponse represents a standard API response
type CommentHandler ¶
type CommentHandler struct {
// contains filtered or unexported fields
}
CommentHandler handles HTTP requests for comment operations
func NewCommentHandler ¶
func NewCommentHandler(commentService *service.CommentService) *CommentHandler
NewCommentHandler creates a new comment handler
func (*CommentHandler) CreateComment ¶
func (h *CommentHandler) CreateComment(w http.ResponseWriter, r *http.Request)
CreateComment handles POST /comments
func (*CommentHandler) DeleteComment ¶
func (h *CommentHandler) DeleteComment(w http.ResponseWriter, r *http.Request)
DeleteComment handles DELETE /comments/{id}
func (*CommentHandler) GetComment ¶
func (h *CommentHandler) GetComment(w http.ResponseWriter, r *http.Request)
GetComment handles GET /comments/{id}
func (*CommentHandler) GetCommentChildren ¶
func (h *CommentHandler) GetCommentChildren(w http.ResponseWriter, r *http.Request)
GetCommentChildren handles GET /comments/{id}/children
func (*CommentHandler) GetCommentPath ¶
func (h *CommentHandler) GetCommentPath(w http.ResponseWriter, r *http.Request)
GetCommentPath handles GET /comments/{id}/path
func (*CommentHandler) GetCommentStats ¶
func (h *CommentHandler) GetCommentStats(w http.ResponseWriter, r *http.Request)
GetCommentStats handles GET /roots/{root_id}/stats
func (*CommentHandler) GetCommentTree ¶
func (h *CommentHandler) GetCommentTree(w http.ResponseWriter, r *http.Request)
GetCommentTree handles GET /roots/{root_id}/tree
func (*CommentHandler) GetCommentsByRoot ¶
func (h *CommentHandler) GetCommentsByRoot(w http.ResponseWriter, r *http.Request)
GetCommentsByRoot handles GET /roots/{root_id}/comments
func (*CommentHandler) GetCommentsByUser ¶
func (h *CommentHandler) GetCommentsByUser(w http.ResponseWriter, r *http.Request)
GetCommentsByUser handles GET /users/{user_id}/comments
func (*CommentHandler) GetCommentsWithVotes ¶
func (h *CommentHandler) GetCommentsWithVotes(w http.ResponseWriter, r *http.Request)
GetCommentsWithVotes handles GET /roots/{root_id}/comments/with-votes
func (*CommentHandler) GetTopComments ¶
func (h *CommentHandler) GetTopComments(w http.ResponseWriter, r *http.Request)
GetTopComments handles GET /roots/{root_id}/top
func (*CommentHandler) GetUserCommentCount ¶
func (h *CommentHandler) GetUserCommentCount(w http.ResponseWriter, r *http.Request)
GetUserCommentCount handles GET /users/{user_id}/count
func (*CommentHandler) RemoveVote ¶
func (h *CommentHandler) RemoveVote(w http.ResponseWriter, r *http.Request)
RemoveVote handles DELETE /comments/{id}/vote
func (*CommentHandler) SearchComments ¶
func (h *CommentHandler) SearchComments(w http.ResponseWriter, r *http.Request)
SearchComments handles GET /roots/{root_id}/search
func (*CommentHandler) UpdateComment ¶
func (h *CommentHandler) UpdateComment(w http.ResponseWriter, r *http.Request)
UpdateComment handles PUT /comments/{id}
func (*CommentHandler) VoteComment ¶
func (h *CommentHandler) VoteComment(w http.ResponseWriter, r *http.Request)
VoteComment handles POST /comments/{id}/vote
type PaginatedResponse ¶
type PaginatedResponse struct {
Success bool `json:"success"`
Data interface{} `json:"data"`
Pagination *Pagination `json:"pagination,omitempty"`
Error string `json:"error,omitempty"`
}
PaginatedResponse represents a paginated API response
type Pagination ¶
type Pagination struct {
Limit int `json:"limit"`
Offset int `json:"offset"`
Total int `json:"total,omitempty"`
}
Pagination represents pagination metadata