routes

package
v0.0.0-...-a16d91a Latest Latest
Warning

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

Go to latest
Published: May 21, 2018 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SystemInfo

func SystemInfo(runtime *net.RequestRuntime) net.HandlerResult

SystemInfo is a simple route that prints out a success result (no errors) w/ the current time in the metadata

Types

type DeviceMessages

type DeviceMessages struct {
	logging.LeveledLogger
	device.TokenStore
	device.Index
}

DeviceMessages is the route group that handles creating device messages

func NewDeviceMessagesAPI

func NewDeviceMessagesAPI(index device.Index, auth device.TokenStore) *DeviceMessages

NewDeviceMessagesAPI returns a new api for creating device messages.

func (*DeviceMessages) CreateMessage

func (messages *DeviceMessages) CreateMessage(runtime *net.RequestRuntime) net.HandlerResult

CreateMessage publishes a new DeviceMessage to the control stream

type Devices

Devices route engine is responsible for CRUD operations on the device objects themselves.

func NewDevicesAPI

func NewDevicesAPI(registry device.Registry, auth device.TokenStore) *Devices

NewDevicesAPI constructs the devices api

func (*Devices) ListDevices

func (devices *Devices) ListDevices(runtime *net.RequestRuntime) net.HandlerResult

ListDevices will return a list of the UUIDs registered in the registry

func (*Devices) UpdateShorthand

func (devices *Devices) UpdateShorthand(runtime *net.RequestRuntime) net.HandlerResult

UpdateShorthand accepts a device id and a color (via url params from the req) and updates the device to that color.

type Feedback

Feedback is the route group that handles creating device feedback entries.

func NewFeedbackAPI

func NewFeedbackAPI(store device.FeedbackStore, index device.Index) *Feedback

NewFeedbackAPI returns a new initialized feed back api

func (*Feedback) CreateFeedback

func (feedback *Feedback) CreateFeedback(runtime *net.RequestRuntime) net.HandlerResult

CreateFeedback validates a payload from the client and adds an entry to the device feedback log.

func (*Feedback) ListFeedback

func (feedback *Feedback) ListFeedback(runtime *net.RequestRuntime) net.HandlerResult

ListFeedback validates a payload from the client and adds an entry to the device feedback log.

type RegistrationAPI

type RegistrationAPI struct {
	logging.LeveledLogger
	device.Registry
	// contains filtered or unexported fields
}

RegistrationAPI route engine handles receiving http reqests, upgrading and sending along to the registation stream

func NewRegistrationAPI

func NewRegistrationAPI(stream device.RegistrationStream, registry device.Registry) *RegistrationAPI

NewRegistrationAPI returns a constructed registration api

func (*RegistrationAPI) Preregister

func (registrations *RegistrationAPI) Preregister(runtime *net.RequestRuntime) net.HandlerResult

Preregister is used to submit a new registation request for a device

func (*RegistrationAPI) Register

func (registrations *RegistrationAPI) Register(runtime *net.RequestRuntime) net.HandlerResult

Register is the route handler responsible for upgrating + registering connections

type TokensAPI

type TokensAPI struct {
	logging.LeveledLogger
	device.TokenStore
	device.Index
}

TokensAPI defines the api for creating/deleting device auth tokens.

func NewTokensAPI

func NewTokensAPI(store device.TokenStore, index device.Index) *TokensAPI

NewTokensAPI inititalizes a new token api.

func (*TokensAPI) CreateToken

func (tokens *TokensAPI) CreateToken(requestRuntime *net.RequestRuntime) net.HandlerResult

CreateToken authenticates the incoming request and attempts to allocate a new auth token.

func (*TokensAPI) ListTokens

func (tokens *TokensAPI) ListTokens(requestRuntime *net.RequestRuntime) net.HandlerResult

ListTokens returns a set tokens based on the device id provided.

Jump to

Keyboard shortcuts

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