protocol

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jun 8, 2026 License: Apache-2.0 Imports: 5 Imported by: 2 modules, 4 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action struct {
	// Action-specific parameters. Schema depends on 'type'.
	Params ActionParams `json:"params,omitempty,omitzero" yaml:"params,omitempty" mapstructure:"params,omitempty"`

	// Action type. Built-ins are well-known; plugin actions use
	// 'plugin.<plugin_id>.<action_id>'.
	Type string `json:"type" yaml:"type" mapstructure:"type"`
}

An executable action bound to an input.

func (*Action) UnmarshalJSON

func (j *Action) UnmarshalJSON(value []byte) error

UnmarshalJSON implements json.Unmarshaler.

type ActionDescriptor added in v0.3.0

type ActionDescriptor struct {
	// Optional longer description of what the action does.
	Description *string `json:"description,omitempty,omitzero" yaml:"description,omitempty" mapstructure:"description,omitempty"`

	// Human-friendly action name for the UI.
	Name string `json:"name" yaml:"name" mapstructure:"name"`

	// Params this action accepts, in display order.
	Params []ParamSpec `json:"params" yaml:"params" mapstructure:"params"`

	// Action type, as used in Action.type (e.g. 'launch_app').
	Type string `json:"type" yaml:"type" mapstructure:"type"`
}

Describes a bindable action type and the params it accepts.

func (*ActionDescriptor) UnmarshalJSON added in v0.3.0

func (j *ActionDescriptor) UnmarshalJSON(value []byte) error

UnmarshalJSON implements json.Unmarshaler.

type ActionParams

type ActionParams map[string]interface{}

Action-specific parameters. Schema depends on 'type'.

type ActiveProfileChangedSchemaJson added in v0.6.0

type ActiveProfileChangedSchemaJson struct {
	// Data corresponds to the JSON schema field "data".
	Data ActiveProfileChangedSchemaJsonData `json:"data" yaml:"data" mapstructure:"data"`
}

Pushed by the daemon whenever the active profile changes on the server's own initiative (today: auto-switch by foreground app). Lets clients stay in sync without polling. Not emitted in response to a client's set_active_profile request, which already returns the new id.

func (*ActiveProfileChangedSchemaJson) UnmarshalJSON added in v0.6.0

func (j *ActiveProfileChangedSchemaJson) UnmarshalJSON(value []byte) error

UnmarshalJSON implements json.Unmarshaler.

type ActiveProfileChangedSchemaJsonData added in v0.6.0

type ActiveProfileChangedSchemaJsonData struct {
	// Identifier of the now-active profile.
	ActiveProfileId string `json:"active_profile_id" yaml:"active_profile_id" mapstructure:"active_profile_id"`
}

func (*ActiveProfileChangedSchemaJsonData) UnmarshalJSON added in v0.6.0

func (j *ActiveProfileChangedSchemaJsonData) UnmarshalJSON(value []byte) error

UnmarshalJSON implements json.Unmarshaler.

type AutoSwitchRule added in v0.6.0

type AutoSwitchRule struct {
	// OS-native application identifier: bundle id on macOS, executable name on
	// Linux/Windows. Opaque string, not portable across OSes; the daemon matches it
	// verbatim against the frontmost app.
	App string `json:"app" yaml:"app" mapstructure:"app"`

	// Identifier of the profile to activate when this app is frontmost.
	ProfileId string `json:"profile_id" yaml:"profile_id" mapstructure:"profile_id"`
}

Maps a foreground application to the profile that should become active while that app is frontmost. When the frontmost app matches no rule, the active profile is left unchanged (sticky behavior); there is no fallback profile.

func (*AutoSwitchRule) UnmarshalJSON added in v0.6.0

func (j *AutoSwitchRule) UnmarshalJSON(value []byte) error

UnmarshalJSON implements json.Unmarshaler.

type Binding

type Binding struct {
	// Action corresponds to the JSON schema field "action".
	Action Action `json:"action" yaml:"action" mapstructure:"action"`

	// DeviceId corresponds to the JSON schema field "device_id".
	DeviceId DeviceID `json:"device_id" yaml:"device_id" mapstructure:"device_id"`

	// InputId corresponds to the JSON schema field "input_id".
	InputId string `json:"input_id" yaml:"input_id" mapstructure:"input_id"`

	// Trigger corresponds to the JSON schema field "trigger".
	Trigger InputAction `json:"trigger" yaml:"trigger" mapstructure:"trigger"`
}

Maps an input on a specific device to an action.

func (*Binding) UnmarshalJSON

func (j *Binding) UnmarshalJSON(value []byte) error

UnmarshalJSON implements json.Unmarshaler.

type CreateProfileSchemaJson added in v0.4.0

