handlers

package
v0.0.0-...-1422b68 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2024 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Handlers

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

func NewHandlers

func NewHandlers(
	db *sqlx.DB,
	cfg *config.EnvParams,
) *Handlers

func (*Handlers) BuildRouter

func (h *Handlers) BuildRouter() (http.Handler, error)

@title HTTP JWT CRUD @version 1.0 @description Demonstrate HTTP with Middleware, JWT, SQLX and slog package @description Response Code Format : HTTP Status - Service Code - Response Code @contact.name Yohanes Catur @contact.url www.linkedin.com/in/yohanescatur @contact.email yohanescatur@gmail.com @Basepath /

func (*Handlers) GetAccessToken

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

GetAccessToken godoc @Summary Get Access Token @Tags Token @Accept json @Produce json @Param Content-Type header string true "application/json" @Param X-Client-Key header string true "Client key provided by server" @Param X-Timestamp header string true "format: 2006-01-02T15:04:05+07:00" @Param X-Signature header string true "Generated Signature" @Success 200 {object} auth.TokenResponse @Failure 400 {object} response.Message @Failure 401 {object} response.Message @Router /v1.0/access-token [POST]

func (*Handlers) GetTodoList

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

GetTodoList godoc @Summary Todo List @Description Get list of todo @Tags Todo @Accept json @Produce json @Param Content-Type header string true "application/json" @Param Authorization header string true "Bearer token" @Param X-Client-Key header string true "Client Key provided by server" @Param X-Timestamp header string true "format: 2006-01-02T15:04:05+07:00" @Param X-Signature header string true "123425234" @Param ID path string false "ID of todo" @Success 200 {object} []database.TableTodos @Failure 404 {object} response.Message @Router /v1.0/todo [GET]

func (*Handlers) InitSwagger

func (h *Handlers) InitSwagger()

func (*Handlers) NewTodo

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

NewTodo godoc @Summary Add Todo item @Description.markdown todo_add @Tags Todo @Accept json @Produce json @Param Content-Type header string true "application/json" @Param Authorization header string true "Bearer token" @Param X-Client-Key header string true "Client Key provided by server" @Param X-Timestamp header string true "format: 2006-01-02T15:04:05+07:00" @Param X-Signature header string true "123425234" @Param request body todo.AddTodosRequest true "request" @Success 200 {object} database.TableTodos @Failure 400 {object} response.Message @Router /v1.0/todo [POST]

Jump to

Keyboard shortcuts

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