api

package
v0.0.0-...-417c523 Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2019 License: Apache-2.0 Imports: 39 Imported by: 0

Documentation

Index

Constants

View Source
const (
	APIErrorDeviceNotFound = 1
	APIErrorBodyParsing    = 2
	APIErrorDatabase       = 3
	APIErrorInvalidValue   = 4
	APIErrorUnauthorized   = 5
	APIErrorExpiredToken   = 6

	TokenName = "EiPAccessToken"

	TokenExpirationTime = 86400 // in seconds: 1day

	FilterTypeAll    = "all"
	FilterTypeSensor = "sensor"
	FilterTypeLed    = "led"
	FilterTypeBlind  = "blind"
	FilterTypeHvac   = "hvac"
	FilterTypeWago   = "wago"
	FilterTypeNano   = "nanosense"
)

Variables

This section is empty.

Functions

func NewError

func NewError(text string) error

NewError raise an error

Types

type API

type API struct {
	EventsToBackend chan map[string]interface{}
	// contains filtered or unexported fields
}

func InitAPI

func InitAPI(db database.Database, historydb history.HistoryDb, eventsAPI chan map[string]interface{},
	eventsConso chan core.EventConsumption, uploadValue *string, conf pkg.ServiceConfig) *API

InitAPI start API connection

type APIError

type APIError struct {
	Code    int    `json:"code"` //errorCode
	Message string `json:"message"`
}

APIError Message error code

type APIFunctions

type APIFunctions struct {
	Functions []string `json:"functions"`
}

type APIInfo

type APIInfo struct {
	Versions []string `json:"versions"`
}

type Claims

type Claims struct {
	jwt.StandardClaims
}

type Credentials

type Credentials struct {
	UserKey string `json:"userKey"`
}

type GlobalHistory

type GlobalHistory struct {
	Leds []LedHist `json:"leds"`
}

type InternalAPI

type InternalAPI struct {
	EventsToBackend chan map[string]interface{}
	// contains filtered or unexported fields
}

func InitInternalAPI

func InitInternalAPI(db database.Database,
	conf pkg.ServiceConfig) *InternalAPI

InitInternalAPI start API connection

type JwtToken

type JwtToken struct {
	Token     string `json:"accessToken"`
	TokenType string `json:"tokenType"`
	ExpireIn  int    `json:"expireIn"`
}

type LedHist

type LedHist struct {
	Energy float64 `json:"energy"`
	Power  int     `json:"power"`
	Date   string  `json:"date"`
}

type UserAuthorization

type UserAuthorization struct {
	Priviledges []string `json:"priviledges"`
	AccessGroup []int    `json:"accessGroups"`
}

UserAuthorization

Jump to

Keyboard shortcuts

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