v1

package
v0.0.0-...-1bdb0da Latest Latest
Warning

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

Go to latest
Published: Dec 26, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArticleHandler

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

func NewArticleHandler

func NewArticleHandler(svc ArticleService) *ArticleHandler

func (*ArticleHandler) HandleCreateArticle

func (h *ArticleHandler) HandleCreateArticle(w http.ResponseWriter, r *http.Request)

HandleCreateArticle godoc @Summary Create an article @Tags articles @Produce json @Param request body request.CreateArticleRequest true "request body" @Success 200 {object} domain.Article @Failure 400 {object} response.ErrResponse @Failure 500 {object} response.ErrResponse @Router /articles [post]

func (*ArticleHandler) HandleGetArticle

func (h *ArticleHandler) HandleGetArticle(w http.ResponseWriter, r *http.Request)

HandleGetArticle godoc @Summary Get an article @Tags articles @Produce json @Param articleID path int true "article ID" @Success 200 {object} domain.Article @Failure 400 {object} response.ErrResponse @Failure 404 {object} response.ErrResponse @Failure 500 {object} response.ErrResponse @Router /articles/{articleID} [get]

func (*ArticleHandler) HandleListArticles

func (h *ArticleHandler) HandleListArticles(w http.ResponseWriter, r *http.Request)

HandleListArticles godoc @Summary List all articles @Tags articles @Produce json @Success 200 {object} []domain.Article @Failure 500 {object} response.ErrResponse @Router /articles [get]

type ArticleService

type ArticleService interface {
	CreateArticle(ctx context.Context, article *domain.Article) (*domain.Article, error)
	GetArticle(ctx context.Context, id uint) (*domain.Article, error)
	ListArticles(ctx context.Context) ([]domain.Article, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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