type CreateProfileSchemaJson struct {
	// Params corresponds to the JSON schema field "params".
	Params CreateProfileSchemaJsonParams `json:"params" yaml:"params" mapstructure:"params"`

	// Result corresponds to the JSON schema field "result".
	Result CreateProfileSchemaJsonResult `json:"result" yaml:"result" mapstructure:"result"`
}

Creates a new profile. The server generates the id and returns the profile with an empty bindings array.

func (*CreateProfileSchemaJson) UnmarshalJSON added in v0.4.0

func (j *CreateProfileSchemaJson) UnmarshalJSON(value []byte) error

UnmarshalJSON implements json.Unmarshaler.

type CreateProfileSchemaJsonParams added in v0.4.0

type CreateProfileSchemaJsonParams struct {
	// Human-friendly name for the new profile.
	Name string `json:"name" yaml:"name" mapstructure:"name"`
}

func (*CreateProfileSchemaJsonParams) UnmarshalJSON added in v0.4.0

func (j *CreateProfileSchemaJsonParams) UnmarshalJSON(value []byte) error

UnmarshalJSON implements json.Unmarshaler.

type CreateProfileSchemaJsonResult added in v0.4.0

type CreateProfileSchemaJsonResult struct {
	// Profile corresponds to the JSON schema field "profile".
	Profile Profile `json:"profile" yaml:"profile" mapstructure:"profile"`
}

func (*CreateProfileSchemaJsonResult) UnmarshalJSON added in v0.4.0

func (j *CreateProfileSchemaJsonResult) UnmarshalJSON(value []byte) error

UnmarshalJSON implements json.Unmarshaler.

type DeleteProfileSchemaJson added in v0.4.0

type DeleteProfileSchemaJson struct {
	// Params corresponds to the JSON schema field "params".
	Params DeleteProfileSchemaJsonParams `json:"params" yaml:"params" mapstructure:"params"`

	// Result corresponds to the JSON schema field "result".
	Result DeleteProfileSchemaJsonResult `json:"result" yaml:"result" mapstructure:"result"`
}

Deletes a profile. The daemon never deletes the last remaining profile. Deleting the active profile reassigns the active one, so the resulting active profile id is always returned.

func (*DeleteProfileSchemaJson) UnmarshalJSON added in v0.4.0

func (j *DeleteProfileSchemaJson) UnmarshalJSON(value []byte) error

UnmarshalJSON implements json.Unmarshaler.

type DeleteProfileSchemaJsonParams added in v0.4.0

type DeleteProfileSchemaJsonParams struct {
	// Identifier of the profile to delete.
	Id string `json:"id" yaml:"id" mapstructure:"id"`
}

func (*DeleteProfileSchemaJsonParams) UnmarshalJSON added in v0.4.0

func (j *DeleteProfileSchemaJsonParams) UnmarshalJSON(value []byte) error

UnmarshalJSON implements json.Unmarshaler.

type DeleteProfileSchemaJsonResult added in v0.4.0

type DeleteProfileSchemaJsonResult struct {
	// Identifier of the profile that is active after the deletion. Unchanged unless
	// the deleted profile was the active one.
	ActiveProfileId string `json:"active_profile_id" yaml:"active_profile_id" mapstructure:"active_profile_id"`
}

func (*DeleteProfileSchemaJsonResult) UnmarshalJSON added in v0.4.0

func (j *DeleteProfileSchemaJsonResult) UnmarshalJSON(value []byte) error

UnmarshalJSON implements json.Unmarshaler.

type Device

type Device struct {
	// Id corresponds to the JSON schema field "id".
	Id DeviceID `json:"id" yaml:"id" mapstructure:"id"`

	// Inputs (keys/encoders) the daemon knows this device exposes. Empty for
	// unrecognized devices the daemon can't map.
	Inputs []Input `json:"inputs" yaml:"inputs" mapstructure:"inputs"`

	// Manufacturer string from the HID descriptor. May be missing on cheap/clone
	// devices.
	Manufacturer *string `json:"manufacturer,omitempty,omitzero" yaml:"manufacturer,omitempty" mapstructure:"manufacturer,omitempty"`

	// OS-opaque path used by the HID library to (re)open the device. Format varies
	// per OS; clients should treat it as an opaque token.
	Path string `json:"path" yaml:"path" mapstructure:"path"`

	// Product name string from the HID descriptor.
	Product *string `json:"product,omitempty,omitzero" yaml:"product,omitempty" mapstructure:"product,omitempty"`

	// USB Product ID as a 4-digit hexadecimal string (lowercase or uppercase, no '0x'
	// prefix).
	ProductId string `json:"product_id" yaml:"product_id" mapstructure:"product_id"`

	// Serial number string from the HID descriptor. Not all HID devices expose one.
	SerialNumber *string `json:"serial_number,omitempty,omitzero" yaml:"serial_number,omitempty" mapstructure:"serial_number,omitempty"`

	// USB Vendor ID as a 4-digit hexadecimal string (lowercase or uppercase, no '0x'
	// prefix).
	VendorId string `json:"vendor_id" yaml:"vendor_id" mapstructure:"vendor_id"`
}

