settings

package
v0.0.1-alpha.22 Latest Latest
Warning

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

Go to latest
Published: May 18, 2025 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PluginName = "settings"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

TODO - I really do not like this. I wish we could just expose the interface to the IDE instead of having to manually embed the same controller into a struct and declare pointer recievers for each method.

Currently a limitation of Wails it seems, unless I'm missing something.

func NewClient

func NewClient(controller Controller) *Client

func (*Client) GetSetting

func (c *Client) GetSetting(plugin, id string) (pkgsettings.Setting, error)

func (*Client) ListPlugins

func (c *Client) ListPlugins() ([]string, error)

func (*Client) ListSettings

func (c *Client) ListSettings(plugin string) map[string]pkgsettings.Setting

func (*Client) PluginValues

func (c *Client) PluginValues(plugin string) map[string]any

func (*Client) SetSetting

func (c *Client) SetSetting(plugin, id string, value any) error

func (*Client) SetSettings

func (c *Client) SetSettings(plugin string, settings map[string]any) error

func (*Client) Values

func (c *Client) Values() map[string]any

type Controller

type Controller interface {
	internaltypes.Controller
	IClient
}

Controller handles all requests to interface with the settings capabilities on installed plugins.

This controller is embedded in the client IDE facing client.

func NewController

func NewController(logger *zap.SugaredLogger, sp pkgsettings.Provider) Controller

NewController returns a new Controller instance.

type IClient

type IClient interface {
	// ListPlugins returns a list of all the plugins that are registered with the settings controller
	ListPlugins() ([]string, error)

	// Values returns a list of all of the values calculated in the current setting store
	Values() map[string]any

	// PluginValues returns a list of all of the values calculated in the plugin's setting store
	PluginValues(plugin string) map[string]any

	// ListSettings returns the settings store
	ListSettings(plugin string) map[string]pkgsettings.Setting

	// GetSetting returns the setting by ID. This ID should be in the form of a dot separated string
	// that represents the path to the setting. For example, "appearance.theme"
	GetSetting(plugin, id string) (pkgsettings.Setting, error)

	// SetSetting sets the value of the setting by ID
	SetSetting(plugin, id string, value any) error

	// SetSettings sets multiple settings at once
	SetSettings(plugin string, settings map[string]any) error
}

IClient is the system/UI facing client for making settings requests to the settings controller.

Jump to

Keyboard shortcuts

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