Documentation ¶
Index ¶
- Constants
- Variables
- func AuthRequired() gin.HandlerFunc
- func AuthorizationRequired() gin.HandlerFunc
- func CORSMiddleware() gin.HandlerFunc
- func FlagMessageById(c *gin.Context)
- func FollowGetController(c *gin.Context)
- func FollowPostController(c *gin.Context)
- func GetAllMessages(c *gin.Context)
- func GetAuthState(c *gin.Context) (string, error)
- func GetFeedMessages(c *gin.Context)
- func GetMessages(c *gin.Context)
- func GetUserMessages(c *gin.Context)
- func GetUserOrAdmin(c *gin.Context, userRepository database.IUserRepository) (*models.User, error)
- func LatestController(c *gin.Context)
- func LoggingMiddleware() gin.HandlerFunc
- func LoginGet(c *gin.Context)
- func PostUserMessage(c *gin.Context)
- func RegisterController(c *gin.Context)
- func SetupRouter(openDatabase database.OpenDatabaseFunc) *gin.Engine
- func UpdateLatestMiddleware(c *gin.Context)
- type FollowRequestBody
- type PostUserMessageRequestBody
- type RegisterRequestBody
Constants ¶
View Source
const ( UserKey = "user" IsAdminKey = "isAdmin" UserRepositoryKey = "userRepository" MessageRepositoryKey = "messageRepository" LatestRepositoryKey = "latestRepository" )
Variables ¶
View Source
var ( ErrInvalidMessageId = internal.NewBadRequestError("invalid message id") ErrMissingAuthorization = internal.NewHttpError(403, "Forbidden not authorized") )
View Source
var ( ErrInvalidUsername = internal.NewHttpError(http.StatusNotFound, "invalid username") ErrIncorrectPassword = internal.NewHttpError(http.StatusUnauthorized, "incorrect password") ErrMissingCredentials = internal.NewHttpError(http.StatusUnauthorized, "missing authentication credentials") )
View Source
var (
ErrInvalidEmail = internal.NewHttpError(http.StatusUnprocessableEntity, "email address is not valid")
)
Functions ¶
func AuthRequired ¶
func AuthRequired() gin.HandlerFunc
func AuthorizationRequired ¶
func AuthorizationRequired() gin.HandlerFunc
func CORSMiddleware ¶
func CORSMiddleware() gin.HandlerFunc
func FlagMessageById ¶
func FollowGetController ¶
func FollowPostController ¶
Adds the current user as follower of the given user.
func GetAllMessages ¶
func GetFeedMessages ¶
func GetMessages ¶
GetMessages returns the latest messages, limited by the number of messages per page.
func GetUserMessages ¶
GetUserMessages returns the latest messages by the user, limited by the number of messages per page.
func GetUserOrAdmin ¶
func LatestController ¶
func LoggingMiddleware ¶
func LoggingMiddleware() gin.HandlerFunc
func PostUserMessage ¶
PostUserMessage posts a non-empty message, with the current UTC time.
func RegisterController ¶
func SetupRouter ¶
func SetupRouter(openDatabase database.OpenDatabaseFunc) *gin.Engine
func UpdateLatestMiddleware ¶
Types ¶
type FollowRequestBody ¶
type PostUserMessageRequestBody ¶
type PostUserMessageRequestBody struct {
Content string `form:"content" json:"content" binding:"required"`
}
type RegisterRequestBody ¶
Click to show internal directories.
Click to hide internal directories.