fulfillment

package
v0.4.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Database

type Database interface {
	AddDevice(ctx context.Context, device types.Device) (string, error)
	GetDeviceByID(ctx context.Context, deviceID string) (*types.Device, error)
	GetDevicesByIDs(ctx context.Context, deviceIDs []string) ([]types.Device, error)

	GetUserDevicePermissions(ctx context.Context, userID string, deviceID string) (perms types.DevicePermissions, err error)
	GetUserDevices(ctx context.Context, userID string) ([]types.Device, error)
	GetUserByID(ctx context.Context, id string) (*types.User, error)
}

Database is interface for database

type Devmgmt

type Devmgmt interface {
	FetchDeviceState(ctx context.Context, device types.Device) (types.DeviceResponse, error)
	SendActionCommand(
		ctx context.Context,
		device types.Device,
		command string,
		params map[string]interface{},
	) (types.DeviceResponse, error)
}

Devmgmt is shortcut for DeviceManager

type Fulfillment

type Fulfillment struct {
	Router *chi.Mux
	// contains filtered or unexported fields
}

Fulfillment hold root server state

func New

func New(db Database, devmgmt Devmgmt, opts Options) Fulfillment

New creates server, it won't run till Server.Start

type Options

type Options struct {
	// AccessKey is secret for signing access tokens
	//
	// *Required*
	AccessKey string `env:"ACCESS_KEY,required"`
}

Options for fulfillment

Jump to

Keyboard shortcuts

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