Documentation ¶
Index ¶
- func GetHealth(w http.ResponseWriter, r *http.Request)
- func RespondWithError(w http.ResponseWriter, code int, msg interface{})
- func RespondWithJSON(w http.ResponseWriter, code int, payload interface{})
- type NoteHandler
- func (p *NoteHandler) CreateNote(w http.ResponseWriter, r *http.Request)
- func (p *NoteHandler) DeleteNote(w http.ResponseWriter, r *http.Request)
- func (p *NoteHandler) GetNote(w http.ResponseWriter, r *http.Request)
- func (p *NoteHandler) NoteList(w http.ResponseWriter, r *http.Request)
- func (p *NoteHandler) UpdateNote(w http.ResponseWriter, r *http.Request)
- type UserHandler
- func (p *UserHandler) Reset(w http.ResponseWriter, r *http.Request)
- func (p *UserHandler) Signin(w http.ResponseWriter, r *http.Request)
- func (p *UserHandler) Signup(w http.ResponseWriter, r *http.Request)
- func (p *UserHandler) UpdateUser(w http.ResponseWriter, r *http.Request)
- func (p *UserHandler) Verification(w http.ResponseWriter, r *http.Request)
- func (p *UserHandler) Welcome(w http.ResponseWriter, r *http.Request)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetHealth ¶
func GetHealth(w http.ResponseWriter, r *http.Request)
GetHealth godoc @Summary Returns health of the service @Router /healthz [get]
func RespondWithError ¶
func RespondWithError(w http.ResponseWriter, code int, msg interface{})
RespondWithError return error message
func RespondWithJSON ¶
func RespondWithJSON(w http.ResponseWriter, code int, payload interface{})
RespondWithJSON write json response format
Types ¶
type NoteHandler ¶
type NoteHandler struct {
// contains filtered or unexported fields
}
func NewNoteHandler ¶
func NewNoteHandler(repo note.NoteRepo, auth auth.Auth) *NoteHandler
func (*NoteHandler) CreateNote ¶
func (p *NoteHandler) CreateNote(w http.ResponseWriter, r *http.Request)
CreateNote @Summary Create a new note @Tags Note @Accept json @Produce json @Param id path string true "ID" @Param data body models.Note true "data" @Success 200 {string} string "successfully note created" @Failure 400 {string} string @Failure 500 {string} string @Router /note/{id} [post]
func (*NoteHandler) DeleteNote ¶
func (p *NoteHandler) DeleteNote(w http.ResponseWriter, r *http.Request)
DeleteNote @Summary Delete note @Tags Note @Accept json @Produce json @Param id path string true "ID" @Param id path string true "ID" @Success 200 {nil} nil @Failure 404 {string} string @Router /note/{id}/{id} [delete]
func (*NoteHandler) GetNote ¶
func (p *NoteHandler) GetNote(w http.ResponseWriter, r *http.Request)
GetNote @Summary Get note @Tags Note @Accept json @Produce json @Param id path string true "ID" @Param id path string true "ID" @Success 200 {object} models.Note @Failure 404 {string} string @Router /note/{id}/{id} [get]
func (*NoteHandler) NoteList ¶
func (p *NoteHandler) NoteList(w http.ResponseWriter, r *http.Request)
NoteList @Summary Get note list @Tags Note @Accept json @Produce json @Param id path string true "ID" @Success 200 {object} []models.Note @Failure 404 {string} string @Router /note/{id} [get]
func (*NoteHandler) UpdateNote ¶
func (p *NoteHandler) UpdateNote(w http.ResponseWriter, r *http.Request)
UpdateNote @Summary Update note @Tags Note @Description Update note @Accept json @Produce json @Param id path string true "ID" @Param id path string true "ID" @Success 200 {string} string "successfully updated" @Failure 400 {string} string @Failure 404 {string} string @Router /note/{id}/{id} [put]
type UserHandler ¶
type UserHandler struct {
// contains filtered or unexported fields
}
func NewUserHandler ¶
func (*UserHandler) Reset ¶
func (p *UserHandler) Reset(w http.ResponseWriter, r *http.Request)
Reset @Summary Re-set the user password @Tags User @Accept json @Produce json @Param userEmail path string true "email" @Success 200 {string} string @Failure 404 {string} string @Router /user/reset/{userEmail} [get]
func (*UserHandler) Signin ¶
func (p *UserHandler) Signin(w http.ResponseWriter, r *http.Request)
Signin @Summary Sign in user @Tags User @Accept json @Produce json @Param data body models.User true "data" @Success 200 {string} string "successfully note created" @Failure 400 {string} string @Failure 500 {string} string @Router /user/signin [post]
func (*UserHandler) Signup ¶
func (p *UserHandler) Signup(w http.ResponseWriter, r *http.Request)
Signup @Summary Create a new user @Tags User @Accept json @Produce json @Param data body models.User true "data" @Success 200 {string} string "successfully note created" @Failure 400 {string} string @Failure 500 {string} string @Router /user/signup [post]
func (*UserHandler) UpdateUser ¶
func (p *UserHandler) UpdateUser(w http.ResponseWriter, r *http.Request)
UpdateUser @Summary Update the user @Tags User @Accept json @Produce json @Param id path string true "ID" @Param data body models.User true "data" @Success 200 {string} string "successfully note created" @Failure 400 {string} string @Failure 500 {string} string @Router /user/{id} [put]
func (*UserHandler) Verification ¶
func (p *UserHandler) Verification(w http.ResponseWriter, r *http.Request)
Verification @Summary verify the user email @Tags User @Accept json @Produce json @Param userEmail path string true "email" @Success 200 {string} string @Failure 404 {string} string @Router /user/verification/{userEmail} [get]
func (*UserHandler) Welcome ¶
func (p *UserHandler) Welcome(w http.ResponseWriter, r *http.Request)
Welcome @Summary Check the token @Tags User @Accept json @Produce json @Success 200 {string} string @Failure 404 {string} string @Router /user/welcome [get]