plugin

package
v0.0.0-...-f8eeb55 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2023 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrAPINotBind = errors.New("API can only be called after init")

Functions

This section is empty.

Types

type Device

type Device = protos.Device

type DeviceCustomEvent

type DeviceCustomEvent struct {
	Device *Device
	Event  string
	Args   []any
}

type DeviceEvent

type DeviceEvent struct {
	Device *Device
	Event  string
	Args   []any
}

type DeviceJoinEvent

type DeviceJoinEvent = protos.DeviceJoinEvent

type DeviceLeaveEvent

type DeviceLeaveEvent = protos.DeviceLeaveEvent

type Empty

type Empty = protos.Empty

type Hook

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

func (*Hook) Id

func (h *Hook) Id() string

func (*Hook) OnDeviceCustomEvent

func (h *Hook) OnDeviceCustomEvent(ctx context.Context, v *DeviceCustomEvent) (err error)

func (*Hook) Version

func (h *Hook) Version() string

type HookAPI

type HookAPI interface {
	FireEvent(ctx context.Context, host string, device int64, data map[string]any) (err error)
}

type HookAPIGetter

type HookAPIGetter = func(hookid string) (HookAPI, error)

type HookError

type HookError struct {
	Hook   *Hook
	Origin error
}

func (*HookError) Error

func (e *HookError) Error() string

func (*HookError) Unwrap

func (e *HookError) Unwrap() error

type HookErrorList

type HookErrorList []*HookError

func (HookErrorList) Error

func (e HookErrorList) Error() string

func (HookErrorList) Unwrap

func (e HookErrorList) Unwrap() (errs []error)

type HookExistsErr

type HookExistsErr struct {
	Instance *Hook
}

func (*HookExistsErr) Error

func (e *HookExistsErr) Error() string

type HookLoadEvent

type HookLoadEvent = protos.HookLoadEvent

type HookManager

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

func NewHookManager

func NewHookManager(ctx context.Context, apiGetter HookAPIGetter) (m *HookManager, err error)

func (*HookManager) ForEach

func (m *HookManager) ForEach(cb func(*Hook) error) (errs HookErrorList)

func (*HookManager) Get

func (m *HookManager) Get(id string) *Hook

func (*HookManager) List

func (m *HookManager) List() (hooks []*Hook)

func (*HookManager) Load

func (m *HookManager) Load(ctx context.Context, path string) (h *Hook, err error)

func (*HookManager) LoadFromDir

func (m *HookManager) LoadFromDir(ctx context.Context, path string) (errs []error)

func (*HookManager) OnDeviceEvent

func (m *HookManager) OnDeviceEvent(event *DeviceEvent) (err error)

func (*HookManager) OnDeviceJoin

func (m *HookManager) OnDeviceJoin(event *DeviceJoinEvent) (err error)

func (*HookManager) OnDeviceLeave

func (m *HookManager) OnDeviceLeave(event *DeviceLeaveEvent) (err error)

func (*HookManager) ReloadFromDir

func (m *HookManager) ReloadFromDir(ctx context.Context, path string) (errs []error)

func (*HookManager) Unload

func (m *HookManager) Unload(ctx context.Context, id string) (err error)

type HookMetadata

type HookMetadata = protos.HookMetadata

type HookNotExistsErr

type HookNotExistsErr struct {
	Id string
}

func (*HookNotExistsErr) Error

func (e *HookNotExistsErr) Error() string

type HookUnloadEvent

type HookUnloadEvent = protos.HookUnloadEvent

Directories

Path Synopsis
this file implemented wrap/unwrap between go types and proto Any type
this file implemented wrap/unwrap between go types and proto Any type

Jump to

Keyboard shortcuts

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