user

package
v0.0.0-...-48f5382 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2024 License: Apache-2.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Ctx

func Ctx(next http.Handler) http.Handler

func GetDiscordCallback

func GetDiscordCallback(w http.ResponseWriter, r *http.Request)
func GetDiscordLink(w http.ResponseWriter, r *http.Request)

func GetLogin

func GetLogin(w http.ResponseWriter, r *http.Request)

func GetLoginCallback

func GetLoginCallback(w http.ResponseWriter, r *http.Request)

func GetLogout

func GetLogout(w http.ResponseWriter, r *http.Request)

func GetSelf

func GetSelf(w http.ResponseWriter, r *http.Request)

GetSelf godoc @Summary Get your user @Description Get information for the user logged in @Tags user @Accept json @Produce json @Success 200 {object} Response @Failure 400 {object} utils.ErrResponse @Failure 500 {object} utils.ErrResponse @Router /user/ [get]

func GetUser

func GetUser(w http.ResponseWriter, r *http.Request)

GetUser godoc @Summary Get a specific user @Description Get information for the user @Tags user @Accept json @Produce json @Param CID path int true "CID" @Success 200 {object} Response @Failure 400 {object} utils.ErrResponse @Failure 404 {object} utils.ErrResponse @Failure 404 {object} utils.ErrResponse @Failure 500 {object} utils.ErrResponse @Router /user/{cid} [get]

func NewUserListResponse

func NewUserListResponse(users []models.User) []render.Renderer

func PatchUser

func PatchUser(w http.ResponseWriter, r *http.Request)

PatchUser godoc @Summary Patch a user @Description Patch information for the user @Tags user @Accept json @Produce json @Param CID path int true "CID" @Param user body Request true "User" @Success 200 {object} Response @Failure 400 {object} utils.ErrResponse @Failure 404 {object} utils.ErrResponse @Failure 500 {object} utils.ErrResponse @Router /user/{cid} [patch]

func Router

func Router(r chi.Router)

func UnlinkDiscord

func UnlinkDiscord(w http.ResponseWriter, r *http.Request)

UnlinkDiscord godoc @Summary Unlink your Discord account @Description Unlink your Discord account from your VATUSA account @Tags discord @Accept json @Produce json @Success 200 {object} Response @Failure 400 {object} utils.ErrResponse @Failure 404 {object} utils.ErrResponse @Failure 404 {object} utils.ErrResponse @Failure 500 {object} utils.ErrResponse @Router /user/discord/unlink [get]

func UpdateUser

func UpdateUser(w http.ResponseWriter, r *http.Request)

UpdateUser godoc @Summary Update a user @Description Update information for the user @Tags user @Accept json @Produce json @Param CID path int true "CID" @Param user body Request true "User" @Success 200 {object} Response @Failure 400 {object} utils.ErrResponse @Failure 404 {object} utils.ErrResponse @Failure 500 {object} utils.ErrResponse @Router /user/{cid} [put]

Types

type DiscordResp

type DiscordResp struct {
	ID       string `json:"id"`
	Username string `json:"username"`
	Avatar   string `json:"avatar"`
}

type Request

type Request struct {
	PreferredName string `json:"preferred_name" example:"Raaj" validate:"required"`
	PreferredOIs  string `json:"preferred_ois" example:"RP" validate:"required"`
	DiscordID     string `json:"discord_id" example:"1234567890" validate:"required"`
}

func (*Request) Bind

func (req *Request) Bind(r *http.Request) error

func (*Request) Validate

func (req *Request) Validate() error

type Response

type Response struct {
	*models.User
}

TODO - Dont send back entire struct

func NewUserResponse

func NewUserResponse(user *models.User) *Response

func (*Response) Render

func (res *Response) Render(w http.ResponseWriter, r *http.Request) error

Jump to

Keyboard shortcuts

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