api

package
v0.0.0-...-cb43c44 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2022 License: AGPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WriteJSON

func WriteJSON(w http.ResponseWriter, data interface{}) error

WriteJSON writes the data as JSON.

Types

type API

type API struct {
	// contains filtered or unexported fields
}

API is responsible for configuring handlers for HTTP endpoints.

func New

New initializes the application given a config and connects to backends. It also seeds any needed information to the database.

func (*API) AdminHandler

func (api *API) AdminHandler(w http.ResponseWriter, r *http.Request)

AdminHandler serves the admin page.

func (*API) AdminMessageHandler

func (api *API) AdminMessageHandler(w http.ResponseWriter, r *http.Request)

AdminMessageHandler handles the retrieval of the current administrator message

func (*API) DataFeedHandler

func (api *API) DataFeedHandler(w http.ResponseWriter, r *http.Request)

DataFeedHandler returns the latest successful response that the Updater received from the iTRAK data feed.

func (*API) ETAHandler

func (api *API) ETAHandler(w http.ResponseWriter, r *http.Request)

func (*API) FeedbackAdminHandler

func (api *API) FeedbackAdminHandler(w http.ResponseWriter, r *http.Request)

FeedbackAdminHandler gets the feedback message with admin=true

func (*API) FeedbackCreateHandler

func (api *API) FeedbackCreateHandler(w http.ResponseWriter, r *http.Request)

FeedbackCreateHandler adds a new form to the database

func (*API) FeedbackDeleteHandler

func (api *API) FeedbackDeleteHandler(w http.ResponseWriter, r *http.Request)

FeedbackDeleteHandler deletes a form from database

func (*API) FeedbackHandler

func (api *API) FeedbackHandler(w http.ResponseWriter, r *http.Request)

FeedbackHandler finds all forms in the database

func (*API) HistoryHandler

func (api *API) HistoryHandler(w http.ResponseWriter, r *http.Request)

HistoryHandler returns the last 30 days worth of updates for all enabled vehicles

func (*API) IndexHandler

func (api *API) IndexHandler(w http.ResponseWriter, r *http.Request)

IndexHandler serves the index page.

func (*API) KeyHandler

func (api *API) KeyHandler(w http.ResponseWriter, r *http.Request)

KeyHandler sends Mapbox api key to authenticated user

func (*API) RoutesCreateHandler

func (api *API) RoutesCreateHandler(w http.ResponseWriter, r *http.Request)

RoutesCreateHandler adds a new route to the database

func (*API) RoutesDeleteHandler

func (api *API) RoutesDeleteHandler(w http.ResponseWriter, r *http.Request)

RoutesDeleteHandler deletes a route from database

func (*API) RoutesEditHandler

func (api *API) RoutesEditHandler(w http.ResponseWriter, r *http.Request)

RoutesEditHandler Only handles editing enabled flag for now

func (*API) RoutesHandler

func (api *API) RoutesHandler(w http.ResponseWriter, r *http.Request)

RoutesHandler finds all of the routes in the database

func (*API) Run

func (api *API) Run()

func (*API) SetAdminMessage

func (api *API) SetAdminMessage(w http.ResponseWriter, r *http.Request)

SetAdminMessage allows the user to set an alert message that will display to all users who visit the page

func (*API) StopsCreateHandler

func (api *API) StopsCreateHandler(w http.ResponseWriter, r *http.Request)

StopsCreateHandler adds a new route stop to the database

func (*API) StopsDeleteHandler

func (api *API) StopsDeleteHandler(w http.ResponseWriter, r *http.Request)

func (*API) StopsHandler

func (api *API) StopsHandler(w http.ResponseWriter, r *http.Request)

StopsHandler finds all of the route stops in the database

func (*API) UpdatesHandler

func (api *API) UpdatesHandler(w http.ResponseWriter, r *http.Request)

UpdatesHandler gets the most recent update for each enabled vehicle.

func (*API) VehiclesCreateHandler

func (api *API) VehiclesCreateHandler(w http.ResponseWriter, r *http.Request)

VehiclesCreateHandler adds a new vehicle.

func (*API) VehiclesDeleteHandler

func (api *API) VehiclesDeleteHandler(w http.ResponseWriter, r *http.Request)

func (*API) VehiclesEditHandler

func (api *API) VehiclesEditHandler(w http.ResponseWriter, r *http.Request)

func (*API) VehiclesHandler

func (api *API) VehiclesHandler(w http.ResponseWriter, r *http.Request)

VehiclesHandler returns all the vehicles.

type CASClient

type CASClient struct {
	// contains filtered or unexported fields
}

CASClient stores the local cas client and an instance of the database

func CreateCASClient

func CreateCASClient(url *url.URL, us shuttletracker.UserService, authenticate bool) *CASClient

CreateCASClient creates an authentication service CASClient using a cas url and database

func InjectMocks

InjectMocks allows mock interfaces to be used

type Config

type Config struct {
	GoogleMapAPIKey      string
	GoogleMapMinDistance int
	CasURL               string
	Authenticate         bool
	ListenURL            string
	MapboxAPIKey         string
}

Config holds API settings.

func NewConfig

func NewConfig(v *viper.Viper) *Config

Jump to

Keyboard shortcuts

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