A HID device known to the daemon. Returned by list_devices.

func (*Device) UnmarshalJSON

func (j *Device) UnmarshalJSON(value []byte) error

UnmarshalJSON implements json.Unmarshaler.

type DeviceID

type DeviceID string

Stable identifier for a HID device. Format: VID_<hex>_PID_<hex>[_<serial>].

func (*DeviceID) UnmarshalJSON

func (j *DeviceID) UnmarshalJSON(value []byte) error

UnmarshalJSON implements json.Unmarshaler.

type DuplicateProfileSchemaJson added in v0.4.0

type DuplicateProfileSchemaJson struct {
	// Params corresponds to the JSON schema field "params".
	Params DuplicateProfileSchemaJsonParams `json:"params" yaml:"params" mapstructure:"params"`

	// Result corresponds to the JSON schema field "result".
	Result DuplicateProfileSchemaJsonResult `json:"result" yaml:"result" mapstructure:"result"`
}

Creates a copy of an existing profile under a new name. The server generates a new id and copies the source profile's bindings. Does not change the active profile.

func (*DuplicateProfileSchemaJson) UnmarshalJSON added in v0.4.0

func (j *DuplicateProfileSchemaJson) UnmarshalJSON(value []byte) error

UnmarshalJSON implements json.Unmarshaler.

type DuplicateProfileSchemaJsonParams added in v0.4.0

type DuplicateProfileSchemaJsonParams struct {
	// Identifier of the source profile to copy bindings from.
	Id string `json:"id" yaml:"id" mapstructure:"id"`

	// Human-friendly name for the new (duplicated) profile.
	Name string `json:"name" yaml:"name" mapstructure:"name"`
}

func (*DuplicateProfileSchemaJsonParams) UnmarshalJSON added in v0.4.0

func (j *DuplicateProfileSchemaJsonParams) UnmarshalJSON(value []byte) error

UnmarshalJSON implements json.Unmarshaler.

type DuplicateProfileSchemaJsonResult added in v0.4.0

type DuplicateProfileSchemaJsonResult struct {
	// Profile corresponds to the JSON schema field "profile".
	Profile Profile `json:"profile" yaml:"profile" mapstructure:"profile"`
}

func (*DuplicateProfileSchemaJsonResult) UnmarshalJSON added in v0.4.0

func (j *DuplicateProfileSchemaJsonResult) UnmarshalJSON(value []byte) error

UnmarshalJSON implements json.Unmarshaler.

type Error

type Error struct {
	// Stable, machine-readable error code in SCREAMING_SNAKE_CASE.
	Code string `json:"code" yaml:"code" mapstructure:"code"`

	// Optional structured context for debugging.
	Details ErrorDetails `json:"details,omitempty,omitzero" yaml:"details,omitempty" mapstructure:"details,omitempty"`

	// Human-readable error message. Free form, may be localized in future versions.
	Message string `json:"message" yaml:"message" mapstructure:"message"`
}

Failure payload returned in a Response with ok=false.

func (*Error) UnmarshalJSON

func (j *Error) UnmarshalJSON(value []byte) error

UnmarshalJSON implements json.Unmarshaler.

type ErrorDetails

type ErrorDetails map[string]interface{}

Optional structured context for debugging.

type Event

type Event struct {
	// Event-specific payload. Refined by the schema in
	// schemas/events/<name>.schema.json.
	Data EventData `json:"data" yaml:"data" mapstructure:"data"`

	// Event name in snake_case.
	Name string `json:"name" yaml:"name" mapstructure:"name"`

	// Type corresponds to the JSON schema field "type".
	Type interface{} `json:"type" yaml:"type" mapstructure:"type"`
}

Server -> client, no correlation. Stream of hardware events or daemon notifications.

func (*Event) UnmarshalJSON

func (j *Event) UnmarshalJSON(value []byte) error

UnmarshalJSON implements json.Unmarshaler.

type EventData

type EventData map[string]interface{}

Event-specific payload. Refined by the schema in schemas/events/<name>.schema.json.

type GetAutoSwitchSchemaJson added in v0.6.0

type GetAutoSwitchSchemaJson struct {
	// No parameters in v1.
	Params GetAutoSwitchSchemaJsonParams `json:"params" yaml:"params" mapstructure:"params"`

	// Result corresponds to the JSON schema field "result".
	Result GetAutoSwitchSchemaJsonResult `json:"result" yaml:"result" mapstructure:"result"`
}

Returns the current auto-switch configuration: the master toggle and the full set of app-to-profile rules. The daemon uses these to switch the active profile based on the foreground application.

func (*GetAutoSwitchSchemaJson) UnmarshalJSON added in v0.6.0

