api

package
v0.0.0-...-c4e1ff2 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2022 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

Functions

func Abort

func Abort(c *gin.Context, err error, status int, message string)

func AddGroupToUserHandler

func AddGroupToUserHandler(c *gin.Context)

@Summary Add Group to user @Tags users @Produce json @Success 200 "OK" @Failure 404 "User of group not found" @Failure 500 "Couldn't add group" @Router /users/{email}/{GroupName} [POST] @Param email path string true "User mail" @Param groupName path string true "GroupName"

func CreateEventHandler

func CreateEventHandler(c *gin.Context)

@Summary Create event @Tags events @Accept json @Param request body EventRequest true "EventRequest" @Success 200 "OK" @Failure 400 "Bad request" @Failure 404 "User not found" @Failure 500 "Couldn't create event" @Router /events/{email} [POST] @Param email path string true "email"

func CreateFileHandler

func CreateFileHandler(c *gin.Context)

@Summary Create file @Tags files @Produce json @Success 200 "OK with hash of file" @Failure 400 "Invalid filename or couldn't read file request" @Failure 404 "User not found" @Failure 500 "Couldn't create file" @Router /files/{email}/{filename} [POST] @Param email path string true "Email" @Param filename path string true "Filename" @Param "File Request"

func CreateGroupHandler

func CreateGroupHandler(c *gin.Context)

@Summary Create group @Tags groups @Success 200 "OK" @Failure 500 "Couldn't create group" @Router /groups/{GroupName} [POST] @Param GroupName path string true "GroupName"

func CreateRouter

func CreateRouter() *gin.Engine

func CreateUserHandler

func CreateUserHandler(c *gin.Context)

@Summary Create user @Tags users @Accept json @Param request body UserRequest true "UserRequest" @Success 200 "OK" @Failure 400 "Bad request" @Failure 500 "Couldn't create user" @Router /users [POST]

func GenerateCookie

func GenerateCookie(id string) string

func GetCurrentEventsHandler

func GetCurrentEventsHandler(c *gin.Context)

@Summary Get current events @Tags events @Produce json @Success 200 {array} models.Event @Failure 500 "Couldn't get current events" @Router /events/current [GET]

func GetEventsHandler

func GetEventsHandler(c *gin.Context)

@Summary Get all events @Tags events @Produce json @Success 200 {array} models.Event @Failure 500 "Couldn't get events" @Router /events [GET]

func GetFileByIdHandler

func GetFileByIdHandler(c *gin.Context)

@Summary Get file @Tags files @Produce json @Success 200 {object} models.File @Failure 400 "File id invalid" @Failure 500 "Couldn't get file" @Router /files/{id} [GET] @Param id path string true "File id"

func GetGroupByNameHandler

func GetGroupByNameHandler(c *gin.Context)

@Summary Get group by name @Tags groups @Success 200 {object} models.Group @Failure 404 "Group not found" @Router /groups/{GroupName} [GET] @Param GroupName path string true "GroupName"

func GetGroupsHandler

func GetGroupsHandler(c *gin.Context)

@Summary Get all groups @Tags groups @Success 200 {array} models.Group @Failure 500 "Couldn't get groups" @Router /groups [GET]

func GetPastEventsHandler

func GetPastEventsHandler(c *gin.Context)

@Summary Get past events @Tags events @Produce json @Success 200 {array} models.Event @Failure 500 "Couldn't get past events" @Router /events/past [GET]

func GetUpcomingEventsHandler

func GetUpcomingEventsHandler(c *gin.Context)

@Summary Get upcoming events @Tags events @Produce json @Success 200 {array} models.Event @Failure 500 "Couldn't get upcoming events" @Router /events/upcoming [GET]

func GetUserByEmailHandler

func GetUserByEmailHandler(c *gin.Context)

@Summary Get user by mail @Tags users @Produce json @Success 200 {object} models.User @Failure 404 "Not found" @Router /users/{email} [GET] @Param email path string true "email"

func GetUserByNameHandler

func GetUserByNameHandler(c *gin.Context)

Unused

func GetUserGroupsHandler

func GetUserGroupsHandler(c *gin.Context)

@Summary Get user groups by user email @Tags users @Produce json @Success 200 {array} models.Group @Failure 404 "User Not found" @Failure 500 "Couldn't get groups" @Router /users/{email}/groups [GET] @Param email path string true "email"

func GetUsersHandler

func GetUsersHandler(c *gin.Context)

@Summary Get users @Tags users @Produce json @Success 200 {array} models.User @Failure 500 "Couldn't get users" @Router /users [GET]

func SessionMiddleware

func SessionMiddleware() gin.HandlerFunc

SessionMiddleware handles cookie

Types

type EventRequest

type EventRequest struct {
	Title       string    `json:"title" binding:"required"`
	Description string    `json:"description" binding:"required"`
	Start_date  time.Time `json:"startDate" binding:"required"`
	End_date    time.Time `json:"endDate" binding:"required"`
	ImageID     uint64    `json:"imageID" binding:"required"`
}

type UserRequest

type UserRequest struct {
	Email     string `json:"email" binding:"required"`
	FirstName string `json:"firstname" binding:"required"`
	LastName  string `json:"lastname" binding:"required"`
}

Jump to

Keyboard shortcuts

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