api

package
v0.0.0-...-8dc1090 Latest Latest
Warning

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

Go to latest
Published: May 10, 2023 License: MIT Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DB *sql.DB
View Source
var MainRegistry data.SchoolRegistry
View Source
var RedisClient *redis.Client
View Source
var WebAuthnHandler *webauthn.WebAuthn

Functions

func GetAuthToken

func GetAuthToken(r *http.Request) string

func GetSessionInfo

func GetSessionInfo(r *http.Request) auth.SessionInfo

func GetSessionUserID

func GetSessionUserID(r *http.Request) int

func HasAuthToken

func HasAuthToken(r *http.Request) bool

func Init

func Init(router *httprouter.Router)

Init will initialize all available API endpoints

Types

type CalendarEvent

type CalendarEvent struct {
	ID       int    `json:"id"`
	Name     string `json:"name"`
	Start    int    `json:"start"`
	End      int    `json:"end"`
	Location string `json:"location"`
	Desc     string `json:"desc"`
	UserID   int    `json:"userId"`
}

structs for data

type CalendarHWEvent

type CalendarHWEvent struct {
	ID       int           `json:"id"`
	Homework data.Homework `json:"homework"`
	Start    int           `json:"start"`
	End      int           `json:"end"`
	Location string        `json:"location"`
	Desc     string        `json:"desc"`
	UserID   int           `json:"userId"`
}

type CalendarScheduleItem

type CalendarScheduleItem struct {
	ID           int    `json:"id"`
	TermID       int    `json:"termId"`
	ClassID      int    `json:"classId"`
	Name         string `json:"name"`
	OwnerID      int    `json:"ownerId"`
	OwnerName    string `json:"ownerName"`
	DayNumber    int    `json:"dayNumber"`
	Block        string `json:"block"`
	BuildingName string `json:"buildingName"`
	RoomNumber   string `json:"roomNumber"`
	Start        int    `json:"start"`
	End          int    `json:"end"`
	UserID       int    `json:"userId"`
}

type Notification

type Notification struct {
	ID      int    `json:"id"`
	Content string `json:"content"`
	Expiry  string `json:"expiry"`
}

type RouteContext

type RouteContext struct {
	LoggedIn bool
	User     *data.User
}

A RouteContext contains information relevant to the current route

Jump to

Keyboard shortcuts

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