devicerepo

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2023 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const AttributeUsedForZwave = "senergy/zwave-dc"
View Source
const AttributeZwaveTypeMappingKey = "senergy/zwave-type-mapping-key"
View Source
const DtFallbackKey = "device-types"

Variables

This section is empty.

Functions

func Do

func Do[T any](req *http.Request) (result T, code int, err error)

func PermissionSearch

func PermissionSearch(token string, searchUrl string, query QueryMessage, result interface{}) (err error, code int)

Types

type Auth

type Auth interface {
	EnsureAccess(config configuration.Config) (token string, err error)
}

type ConditionConfig

type ConditionConfig struct {
	Feature   string             `json:"feature,omitempty"`
	Operation QueryOperationType `json:"operation,omitempty"`
	Value     interface{}        `json:"value,omitempty"`
	Ref       string             `json:"ref,omitempty"`
}

type DeviceRepo

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

func New

func New(config configuration.Config, auth Auth) (*DeviceRepo, error)

func (*DeviceRepo) CreateDeviceTypeWithDistinctAttributes

func (this *DeviceRepo) CreateDeviceTypeWithDistinctAttributes(key string, dt models.DeviceType, attributeKeys []string) (result models.DeviceType, code int, err error)

func (*DeviceRepo) FindDeviceTypeId

func (this *DeviceRepo) FindDeviceTypeId(device model.DeviceInfo) (dtId string, usedFallback bool, err error)

func (*DeviceRepo) ListZwaveDeviceTypes

func (this *DeviceRepo) ListZwaveDeviceTypes() (list []models.DeviceType, err error)

type Permissions

type Permissions struct {
	A bool
	R bool
	W bool
	X bool
}

type QueryCheckIds

type QueryCheckIds struct {
	Ids    []string `json:"ids,omitempty"`
	Rights string   `json:"rights,omitempty"`
}

type QueryFind

type QueryFind struct {
	QueryListCommons
	Search string     `json:"search,omitempty"`
	Filter *Selection `json:"filter,omitempty"`
}

type QueryListCommons

type QueryListCommons struct {
	Limit    int    `json:"limit,omitempty"`
	Offset   int    `json:"offset,omitempty"`
	Rights   string `json:"rights,omitempty"`
	SortBy   string `json:"sort_by,omitempty"`
	SortDesc bool   `json:"sort_desc,omitempty"`
}

type QueryListIds

type QueryListIds struct {
	QueryListCommons
	Ids []string `json:"ids,omitempty"`
}

type QueryMessage

type QueryMessage struct {
	Resource      string         `json:"resource"`
	Find          *QueryFind     `json:"find,omitempty"`
	ListIds       *QueryListIds  `json:"list_ids,omitempty"`
	CheckIds      *QueryCheckIds `json:"check_ids,omitempty"`
	TermAggregate *string        `json:"term_aggregate,omitempty"`
}

type QueryOperationType

type QueryOperationType string
const (
	QueryEqualOperation             QueryOperationType = "=="
	QueryUnequalOperation           QueryOperationType = "!="
	QueryAnyValueInFeatureOperation QueryOperationType = "any_value_in_feature"
)

type Selection

type Selection struct {
	And       []Selection      `json:"and,omitempty"`
	Or        []Selection      `json:"or,omitempty"`
	Not       *Selection       `json:"not,omitempty"`
	Condition *ConditionConfig `json:"condition,omitempty"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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