func (j *GetAutoSwitchSchemaJson) UnmarshalJSON(value []byte) error

UnmarshalJSON implements json.Unmarshaler.

type GetAutoSwitchSchemaJsonParams added in v0.6.0

type GetAutoSwitchSchemaJsonParams map[string]interface{}

No parameters in v1.

type GetAutoSwitchSchemaJsonResult added in v0.6.0

type GetAutoSwitchSchemaJsonResult struct {
	// Master toggle. When false, the daemon ignores the rules and never
	// auto-switches.
	Enabled bool `json:"enabled" yaml:"enabled" mapstructure:"enabled"`

	// App-to-profile rules currently configured.
	Rules []AutoSwitchRule `json:"rules" yaml:"rules" mapstructure:"rules"`
}

func (*GetAutoSwitchSchemaJsonResult) UnmarshalJSON added in v0.6.0

func (j *GetAutoSwitchSchemaJsonResult) UnmarshalJSON(value []byte) error

UnmarshalJSON implements json.Unmarshaler.

type HelloSchemaJson

type HelloSchemaJson struct {
	// Params corresponds to the JSON schema field "params".
	Params HelloSchemaJsonParams `json:"params" yaml:"params" mapstructure:"params"`

	// Result corresponds to the JSON schema field "result".
	Result HelloSchemaJsonResult `json:"result" yaml:"result" mapstructure:"result"`
}

Mandatory first request after a WebSocket connection is established. The client declares the protocol_version it speaks. The server either accepts (Response.ok=true with its own identification) or closes the connection with an UNSUPPORTED_PROTOCOL_VERSION error. After a successful hello no further version negotiation happens; the contract is fixed for the session.

func (*HelloSchemaJson) UnmarshalJSON

func (j *HelloSchemaJson) UnmarshalJSON(value []byte) error

UnmarshalJSON implements json.Unmarshaler.

type HelloSchemaJsonParams

type HelloSchemaJsonParams struct {
	// Client corresponds to the JSON schema field "client".
	Client PeerInfo `json:"client" yaml:"client" mapstructure:"client"`

	// Major version of the protocol the client implements. Currently '1'.
	ProtocolVersion string `json:"protocol_version" yaml:"protocol_version" mapstructure:"protocol_version"`
}

func (*HelloSchemaJsonParams) UnmarshalJSON

func (j *HelloSchemaJsonParams) UnmarshalJSON(value []byte) error

UnmarshalJSON implements json.Unmarshaler.

type HelloSchemaJsonResult

type HelloSchemaJsonResult struct {
	// Protocol version the server agrees to speak for this session.
	ProtocolVersion string `json:"protocol_version" yaml:"protocol_version" mapstructure:"protocol_version"`

	// Server corresponds to the JSON schema field "server".
	Server PeerInfo `json:"server" yaml:"server" mapstructure:"server"`
}

func (*HelloSchemaJsonResult) UnmarshalJSON

func (j *HelloSchemaJsonResult) UnmarshalJSON(value []byte) error

UnmarshalJSON implements json.Unmarshaler.

type Input added in v0.3.0

type Input struct {
	// Logical identifier of the input within the device (e.g. 'key_0x04',
	// 'encoder_0'). Matches InputEvent.input_id and Binding.input_id.
	Id string `json:"id" yaml:"id" mapstructure:"id"`

	// Kind corresponds to the JSON schema field "kind".
	Kind InputKind `json:"kind" yaml:"kind" mapstructure:"kind"`

	// Human-friendly label for the input (e.g. 'Key 1', 'Encoder'). Optional; clients
	// fall back to id.
	Label *string `json:"label,omitempty,omitzero" yaml:"label,omitempty" mapstructure:"label,omitempty"`
}

A single physical input exposed by a device (a key or an encoder).

func (*Input) UnmarshalJSON added in v0.3.0

func (j *Input) UnmarshalJSON(value []byte) error

UnmarshalJSON implements json.Unmarshaler.

type InputAction

type InputAction string
const InputActionClick InputAction = "click"
const InputActionPress InputAction = "press"
const InputActionRelease InputAction = "release"
const InputActionRotateCcw InputAction = "rotate_ccw"
const InputActionRotateCw InputAction = "rotate_cw"

func (*InputAction) UnmarshalJSON

func (j *InputAction) UnmarshalJSON(value []byte) error

UnmarshalJSON implements json.Unmarshaler.

type InputEvent

