handlers

package
v0.0.0-...-74ede58 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Validate *validator.Validate = validator.New(validator.WithRequiredStructEnabled())

Validate is a singleton that provides validation services for in handlers.

Functions

This section is empty.

Types

type Handlers

type Handlers struct {
	Sender  *httputils.Sender
	Storage storage.StorageInterface
}

Handlers implements all the handler functions and has the dependencies that they use (Sender, Storage).

func (*Handlers) AddBookHandler

func (h *Handlers) AddBookHandler(w http.ResponseWriter, r *http.Request)

AddBook godoc

	@Summary		Add a specific book
	@Tags			Books
	@Produce		json
 	@Accept			json
	@Param			title body string true "Book title"
	@Param			author body string true "Book author"
	@Param			coverUrl body string true "Book coverUrl"
	@Param			postUrl body string true "Book post url"
	@Success		200	{object} model.IDResponse

@Router /api/book/add [post]

func (*Handlers) DeleteBookHandler

func (h *Handlers) DeleteBookHandler(w http.ResponseWriter, r *http.Request)

DeleteBook godoc

@Summary		Delete a specific book
@Tags			Books
@Produce		json
@Param			id path int	true "Book ID"
@Success		200	{object} model.GetBookResponse

@Router /api/book/delete/{id} [delete]

func (*Handlers) GetBookHandler

func (h *Handlers) GetBookHandler(w http.ResponseWriter, r *http.Request)

GetBook godoc

@Summary		Get a specific book
@Tags			Books
@Produce		json
@Param			id path int	true "Book ID"
@Success		200	{object} model.GetBookResponse

@Router /api/book/{id} [get]

func (*Handlers) GetBooksHandler

func (h *Handlers) GetBooksHandler(w http.ResponseWriter, r *http.Request)

GetBooks godoc

@Summary		Get all books
@Tags			Books
@Produce		json
@Success		200	{object} []model.GetBookResponse

@Router /api/books [get]

func (*Handlers) UpdateBookHandler

func (h *Handlers) UpdateBookHandler(w http.ResponseWriter, r *http.Request)

UpdateBook godoc

	@Summary		Update a specific book
	@Tags			Books
	@Produce		json
 	@Accept			json
	@Param			title body string false "Book title"
	@Param			author body string false "Book author"
	@Param			coverUrl body string false "Book coverUrl"
	@Param			postUrl body string false "Book post url"
	@Success		200	{object} model.IDResponse

@Router /api/book/update [patch]

Jump to

Keyboard shortcuts

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