likegrp

package
v0.4.1 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const DeletePath = v1.Version + basePath + "/" + "{id}"
View Source
const GetByUserOrPostIDPath = v1.Version + basePath
View Source
const GetPath = v1.Version + basePath + "/" + "{id}"
View Source
const PostPath = v1.Version + basePath
View Source
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 New

func New(likeCore *like.Core) *Handler

New creates a handler for like-related requests.

func (*Handler) Create

func (h *Handler) Create(ctx context.Context, w http.ResponseWriter, r *http.Request) error

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

func (h *Handler) Delete(ctx context.Context, w http.ResponseWriter, r *http.Request) error

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

func (h *Handler) Update(ctx context.Context, w http.ResponseWriter, r *http.Request) error

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]

Jump to

Keyboard shortcuts

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