type InputEvent struct {
	// Action corresponds to the JSON schema field "action".
	Action InputAction `json:"action" yaml:"action" mapstructure:"action"`

	// DeviceId corresponds to the JSON schema field "device_id".
	DeviceId DeviceID `json:"device_id" yaml:"device_id" mapstructure:"device_id"`

	// Logical identifier of the input within the device (e.g. 'key_0x04',
	// 'encoder_0'). Matches Device.inputs[].id.
	InputId string `json:"input_id" yaml:"input_id" mapstructure:"input_id"`

	// Kind corresponds to the JSON schema field "kind".
	Kind InputKind `json:"kind" yaml:"kind" mapstructure:"kind"`

	// Unix epoch in milliseconds when the event was captured by the daemon.
	TimestampMs int `json:"timestamp_ms" yaml:"timestamp_ms" mapstructure:"timestamp_ms"`
}

A single hardware event coming from a HID device.

func (*InputEvent) UnmarshalJSON

func (j *InputEvent) UnmarshalJSON(value []byte) error

UnmarshalJSON implements json.Unmarshaler.

type InputKind

type InputKind string
const InputKindEncoder InputKind = "encoder"
const InputKindKey InputKind = "key"

func (*InputKind) UnmarshalJSON

func (j *InputKind) UnmarshalJSON(value []byte) error

UnmarshalJSON implements json.Unmarshaler.

type InputSchemaJson

type InputSchemaJson struct {
	// Data corresponds to the JSON schema field "data".
	Data InputEvent `json:"data" yaml:"data" mapstructure:"data"`
}

Pushed by the daemon for every hardware event captured on a connected HID device. High-frequency: encoders may emit many per second.

func (*InputSchemaJson) UnmarshalJSON

func (j *InputSchemaJson) UnmarshalJSON(value []byte) error

UnmarshalJSON implements json.Unmarshaler.

type ListActionsSchemaJson added in v0.3.0

type ListActionsSchemaJson struct {
	// No parameters in v1.
	Params ListActionsSchemaJsonParams `json:"params" yaml:"params" mapstructure:"params"`

	// Result corresponds to the JSON schema field "result".
	Result ListActionsSchemaJsonResult `json:"result" yaml:"result" mapstructure:"result"`
}

Returns the catalog of actions the daemon can bind to inputs, including the param shape each action needs so a client can render a config form. No params in v1.

func (*ListActionsSchemaJson) UnmarshalJSON added in v0.3.0

func (j *ListActionsSchemaJson) UnmarshalJSON(value []byte) error

UnmarshalJSON implements json.Unmarshaler.

type ListActionsSchemaJsonParams added in v0.3.0

type ListActionsSchemaJsonParams map[string]interface{}

No parameters in v1.

type ListActionsSchemaJsonResult added in v0.3.0

type ListActionsSchemaJsonResult struct {
	// All actions available to bind. Built-ins plus any registered plugin actions.
	Actions []ActionDescriptor `json:"actions" yaml:"actions" mapstructure:"actions"`
}

func (*ListActionsSchemaJsonResult) UnmarshalJSON added in v0.3.0

func (j *ListActionsSchemaJsonResult) UnmarshalJSON(value []byte) error

UnmarshalJSON implements json.Unmarshaler.

type ListBindingsSchemaJson added in v0.3.0

type ListBindingsSchemaJson struct {
	// No parameters in v1.
	Params ListBindingsSchemaJsonParams `json:"params" yaml:"params" mapstructure:"params"`

	// Result corresponds to the JSON schema field "result".
	Result ListBindingsSchemaJsonResult `json:"result" yaml:"result" mapstructure:"result"`
}

Returns all bindings the daemon currently has configured. Read-side counterpart of set_binding. No filters in v1; clients filter client-side if needed.

func (*ListBindingsSchemaJson) UnmarshalJSON added in v0.3.0

func (j *ListBindingsSchemaJson) UnmarshalJSON(value []byte) error

UnmarshalJSON implements json.Unmarshaler.

type ListBindingsSchemaJsonParams added in v0.3.0

type ListBindingsSchemaJsonParams map[string]interface{}

No parameters in v1.

type ListBindingsSchemaJsonResult added in v0.3.0

type ListBindingsSchemaJsonResult struct {
	// All currently configured bindings.
	Bindings []Binding `json:"bindings" yaml:"bindings" mapstructure:"bindings"`
}

func (*ListBindingsSchemaJsonResult) UnmarshalJSON added in v0.3.0

func (j *ListBindingsSchemaJsonResult) UnmarshalJSON(value []byte) error

UnmarshalJSON implements json.Unmarshaler.

type ListDevicesSchemaJson

type ListDevicesSchemaJson struct {
	// No parameters in v1.
	Params ListDevicesSchemaJsonParams `json:"params" yaml:"params" mapstructure:"params"`

	// Result corresponds to the JSON schema field "result".
	Result ListDevicesSchemaJsonResult `json:"result" yaml:"result" mapstructure:"result"`
}

Returns the HID devices currently known to the daemon. No filters in v1; clients filter client-side if needed.

func (*ListDevicesSchemaJson) UnmarshalJSON

func (j *ListDevicesSchemaJson) UnmarshalJSON(value []byte) error

