Documentation ¶
Index ¶
- Constants
- func Logger(start time.Time, r *http.Request)
- func Middleware(inner http.Handler) http.Handler
- type ActionsResponse
- type DeviceResponse
- type DevicesResponse
- type GroupResponse
- type GroupsResponse
- type Service
- func (wb Service) ActionList(w http.ResponseWriter, r *http.Request)
- func (wb Service) DeviceGet(w http.ResponseWriter, r *http.Request)
- func (wb Service) DeviceList(w http.ResponseWriter, r *http.Request)
- func (wb Service) GroupCreate(w http.ResponseWriter, r *http.Request)
- func (wb Service) GroupGet(w http.ResponseWriter, r *http.Request)
- func (wb Service) GroupGetDevices(w http.ResponseWriter, r *http.Request)
- func (wb Service) GroupGetExcludedDevices(w http.ResponseWriter, r *http.Request)
- func (wb Service) GroupLinkDevice(w http.ResponseWriter, r *http.Request)
- func (wb Service) GroupList(w http.ResponseWriter, r *http.Request)
- func (wb Service) GroupUnlinkDevice(w http.ResponseWriter, r *http.Request)
- func (wb Service) Router() *mux.Router
- func (wb Service) Run() error
- func (wb Service) SnapInstall(w http.ResponseWriter, r *http.Request)
- func (wb Service) SnapList(w http.ResponseWriter, r *http.Request)
- func (wb Service) SnapListPublish(w http.ResponseWriter, r *http.Request)
- func (wb Service) SnapRemove(w http.ResponseWriter, r *http.Request)
- func (wb Service) SnapUpdateAction(w http.ResponseWriter, r *http.Request)
- func (wb Service) SnapUpdateConf(w http.ResponseWriter, r *http.Request)
- type SnapsResponse
- type StandardResponse
Constants ¶
const JSONHeader = "application/json; charset=UTF-8"
JSONHeader is the header for JSON responses
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ActionsResponse ¶
type ActionsResponse struct { StandardResponse Actions []domain.Action `json:"actions"` }
ActionsResponse is the JSON response to list actions for a device
type DeviceResponse ¶
type DeviceResponse struct { StandardResponse Device domain.Device `json:"device"` }
DeviceResponse is the JSON response to get a device
type DevicesResponse ¶
type DevicesResponse struct { StandardResponse Devices []domain.Device `json:"devices"` }
DevicesResponse is the JSON response to list devices
type GroupResponse ¶
type GroupResponse struct { StandardResponse Group domain.Group `json:"group"` }
GroupResponse is the JSON response to list groups
type GroupsResponse ¶
type GroupsResponse struct { StandardResponse Groups []domain.Group `json:"groups"` }
GroupsResponse is the JSON response to list groups
type Service ¶
type Service struct { Settings *config.Settings Controller controller.Controller }
Service is the implementation of the web API
func NewService ¶
func NewService(settings *config.Settings, ctrl controller.Controller) *Service
NewService returns a new web controller
func (Service) ActionList ¶
func (wb Service) ActionList(w http.ResponseWriter, r *http.Request)
ActionList is the API call to list actions for a device
func (Service) DeviceGet ¶
func (wb Service) DeviceGet(w http.ResponseWriter, r *http.Request)
DeviceGet is the API call to get a device
func (Service) DeviceList ¶
func (wb Service) DeviceList(w http.ResponseWriter, r *http.Request)
DeviceList is the API call to get devices
func (Service) GroupCreate ¶
func (wb Service) GroupCreate(w http.ResponseWriter, r *http.Request)
GroupCreate is the API call to create a group
func (Service) GroupGet ¶
func (wb Service) GroupGet(w http.ResponseWriter, r *http.Request)
GroupGet is the API call to retrieve a group
func (Service) GroupGetDevices ¶
func (wb Service) GroupGetDevices(w http.ResponseWriter, r *http.Request)
GroupGetDevices is the API call to get the devices for a group
func (Service) GroupGetExcludedDevices ¶
func (wb Service) GroupGetExcludedDevices(w http.ResponseWriter, r *http.Request)
GroupGetExcludedDevices is the API call to get the devices not in a group
func (Service) GroupLinkDevice ¶
func (wb Service) GroupLinkDevice(w http.ResponseWriter, r *http.Request)
GroupLinkDevice is the API call to link a device to a group
func (Service) GroupList ¶
func (wb Service) GroupList(w http.ResponseWriter, r *http.Request)
GroupList is the API call to list groups
func (Service) GroupUnlinkDevice ¶
func (wb Service) GroupUnlinkDevice(w http.ResponseWriter, r *http.Request)
GroupUnlinkDevice is the API call to unlink a device from a group
func (Service) SnapInstall ¶
func (wb Service) SnapInstall(w http.ResponseWriter, r *http.Request)
SnapInstall is the API call to install a snap for a device
func (Service) SnapList ¶
func (wb Service) SnapList(w http.ResponseWriter, r *http.Request)
SnapList is the API call to list snaps for a device
func (Service) SnapListPublish ¶
func (wb Service) SnapListPublish(w http.ResponseWriter, r *http.Request)
SnapListPublish is the API call to trigger a snap list on a device
func (Service) SnapRemove ¶
func (wb Service) SnapRemove(w http.ResponseWriter, r *http.Request)
SnapRemove is the API call to uninstall a snap for a device
func (Service) SnapUpdateAction ¶
func (wb Service) SnapUpdateAction(w http.ResponseWriter, r *http.Request)
SnapUpdateAction is the API call to update a snap for a device (enable, disable, refresh)
func (Service) SnapUpdateConf ¶
func (wb Service) SnapUpdateConf(w http.ResponseWriter, r *http.Request)
SnapUpdateConf is the API call to update a snap for a device (settings)
type SnapsResponse ¶
type SnapsResponse struct { StandardResponse Snaps []domain.DeviceSnap `json:"snaps"` }
SnapsResponse is the JSON response to list snaps
type StandardResponse ¶
StandardResponse is the JSON response from an API method, indicating success or failure.