api

package
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 13, 2025 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewRouter

func NewRouter(commentService *service.CommentService) *mux.Router

Router sets up and returns the HTTP router with all endpoints

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 EchoAdapter added in v1.0.2

type EchoAdapter struct {
	// contains filtered or unexported fields
}

EchoAdapter wraps the CommentHandler for Echo framework

func NewEchoAdapter added in v1.0.2

func NewEchoAdapter(commentService *service.CommentService) *EchoAdapter

NewEchoAdapter creates a new Echo adapter for Commentific

func (*EchoAdapter) CreateComment added in v1.0.2

func (a *EchoAdapter) CreateComment(c echo.Context) error

func (*EchoAdapter) DeleteComment added in v1.0.2

func (a *EchoAdapter) DeleteComment(c echo.Context) error

func (*EchoAdapter) GetComment added in v1.0.2

func (a *EchoAdapter) GetComment(c echo.Context) error

func (*EchoAdapter) GetCommentChildren added in v1.0.2

func (a *EchoAdapter) GetCommentChildren(c echo.Context) error

func (*EchoAdapter) GetCommentPath added in v1.0.2

func (a *EchoAdapter) GetCommentPath(c echo.Context) error

func (*EchoAdapter) GetCommentStats added in v1.0.2

func (a *EchoAdapter) GetCommentStats(c echo.Context) error

func (*EchoAdapter) GetCommentTree added in v1.0.2

func (a *EchoAdapter) GetCommentTree(c echo.Context) error

func (*EchoAdapter) GetCommentsByRoot added in v1.0.2

func (a *EchoAdapter) GetCommentsByRoot(c echo.Context) error

func (*EchoAdapter) GetCommentsByUser added in v1.0.2

func (a *EchoAdapter) GetCommentsByUser(c echo.Context) error

func (*EchoAdapter) GetCommentsWithVotes added in v1.0.2

func (a *EchoAdapter) GetCommentsWithVotes(c echo.Context) error

func (*EchoAdapter) GetTopComments added in v1.0.2

func (a *EchoAdapter) GetTopComments(c echo.Context) error

func (*EchoAdapter) GetUserCommentCount added in v1.0.2

func (a *EchoAdapter) GetUserCommentCount(c echo.Context) error

func (*EchoAdapter) HealthCheck added in v1.0.2

func (a *EchoAdapter) HealthCheck(c echo.Context) error

func (*EchoAdapter) RegisterRoutes added in v1.0.2

func (a *EchoAdapter) RegisterRoutes(e *echo.Echo)

RegisterRoutes registers all Commentific routes with an Echo instance

func (*EchoAdapter) RegisterRoutesWithPrefix added in v1.0.2

func (a *EchoAdapter) RegisterRoutesWithPrefix(e *echo.Echo, prefix string)

RegisterRoutesWithPrefix registers routes with a custom prefix

func (*EchoAdapter) RemoveVote added in v1.0.2

func (a *EchoAdapter) RemoveVote(c echo.Context) error

func (*EchoAdapter) SearchComments added in v1.0.2

func (a *EchoAdapter) SearchComments(c echo.Context) error

func (*EchoAdapter) UpdateComment added in v1.0.2

func (a *EchoAdapter) UpdateComment(c echo.Context) error

func (*EchoAdapter) VoteComment added in v1.0.2

func (a *EchoAdapter) VoteComment(c echo.Context) error

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL