endpoint

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2021 License: GPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// AdminId ...
	AdminId = 1
)

Variables

View Source
var (
	ErrMqttServerNoWorked = errors.New("mqtt server not worked")
)

Functions

This section is empty.

Types

type AlexaSkillEndpoint added in v0.3.0

type AlexaSkillEndpoint struct {
	*CommonEndpoint
}

AlexaSkillEndpoint ...

func NewAlexaSkillEndpoint added in v0.3.0

func NewAlexaSkillEndpoint(common *CommonEndpoint) *AlexaSkillEndpoint

NewAlexaSkillEndpoint ...

func (*AlexaSkillEndpoint) Add added in v0.3.0

func (n *AlexaSkillEndpoint) Add(params *m.AlexaSkill) (result *m.AlexaSkill, errs []*validation.Error, err error)

Add ...

func (*AlexaSkillEndpoint) Delete added in v0.3.0

func (n *AlexaSkillEndpoint) Delete(skillId int64) (err error)

Delete ...

func (*AlexaSkillEndpoint) GetById added in v0.3.0

func (n *AlexaSkillEndpoint) GetById(appId int64) (result *m.AlexaSkill, err error)

GetById ...

func (*AlexaSkillEndpoint) GetList added in v0.3.0

func (n *AlexaSkillEndpoint) GetList(limit, offset int64, order, sortBy string) (result []*m.AlexaSkill, total int64, err error)

GetList ...

func (*AlexaSkillEndpoint) Update added in v0.3.0

func (n *AlexaSkillEndpoint) Update(params *m.AlexaSkill) (skill *m.AlexaSkill, errs []*validation.Error, err error)

Update ...

type AuthEndpoint

type AuthEndpoint struct {
	*CommonEndpoint
}

AuthEndpoint ...

func NewAuthEndpoint

func NewAuthEndpoint(common *CommonEndpoint) *AuthEndpoint

NewAuthEndpoint ...

func (*AuthEndpoint) AccessList

func (a *AuthEndpoint) AccessList(user *m.User, accessListService access_list.AccessListService) (accessList *access_list.AccessList, err error)

AccessList ...

func (*AuthEndpoint) Recovery

func (a *AuthEndpoint) Recovery()

Recovery ...

func (*AuthEndpoint) Reset

func (a *AuthEndpoint) Reset()

Reset ...

func (*AuthEndpoint) SignIn

func (a *AuthEndpoint) SignIn(email, password string, ip string) (user *m.User, accessToken string, err error)

SignIn ...

func (*AuthEndpoint) SignOut

func (a *AuthEndpoint) SignOut(user *m.User) (err error)

SignOut ...

type CommonEndpoint

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

CommonEndpoint ...

func NewCommonEndpoint

func NewCommonEndpoint(adaptors *adaptors.Adaptors,
	accessList access_list.AccessListService,
	scriptService scripts.ScriptService,
	zigbee2mqtt zigbee2mqtt.Zigbee2mqtt,
	eventBus event_bus.EventBus,
	pluginManager common.PluginManager,
	entityManager entity_manager.EntityManager,
	mqtt mqtt.MqttServ,
	jwtManager jwt_manager.JwtManager,
) *CommonEndpoint

NewCommonEndpoint ...

type DeveloperToolsEndpoint added in v0.5.0

type DeveloperToolsEndpoint struct {
	*CommonEndpoint
}

DeveloperToolsEndpoint ...

func NewDeveloperToolsEndpoint added in v0.5.0

func NewDeveloperToolsEndpoint(common *CommonEndpoint) *DeveloperToolsEndpoint

NewDeveloperToolsEndpoint ...

func (DeveloperToolsEndpoint) EventList added in v0.5.0

func (d DeveloperToolsEndpoint) EventList() (events []message_queue.Stat, total int64, err error)

EventList ...

func (DeveloperToolsEndpoint) StateList added in v0.5.0

func (d DeveloperToolsEndpoint) StateList() (states []m.EntityShort, total int64, err error)

StateList ...

func (DeveloperToolsEndpoint) UpdateState added in v0.5.0

func (d DeveloperToolsEndpoint) UpdateState(entityId string, state *string, attrs map[string]interface{}) (errs []*validation.Error, err error)

UpdateState ...

type Endpoint

type Endpoint struct {
	AlexaSkill      *AlexaSkillEndpoint
	Auth            *AuthEndpoint
	Image           *ImageEndpoint
	Log             *LogEndpoint
	Role            *RoleEndpoint
	Script          *ScriptEndpoint
	User            *UserEndpoint
	Template        *TemplateEndpoint
	Notify          *NotifyEndpoint
	MessageDelivery *MessageDeliveryEndpoint
	Version         *VersionEndpoint
	Zigbee2mqtt     *Zigbee2mqttEndpoint
	Entity          *EntityEndpoint
	DeveloperTools  *DeveloperToolsEndpoint
	Mqtt            *MqttEndpoint
	Plugin          *PluginEndpoint
	PluginActor     *PluginActorEndpoint
}

Endpoint ...

func NewEndpoint

func NewEndpoint(adaptors *adaptors.Adaptors,
	scriptService scripts.ScriptService,
	accessList access_list.AccessListService,
	zigbee2mqtt zigbee2mqtt.Zigbee2mqtt,
	entityManager entity_manager.EntityManager,
	eventBus event_bus.EventBus,
	pluginManager common.PluginManager,
	mqtt mqtt.MqttServ,
	jwtManager jwt_manager.JwtManager) *Endpoint

NewEndpoint ...

type EntityEndpoint added in v0.5.0

type EntityEndpoint struct {
	*CommonEndpoint
}

EntityEndpoint ...

func NewEntityEndpoint added in v0.5.0

func NewEntityEndpoint(common *CommonEndpoint) *EntityEndpoint

NewEntityEndpoint ...

func (*EntityEndpoint) Add added in v0.5.0

func (n *EntityEndpoint) Add(entity *m.Entity) (result *m.Entity, errs []*validation.Error, err error)

Add ...

func (*EntityEndpoint) Delete added in v0.5.0

func (n *EntityEndpoint) Delete(id common.EntityId) (err error)

Delete ...

func (*EntityEndpoint) GetById added in v0.5.0

func (n *EntityEndpoint) GetById(id common.EntityId) (result *m.Entity, err error)

GetById ...

func (*EntityEndpoint) List added in v0.5.0

func (n *EntityEndpoint) List(limit, offset int64, order, sortBy string) (result []*m.Entity, total int64, err error)

List ...

func (*EntityEndpoint) Search added in v0.5.0

func (n *EntityEndpoint) Search(query string, limit, offset int) (result []*m.Entity, total int64, err error)

Search ...

func (*EntityEndpoint) Update added in v0.5.0

func (n *EntityEndpoint) Update(params *m.Entity) (result *m.Entity, errs []*validation.Error, err error)

Update ...

type ImageEndpoint

type ImageEndpoint struct {
	*CommonEndpoint
}

ImageEndpoint ...

func NewImageEndpoint

func NewImageEndpoint(common *CommonEndpoint) *ImageEndpoint

NewImageEndpoint ...

func (*ImageEndpoint) Add

func (i *ImageEndpoint) Add(params *m.Image) (image *m.Image, errs []*validation.Error, err error)

Add ...

func (*ImageEndpoint) Delete

func (i *ImageEndpoint) Delete(imageId int64) (err error)

Delete ...

func (*ImageEndpoint) GetById

func (i *ImageEndpoint) GetById(id int64) (image *m.Image, err error)

GetById ...

func (*ImageEndpoint) GetList

func (i *ImageEndpoint) GetList(limit, offset int64, order, sortBy string) (items []*m.Image, total int64, err error)

GetList ...

func (*ImageEndpoint) Update

func (i *ImageEndpoint) Update(params *m.Image) (result *m.Image, errs []*validation.Error, err error)

Update ...

func (*ImageEndpoint) Upload

func (i *ImageEndpoint) Upload(files map[string][]*multipart.FileHeader) (fileList []*m.Image, errs []error)

Upload ...

type LogEndpoint

type LogEndpoint struct {
	*CommonEndpoint
}

LogEndpoint ...

func NewLogEndpoint

func NewLogEndpoint(common *CommonEndpoint) *LogEndpoint

NewLogEndpoint ...

func (*LogEndpoint) Add

func (l *LogEndpoint) Add(log *m.Log) (result *m.Log, errs []*validation.Error, err error)

Add ...

func (*LogEndpoint) Delete

func (l *LogEndpoint) Delete(logId int64) (err error)

Delete ...

func (*LogEndpoint) GetById

func (l *LogEndpoint) GetById(id int64) (log *m.Log, err error)

GetById ...

func (*LogEndpoint) GetList

func (l *LogEndpoint) GetList(limit, offset int64, order, sortBy, query string) (list []*m.Log, total int64, err error)

GetList ...

func (*LogEndpoint) Search

func (l *LogEndpoint) Search(query string, limit, offset int) (list []*m.Log, total int64, err error)

Search ...

type MessageDeliveryEndpoint added in v0.0.17

type MessageDeliveryEndpoint struct {
	*CommonEndpoint
}

MessageDeliveryEndpoint ...

func NewMessageDeliveryEndpoint added in v0.0.17

func NewMessageDeliveryEndpoint(common *CommonEndpoint) *MessageDeliveryEndpoint

NewMessageDeliveryEndpoint ...

func (*MessageDeliveryEndpoint) Delete added in v0.0.17

func (n *MessageDeliveryEndpoint) Delete(id int64) (err error)

Delete ...

func (*MessageDeliveryEndpoint) GetList added in v0.0.17

func (n *MessageDeliveryEndpoint) GetList(limit, offset int64, order, sortBy string) (result []m.MessageDelivery, total int64, err error)

GetList ...

type MqttEndpoint added in v0.0.20

type MqttEndpoint struct {
	*CommonEndpoint
}

func NewMqttEndpoint added in v0.0.20

func NewMqttEndpoint(common *CommonEndpoint) *MqttEndpoint

func (*MqttEndpoint) CloseClient added in v0.0.20

func (m *MqttEndpoint) CloseClient(clientId string) (err error)

func (*MqttEndpoint) GetClient added in v0.0.20

func (m *MqttEndpoint) GetClient(clientId string) (client *admin.ClientInfo, err error)

func (*MqttEndpoint) GetClients added in v0.0.20

func (m *MqttEndpoint) GetClients(limit, offset uint) (list []*admin.ClientInfo, total uint32, err error)

func (*MqttEndpoint) GetSession added in v0.0.20

func (m *MqttEndpoint) GetSession(clientId string) (session *admin.SessionInfo, err error)

func (*MqttEndpoint) GetSessions added in v0.0.20

func (m *MqttEndpoint) GetSessions(limit, offset uint) (list []*admin.SessionInfo, total int, err error)

func (*MqttEndpoint) GetSubscriptions added in v0.0.20

func (m *MqttEndpoint) GetSubscriptions(clientId string, limit, offset uint) (list []*admin.SubscriptionInfo, total int, err error)

func (*MqttEndpoint) Publish added in v0.0.20

func (m *MqttEndpoint) Publish(topic string, qos int, payload []byte, retain bool) (err error)

func (*MqttEndpoint) SearchTopic added in v0.0.21

func (m *MqttEndpoint) SearchTopic(query string, limit, offset int) (result []*admin.SubscriptionInfo, total int64, err error)

func (*MqttEndpoint) Subscribe added in v0.0.20

func (m *MqttEndpoint) Subscribe(clientId, topic string, qos int) (err error)

func (*MqttEndpoint) Unsubscribe added in v0.0.20

func (m *MqttEndpoint) Unsubscribe(clientId, topic string) (err error)

type NotifyEndpoint added in v0.0.17

type NotifyEndpoint struct {
	*CommonEndpoint
}

NotifyEndpoint ...

func NewNotifyEndpoint added in v0.0.17

func NewNotifyEndpoint(common *CommonEndpoint) *NotifyEndpoint

NewNotifyEndpoint ...

func (*NotifyEndpoint) Repeat added in v0.0.17

func (n *NotifyEndpoint) Repeat(id int64) (err error)

Repeat ...

func (*NotifyEndpoint) Send added in v0.0.17

func (n *NotifyEndpoint) Send(params *m.NewNotifrMessage) (err error)

Send ...

type PluginActorEndpoint added in v0.5.0

type PluginActorEndpoint struct {
	*CommonEndpoint
}

PluginActorEndpoint ...

func NewPluginActorEndpoint added in v0.5.0

func NewPluginActorEndpoint(common *CommonEndpoint) *PluginActorEndpoint

NewPluginActorEndpoint ...

func (*PluginActorEndpoint) Add added in v0.5.0

func (p *PluginActorEndpoint) Add()

func (*PluginActorEndpoint) Delete added in v0.5.0

func (p *PluginActorEndpoint) Delete()

func (*PluginActorEndpoint) GetByName added in v0.5.0

func (p *PluginActorEndpoint) GetByName(name string)

func (*PluginActorEndpoint) Search added in v0.5.0

func (p *PluginActorEndpoint) Search(query string, limit, offset int)

func (*PluginActorEndpoint) Update added in v0.5.0

func (p *PluginActorEndpoint) Update()

type PluginEndpoint added in v0.5.0

type PluginEndpoint struct {
	*CommonEndpoint
}

PluginEndpoint ...

func NewPluginEndpoint added in v0.5.0

func NewPluginEndpoint(common *CommonEndpoint) *PluginEndpoint

NewPluginEndpoint ...

func (*PluginEndpoint) Disable added in v0.5.0

func (p *PluginEndpoint) Disable(pluginName string) (err error)

Disable ...

func (*PluginEndpoint) Enabled added in v0.5.0

func (p *PluginEndpoint) Enabled(pluginName string) (err error)

Enabled ...

func (*PluginEndpoint) GetList added in v0.5.0

func (p *PluginEndpoint) GetList(limit, offset int64, order, sortBy string) (list []m.Plugin, total int64, err error)

GetList ...

func (*PluginEndpoint) GetOptions added in v0.5.0

func (p *PluginEndpoint) GetOptions(pluginName string) (options m.PluginOptions, err error)

GetOptions ...

type RoleEndpoint

type RoleEndpoint struct {
	*CommonEndpoint
}

RoleEndpoint ...

func NewRoleEndpoint

func NewRoleEndpoint(common *CommonEndpoint) *RoleEndpoint

NewRoleEndpoint ...

func (*RoleEndpoint) Add

func (n *RoleEndpoint) Add(params *m.Role) (result *m.Role, errs []*validation.Error, err error)

Add ...

func (*RoleEndpoint) Delete

func (n *RoleEndpoint) Delete(name string) (err error)

Delete ...

func (*RoleEndpoint) GetAccessList

func (n *RoleEndpoint) GetAccessList(roleName string,
	accessListService access_list.AccessListService) (accessList access_list.AccessList, err error)

GetAccessList ...

func (*RoleEndpoint) GetByName

func (n *RoleEndpoint) GetByName(name string) (result *m.Role, err error)

GetByName ...

func (*RoleEndpoint) GetList

func (n *RoleEndpoint) GetList(limit, offset int64, order, sortBy string) (result []*m.Role, total int64, err error)

GetList ...

func (*RoleEndpoint) Search

func (n *RoleEndpoint) Search(query string, limit, offset int) (result []*m.Role, total int64, err error)

Search ...

func (*RoleEndpoint) Update

func (n *RoleEndpoint) Update(params *m.Role) (result *m.Role, errs []*validation.Error, err error)

Update ...

func (*RoleEndpoint) UpdateAccessList

func (n *RoleEndpoint) UpdateAccessList(roleName string, accessListDif map[string]map[string]bool) (err error)

UpdateAccessList ...

type ScriptEndpoint

type ScriptEndpoint struct {
	*CommonEndpoint
}

ScriptEndpoint ...

func NewScriptEndpoint

func NewScriptEndpoint(common *CommonEndpoint) *ScriptEndpoint

NewScriptEndpoint ...

func (*ScriptEndpoint) Add

func (n *ScriptEndpoint) Add(params *m.Script) (result *m.Script, errs []*validation.Error, err error)

Add ...

func (*ScriptEndpoint) Copy added in v0.0.10

func (n *ScriptEndpoint) Copy(scriptId int64) (script *m.Script, err error)

Copy ...

func (*ScriptEndpoint) DeleteScriptById

func (n *ScriptEndpoint) DeleteScriptById(scriptId int64) (err error)

DeleteScriptById ...

func (*ScriptEndpoint) Execute

func (n *ScriptEndpoint) Execute(scriptId int64) (result string, err error)

Execute ...

func (*ScriptEndpoint) ExecuteSource

func (n *ScriptEndpoint) ExecuteSource(script *m.Script) (result string, err error)

ExecuteSource ...

func (*ScriptEndpoint) GetById

func (n *ScriptEndpoint) GetById(scriptId int64) (result *m.Script, err error)

GetById ...

func (*ScriptEndpoint) GetList

func (n *ScriptEndpoint) GetList(limit, offset int64, order, sortBy string) (result []*m.Script, total int64, err error)

GetList ...

func (*ScriptEndpoint) Search

func (n *ScriptEndpoint) Search(query string, limit, offset int) (devices []*m.Script, total int64, err error)

Search ...

func (*ScriptEndpoint) Update

func (n *ScriptEndpoint) Update(params *m.Script) (result *m.Script, errs []*validation.Error, err error)

Update ...

type TemplateEndpoint added in v0.0.17

type TemplateEndpoint struct {
	*CommonEndpoint
}

TemplateEndpoint ...

func NewTemplateEndpoint added in v0.0.17

func NewTemplateEndpoint(common *CommonEndpoint) *TemplateEndpoint

NewTemplateEndpoint ...

func (*TemplateEndpoint) Delete added in v0.0.17

func (t *TemplateEndpoint) Delete(name string) (err error)

Delete ...

func (*TemplateEndpoint) GetByName added in v0.0.17

func (t *TemplateEndpoint) GetByName(name string) (result *m.Template, err error)

GetByName ...

func (*TemplateEndpoint) GetItemByName added in v0.0.17

func (t *TemplateEndpoint) GetItemByName(name string) (result *m.Template, err error)

GetItemByName ...

func (*TemplateEndpoint) GetItemsSortedList added in v0.0.17

func (t *TemplateEndpoint) GetItemsSortedList() (count int64, items []string, err error)

GetItemsSortedList ...

func (*TemplateEndpoint) GetItemsTree added in v0.0.17

func (t *TemplateEndpoint) GetItemsTree() (tree []*m.TemplateTree, err error)

GetItemsTree ...

func (*TemplateEndpoint) GetList added in v0.0.17

func (t *TemplateEndpoint) GetList() (count int64, templates []*m.Template, err error)

GetList ...

func (*TemplateEndpoint) Preview added in v0.0.17

func (t *TemplateEndpoint) Preview(template *m.TemplateContent) (data string, err error)

Preview ...

func (*TemplateEndpoint) Search added in v0.0.17

func (t *TemplateEndpoint) Search(query string, limit, offset int) (result []*m.Template, total int64, err error)

Search ...

func (*TemplateEndpoint) UpdateItemsTree added in v0.0.17

func (t *TemplateEndpoint) UpdateItemsTree(tree []*m.TemplateTree) (err error)

UpdateItemsTree ...

func (*TemplateEndpoint) UpdateOrCreate added in v0.0.17

func (t *TemplateEndpoint) UpdateOrCreate(params *m.Template) (errs []*validation.Error, err error)

UpdateOrCreate ...

func (*TemplateEndpoint) UpdateStatus added in v0.0.17

func (t *TemplateEndpoint) UpdateStatus(params *m.Template) (errs []*validation.Error, err error)

UpdateStatus ...

type UserEndpoint

type UserEndpoint struct {
	*CommonEndpoint
}

UserEndpoint ...

func NewUserEndpoint

func NewUserEndpoint(common *CommonEndpoint) *UserEndpoint

NewUserEndpoint ...

func (*UserEndpoint) Add

func (n *UserEndpoint) Add(params *m.User,
	currentUser *m.User) (result *m.User, errs []*validation.Error, err error)

Add ...

func (*UserEndpoint) Delete

func (n *UserEndpoint) Delete(userId int64) (err error)

Delete ...

func (*UserEndpoint) GetById

func (n *UserEndpoint) GetById(userId int64) (result *m.User, err error)

GetById ...

func (*UserEndpoint) GetList

func (n *UserEndpoint) GetList(limit, offset int64, order, sortBy string) (result []*m.User, total int64, err error)

GetList ...

func (*UserEndpoint) Update

func (n *UserEndpoint) Update(params *m.User) (result *m.User, errs []*validation.Error, err error)

Update ...

func (*UserEndpoint) UpdateStatus

func (n *UserEndpoint) UpdateStatus(userId int64, newStatus string) (err error)

UpdateStatus ...

type VersionEndpoint added in v0.0.24

type VersionEndpoint struct {
	*CommonEndpoint
}

VersionEndpoint ...

func NewVersionEndpoint added in v0.0.24

func NewVersionEndpoint(common *CommonEndpoint) *VersionEndpoint

NewVersionEndpoint ...

func (*VersionEndpoint) ServerVersion added in v0.0.24

func (v *VersionEndpoint) ServerVersion() (ver m.Version)

ServerVersion ...

type Zigbee2mqttEndpoint added in v0.1.0

type Zigbee2mqttEndpoint struct {
	*CommonEndpoint
}

Zigbee2mqttEndpoint ...

func NewZigbee2mqttEndpoint added in v0.1.0

func NewZigbee2mqttEndpoint(common *CommonEndpoint) *Zigbee2mqttEndpoint

NewZigbee2mqttEndpoint ...

func (*Zigbee2mqttEndpoint) Add added in v0.1.0

func (n *Zigbee2mqttEndpoint) Add(params *m.Zigbee2mqtt) (result *m.Zigbee2mqtt, errs []*validation.Error, err error)

Add ...

func (*Zigbee2mqttEndpoint) Delete added in v0.1.0

func (n *Zigbee2mqttEndpoint) Delete(id int64) (err error)

Delete ...

func (*Zigbee2mqttEndpoint) DeviceBan added in v0.1.0

func (n *Zigbee2mqttEndpoint) DeviceBan(id int64, friendlyName string) (err error)

DeviceBan ...

func (*Zigbee2mqttEndpoint) DeviceRename added in v0.1.0

func (n *Zigbee2mqttEndpoint) DeviceRename(friendlyName, name string) (err error)

DeviceRename ...

func (*Zigbee2mqttEndpoint) DeviceWhitelist added in v0.1.0

func (n *Zigbee2mqttEndpoint) DeviceWhitelist(id int64, friendlyName string) (err error)

DeviceWhitelist ...

func (*Zigbee2mqttEndpoint) GetById added in v0.1.0

func (n *Zigbee2mqttEndpoint) GetById(id int64) (result *zigbee2mqtt.Zigbee2mqttInfo, err error)

GetById ...

func (*Zigbee2mqttEndpoint) GetList added in v0.1.0

func (n *Zigbee2mqttEndpoint) GetList(limit, offset int64, order, sortBy string) (result []*zigbee2mqtt.Zigbee2mqttInfo, total int64, err error)

GetList ...

func (*Zigbee2mqttEndpoint) Networkmap added in v0.1.0

func (n *Zigbee2mqttEndpoint) Networkmap(id int64) (networkmap string, err error)

Networkmap ...

func (*Zigbee2mqttEndpoint) ResetBridge added in v0.1.0

func (n *Zigbee2mqttEndpoint) ResetBridge(id int64) (err error)

ResetBridge ...

func (*Zigbee2mqttEndpoint) SearchDevice added in v0.1.0

func (n *Zigbee2mqttEndpoint) SearchDevice(query string, limit, offset int) (result []*m.Zigbee2mqttDevice, total int64, err error)

SearchDevice ...

func (*Zigbee2mqttEndpoint) Update added in v0.1.0

func (n *Zigbee2mqttEndpoint) Update(params *m.Zigbee2mqtt) (bridge *m.Zigbee2mqtt, errs []*validation.Error, err error)

Update ...

func (*Zigbee2mqttEndpoint) UpdateNetworkmap added in v0.1.0

func (n *Zigbee2mqttEndpoint) UpdateNetworkmap(id int64) (err error)

UpdateNetworkmap ...

Jump to

Keyboard shortcuts

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