Documentation
¶
Index ¶
- Constants
- type Handler
- func (h *Handler) Create(ctx context.Context, w http.ResponseWriter, r *http.Request) error
- func (h *Handler) Delete(ctx context.Context, w http.ResponseWriter, r *http.Request) error
- func (h *Handler) Get(ctx context.Context, w http.ResponseWriter, r *http.Request) error
- func (h *Handler) GetByUserOrPostID(ctx context.Context, w http.ResponseWriter, r *http.Request) error
- func (h *Handler) Update(ctx context.Context, w http.ResponseWriter, r *http.Request) error
Constants ¶
const DeletePath = v1.Version + basePath + "/" + "{id}"
const GetByUserOrPostIDPath = v1.Version + basePath
const GetPath = v1.Version + basePath + "/" + "{id}"
const PostPath = v1.Version + basePath
const PutPath = v1.Version + basePath
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
Handler manages the set of like endpoints.
func (*Handler) Create ¶
Create handles creating a new like. @Summary Create a like @Description Create a new like @Tags likes @Accept application/json @Produce application/json @Param like body like.Like true "Like object" @Success 201 {object} like.Like @Failure 400 {object} v1.ErrorResponse @Failure 500 {object} v1.ErrorResponse @Router /v1/like [post]
func (*Handler) Delete ¶
Delete handles deleting an existing like by ID. @Summary Delete a like @Description Delete a like by its ID @Tags likes @Produce application/json @Param id path string true "Like ID" @Success 204 "No Content" @Failure 400 {object} v1.ErrorResponse @Failure 404 {object} v1.ErrorResponse @Failure 500 {object} v1.ErrorResponse @Router /v1/like/{id} [delete]
func (*Handler) Get ¶
Get handles the retrieval of a like by its ID. @Summary Get a like @Description Retrieve a like by its ID @Tags likes @Produce application/json @Param id path string true "Like ID" @Success 200 {object} like.Like @Failure 404 {object} v1.ErrorResponse @Failure 500 {object} v1.ErrorResponse @Router /v1/like/{id} [get]
func (*Handler) GetByUserOrPostID ¶
func (h *Handler) GetByUserOrPostID(ctx context.Context, w http.ResponseWriter, r *http.Request) error
GetByUserOrPostID handles the retrieval of likes by user ID or post ID. @Summary Get likes by user ID or post ID @Description Retrieve likes by either user ID or post ID @Tags likes @Produce application/json @Param user_id query string false "User ID" @Param post_id query string false "Post ID" @Success 200 {array} like.Like @Failure 400 {object} v1.ErrorResponse @Failure 500 {object} v1.ErrorResponse @Router /v1/like [get]
func (*Handler) Update ¶
Update handles updating an existing like. @Summary Update a like @Description Update an existing like by its ID @Tags likes @Accept application/json @Produce application/json @Param id path string true "Like ID" @Param like body like.Like true "Updated like object" @Success 200 {object} like.Like @Failure 400 {object} v1.ErrorResponse @Failure 404 {object} v1.ErrorResponse @Failure 500 {object} v1.ErrorResponse @Router /v1/like/{id} [put]