handlers

package
v0.0.0-...-23be098 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SuccessResponse

type SuccessResponse struct {
	Success bool `json:"success"`
}

type TodoHandler

type TodoHandler struct {
	Storage        *storage.TodoStorage
	SessionManager *auth.SessionManager
}

func NewTodoHandler

func NewTodoHandler(storage *storage.TodoStorage, session *auth.SessionManager) *TodoHandler

func (*TodoHandler) CompleteTodo

func (h *TodoHandler) CompleteTodo(c *fiber.Ctx) error

CompleteTodo godoc @Summary Mark a todo as completed @Tags todos @Accept json @Produce json @Param id path int true "Todo ID" @Security ApiKeyAuth @Success 200 {object} basicResponse @Router /todos/:id/complete [put]

func (*TodoHandler) CreateTodo

func (h *TodoHandler) CreateTodo(c *fiber.Ctx) error

CreateTodo godoc @Summary Create a new Todo @Tags todos @Accept json @Produce json @Param todo body createTodoRequest true "The todo's info" @Security ApiKeyAuth @Success 200 {object} createTodoResponse @Router /todos [post]

func (*TodoHandler) DeleteTodo

func (h *TodoHandler) DeleteTodo(c *fiber.Ctx) error

DeleteTodo godoc @Summary Delete a Todo @Tags todos @Accept json @Produce json @Param id path int true "Todo ID" @Security ApiKeyAuth @Success 200 {object} basicResponse @Router /todos/:id [delete]

func (*TodoHandler) FetchTodo

func (h *TodoHandler) FetchTodo(c *fiber.Ctx) error

FetchTodo godoc @Summary Fetch one of a user's todos @Tags todos @Accept json @Produce json @Param id path int true "Todo ID" @Security ApiKeyAuth @Success 200 {object} fetchOneTodoResponse @Router /todos/:id [get]

func (*TodoHandler) FetchTodos

func (h *TodoHandler) FetchTodos(c *fiber.Ctx) error

FetchTodos godoc @Summary Fetch all of a user's todos @Tags todos @Accept json @Produce json @Security ApiKeyAuth @Success 200 {object} fetchTodosResponse @Router /todos [get]

type UserHandler

type UserHandler struct {
	Storage        *storage.UserStorage
	SessionManager *auth.SessionManager
}

func NewUserHandler

func NewUserHandler(storage *storage.UserStorage, sessionManager *auth.SessionManager) *UserHandler

func (*UserHandler) GetUserInfo

func (u *UserHandler) GetUserInfo(c *fiber.Ctx) error

GetUserInfo godoc @Summary Get the user's info @Tags users @Accept json @Produce json @Security ApiKeyAuth @Success 200 {object} auth.UserSession @Router /users/me [get]

func (*UserHandler) SignInUser

func (u *UserHandler) SignInUser(c *fiber.Ctx) error

SignInUser godoc @Summary Sign in a user @Tags users @Accept json @Produce json @Param user body signInRequestBody true "The user's email and password" @Success 200 {object} SuccessResponse @Header 200 {string} Authorization "contains the session id in bearer format" @Router /users/sign-in [post]

func (*UserHandler) SignOutUser

func (u *UserHandler) SignOutUser(c *fiber.Ctx) error

SignOutUser godoc

@Summary	Sign out a user
@Tags		users
@Accept		json
@Produce	json
@Success	200	{object}	SuccessResponse
@Router		/users/sign-out [post]

func (*UserHandler) SignUpUser

func (u *UserHandler) SignUpUser(c *fiber.Ctx) error

SignUpUser godoc @Summary Sign up a user @Tags users @Accept json @Produce json @Param user body userRequestBody true "The user's first name, last name, email, and password" @Success 200 {object} signUpSuccessResponse @Header 200 {string} Authorization "contains the session id in bearer format" @Router /users/sign-up [post]

Jump to

Keyboard shortcuts

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