UnmarshalJSON implements json.Unmarshaler.

type ListDevicesSchemaJsonParams

type ListDevicesSchemaJsonParams map[string]interface{}

No parameters in v1.

type ListDevicesSchemaJsonResult

type ListDevicesSchemaJsonResult struct {
	// All currently enumerated HID devices.
	Devices []Device `json:"devices" yaml:"devices" mapstructure:"devices"`
}

func (*ListDevicesSchemaJsonResult) UnmarshalJSON

func (j *ListDevicesSchemaJsonResult) UnmarshalJSON(value []byte) error

UnmarshalJSON implements json.Unmarshaler.

type ListProfilesSchemaJson added in v0.4.0

type ListProfilesSchemaJson struct {
	// No parameters in v1.
	Params ListProfilesSchemaJsonParams `json:"params" yaml:"params" mapstructure:"params"`

	// Result corresponds to the JSON schema field "result".
	Result ListProfilesSchemaJsonResult `json:"result" yaml:"result" mapstructure:"result"`
}

Returns all profiles the daemon currently has, along with the id of the active one. The active profile id is tracked at the daemon level and only exposed here.

func (*ListProfilesSchemaJson) UnmarshalJSON added in v0.4.0

func (j *ListProfilesSchemaJson) UnmarshalJSON(value []byte) error

UnmarshalJSON implements json.Unmarshaler.

type ListProfilesSchemaJsonParams added in v0.4.0

type ListProfilesSchemaJsonParams map[string]interface{}

No parameters in v1.

type ListProfilesSchemaJsonResult added in v0.4.0

type ListProfilesSchemaJsonResult struct {
	// Identifier of the currently active profile. Always references one of the
	// profiles in the array.
	ActiveProfileId string `json:"active_profile_id" yaml:"active_profile_id" mapstructure:"active_profile_id"`

	// All profiles known to the daemon.
	Profiles []Profile `json:"profiles" yaml:"profiles" mapstructure:"profiles"`
}

func (*ListProfilesSchemaJsonResult) UnmarshalJSON added in v0.4.0

func (j *ListProfilesSchemaJsonResult) UnmarshalJSON(value []byte) error

UnmarshalJSON implements json.Unmarshaler.

type ParamSpec added in v0.3.0

type ParamSpec struct {
	// Human-friendly field label.
	Label string `json:"label" yaml:"label" mapstructure:"label"`

	// Param key written into Action.params.
	Name string `json:"name" yaml:"name" mapstructure:"name"`

	// Optional placeholder/example shown in the input.
	Placeholder *string `json:"placeholder,omitempty,omitzero" yaml:"placeholder,omitempty" mapstructure:"placeholder,omitempty"`

	// Required corresponds to the JSON schema field "required".
	Required bool `json:"required" yaml:"required" mapstructure:"required"`

	// Param value type. Only 'string' in v1.
	Type ParamSpecType `json:"type" yaml:"type" mapstructure:"type"`
}

Describes one action parameter so a client can render an input for it.

func (*ParamSpec) UnmarshalJSON added in v0.3.0

func (j *ParamSpec) UnmarshalJSON(value []byte) error

UnmarshalJSON implements json.Unmarshaler.

type ParamSpecType added in v0.3.0

type ParamSpecType string
const ParamSpecTypeString ParamSpecType = "string"

func (*ParamSpecType) UnmarshalJSON added in v0.3.0

func (j *ParamSpecType) UnmarshalJSON(value []byte) error

UnmarshalJSON implements json.Unmarshaler.

type PeerInfo

type PeerInfo struct {
	// Stable identifier of the peer implementation.
	Name string `json:"name" yaml:"name" mapstructure:"name"`

	// Semver version of the peer build.
	Version string `json:"version" yaml:"version" mapstructure:"version"`
}

Self-identification of a protocol peer (client or server).

func (*PeerInfo) UnmarshalJSON

func (j *PeerInfo) UnmarshalJSON(value []byte) error

UnmarshalJSON implements json.Unmarshaler.

type Profile added in v0.4.0

type Profile struct {
	// Bindings that belong to this profile.
	Bindings []Binding `json:"bindings" yaml:"bindings" mapstructure:"bindings"`

	// Stable server-generated identifier for the profile.
	Id string `json:"id" yaml:"id" mapstructure:"id"`

	// Human-friendly profile name.
	Name string `json:"name" yaml:"name" mapstructure:"name"`
}

A named set of bindings. The daemon keeps exactly one profile active at a time; switching profiles swaps the active binding set.

func (*Profile) UnmarshalJSON added in v0.4.0

func (j *Profile) UnmarshalJSON(value []byte) error

UnmarshalJSON implements json.Unmarshaler.

type RenameProfileSchemaJson added in v0.4.0

type RenameProfileSchemaJson struct {
	// Params corresponds to the JSON schema field "params".
	Params RenameProfileSchemaJsonParams `json:"params" yaml:"params" mapstructure:"params"`

	// Empty acknowledgement object. Reserved for future fields without breaking the
	// schema.
	Result RenameProfileSchemaJsonResult `json:"result" yaml:"result" mapstructure:"result"`
}

Renames an existing profile. Does not affect its bindings or the active profile.

func (*RenameProfileSchemaJson) UnmarshalJSON added in v0.4.0

func (j *RenameProfileSchemaJson) UnmarshalJSON(value []byte) error

UnmarshalJSON implements json.Unmarshaler.

type RenameProfileSchemaJsonParams added in v0.4.0

type RenameProfileSchemaJsonParams struct {
	// Identifier of the profile to rename.
	Id string `json:"id" yaml:"id" mapstructure:"id"`

	// New human-friendly name for the profile.
	Name string `json:"name" yaml:"name" mapstructure:"name"`
}

func (*RenameProfileSchemaJsonParams) UnmarshalJSON added in v0.4.0

func (j *RenameProfileSchemaJsonParams) UnmarshalJSON(value []byte) error

UnmarshalJSON implements json.Unmarshaler.

type RenameProfileSchemaJsonResult added in v0.4.0

type RenameProfileSchemaJsonResult map[string]interface{}

Empty acknowledgement object. Reserved for future fields without breaking the schema.

type Request

type Request struct {
	// Client-generated correlation id (UUID v4 or nanoid).
	Id string `json:"id" yaml:"id" mapstructure:"id"`

	// Method name in snake_case.
	Method string `json:"method" yaml:"method" mapstructure:"method"`

	// Method-specific arguments. Refined by the schema in
	// schemas/methods/<method>.schema.json.
	Params RequestParams `json:"params" yaml:"params" mapstructure:"params"`

	// Type corresponds to the JSON schema field "type".
	Type interface{} `json:"type" yaml:"type" mapstructure:"type"`
}

Client -> server. Expects a correlated Response with the same id.

func (*Request) UnmarshalJSON

func (j *Request) UnmarshalJSON(value []byte) error

UnmarshalJSON implements json.Unmarshaler.

type RequestParams

type RequestParams map[string]interface{}

Method-specific arguments. Refined by the schema in schemas/methods/<method>.schema.json.

type Response

type Response map[string]interface{}

Server -> client. Discriminated by 'ok'.

type ResponseErr

type ResponseErr struct {
	// Error corresponds to the JSON schema field "error".
	Error Error `json:"error" yaml:"error" mapstructure:"error"`

	// Echo of the original Request.id.
	Id string `json:"id" yaml:"id" mapstructure:"id"`

	// Ok corresponds to the JSON schema field "ok".
	Ok interface{} `json:"ok" yaml:"ok" mapstructure:"ok"`

	// Type corresponds to the JSON schema field "type".
	Type interface{} `json:"type" yaml:"type" mapstructure:"type"`
}

func (*ResponseErr) UnmarshalJSON

func (j *ResponseErr) UnmarshalJSON(value []byte) error

UnmarshalJSON implements json.Unmarshaler.

type ResponseOk

type ResponseOk struct {
	// Method-specific result. Refined by the schema in
	// schemas/methods/<method>.schema.json.
	Data ResponseOkData `json:"data" yaml:"data" mapstructure:"data"`

	// Echo of the original Request.id.
	Id string `json:"id" yaml:"id" mapstructure:"id"`

	// Ok corresponds to the JSON schema field "ok".
	Ok interface{} `json:"ok" yaml:"ok" mapstructure:"ok"`

	// Type corresponds to the JSON schema field "type".
	Type interface{} `json:"type" yaml:"type" mapstructure:"type"`
}

func (*ResponseOk) UnmarshalJSON

func (j *ResponseOk) UnmarshalJSON(value []byte) error

UnmarshalJSON implements json.Unmarshaler.

type ResponseOkData

type ResponseOkData map[string]interface{}

Method-specific result. Refined by the schema in schemas/methods/<method>.schema.json.

type SetActiveProfileSchemaJson added in v0.5.0

type SetActiveProfileSchemaJson struct {
	// Params corresponds to the JSON schema field "params".
	Params SetActiveProfileSchemaJsonParams `json:"params" yaml:"params" mapstructure:"params"`

	// Result corresponds to the JSON schema field "result".
	Result SetActiveProfileSchemaJsonResult `json:"result" yaml:"result" mapstructure:"result"`
}

Sets which profile is active. The active profile is the one the binding editor reads and writes; switching it swaps the live binding set.

func (*SetActiveProfileSchemaJson) UnmarshalJSON added in v0.5.0

func (j *SetActiveProfileSchemaJson) UnmarshalJSON(value []byte) error

UnmarshalJSON implements json.Unmarshaler.

type SetActiveProfileSchemaJsonParams added in v0.5.0

type SetActiveProfileSchemaJsonParams struct {
	// Identifier of the profile to activate.
	Id string `json:"id" yaml:"id" mapstructure:"id"`
}

func (*SetActiveProfileSchemaJsonParams) UnmarshalJSON added in v0.5.0

func (j *SetActiveProfileSchemaJsonParams) UnmarshalJSON(value []byte) error

UnmarshalJSON implements json.Unmarshaler.

type SetActiveProfileSchemaJsonResult added in v0.5.0

type SetActiveProfileSchemaJsonResult struct {
	// Identifier of the now-active profile. Echoes the requested id on success.
	ActiveProfileId string `json:"active_profile_id" yaml:"active_profile_id" mapstructure:"active_profile_id"`
}

func (*SetActiveProfileSchemaJsonResult) UnmarshalJSON added in v0.5.0

func (j *SetActiveProfileSchemaJsonResult) UnmarshalJSON(value []byte) error

UnmarshalJSON implements json.Unmarshaler.

type SetAutoSwitchSchemaJson added in v0.6.0

type SetAutoSwitchSchemaJson struct {
	// Params corresponds to the JSON schema field "params".
	Params SetAutoSwitchSchemaJsonParams `json:"params" yaml:"params" mapstructure:"params"`

	// Result corresponds to the JSON schema field "result".
	Result SetAutoSwitchSchemaJsonResult `json:"result" yaml:"result" mapstructure:"result"`
}

Replaces the entire auto-switch configuration in one shot (bulk set, not per-rule CRUD): the master toggle and the full rule set. The result echoes the persisted state.

func (*SetAutoSwitchSchemaJson) UnmarshalJSON added in v0.6.0

func (j *SetAutoSwitchSchemaJson) UnmarshalJSON(value []byte) error

UnmarshalJSON implements json.Unmarshaler.

type SetAutoSwitchSchemaJsonParams added in v0.6.0

type SetAutoSwitchSchemaJsonParams struct {
	// Master toggle. When false, the daemon ignores the rules and never
	// auto-switches.
	Enabled bool `json:"enabled" yaml:"enabled" mapstructure:"enabled"`

	// Full replacement set of app-to-profile rules. Any previously stored rules are
	// discarded.
	Rules []AutoSwitchRule `json:"rules" yaml:"rules" mapstructure:"rules"`
}

func (*SetAutoSwitchSchemaJsonParams) UnmarshalJSON added in v0.6.0

func (j *SetAutoSwitchSchemaJsonParams) UnmarshalJSON(value []byte) error

UnmarshalJSON implements json.Unmarshaler.

type SetAutoSwitchSchemaJsonResult added in v0.6.0

type SetAutoSwitchSchemaJsonResult struct {
	// Master toggle as persisted. Echoes the requested value on success.
	Enabled bool `json:"enabled" yaml:"enabled" mapstructure:"enabled"`

	// Rules as persisted. Echoes the requested set on success.
	Rules []AutoSwitchRule `json:"rules" yaml:"rules" mapstructure:"rules"`
}

func (*SetAutoSwitchSchemaJsonResult) UnmarshalJSON added in v0.6.0

func (j *SetAutoSwitchSchemaJsonResult) UnmarshalJSON(value []byte) error

UnmarshalJSON implements json.Unmarshaler.

type SetBindingSchemaJson

type SetBindingSchemaJson struct {
	// Params corresponds to the JSON schema field "params".
	Params SetBindingSchemaJsonParams `json:"params" yaml:"params" mapstructure:"params"`

	// Empty acknowledgement object. Reserved for future fields (e.g. server-assigned
	// binding id) without breaking the schema.
	Result SetBindingSchemaJsonResult `json:"result" yaml:"result" mapstructure:"result"`
}

Creates or updates a binding (input -> action) on a device. The pair (device_id, input_id, trigger) is the unique key; calling this method with an existing key replaces the previous action.

func (*SetBindingSchemaJson) UnmarshalJSON

func (j *SetBindingSchemaJson) UnmarshalJSON(value []byte) error

UnmarshalJSON implements json.Unmarshaler.

type SetBindingSchemaJsonParams

type SetBindingSchemaJsonParams struct {
	// Binding corresponds to the JSON schema field "binding".
	Binding Binding `json:"binding" yaml:"binding" mapstructure:"binding"`
}

func (*SetBindingSchemaJsonParams) UnmarshalJSON

func (j *SetBindingSchemaJsonParams) UnmarshalJSON(value []byte) error

UnmarshalJSON implements json.Unmarshaler.

type SetBindingSchemaJsonResult

type SetBindingSchemaJsonResult map[string]interface{}

Empty acknowledgement object. Reserved for future fields (e.g. server-assigned binding id) without breaking the schema.

Jump to

Keyboard shortcuts

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