types

package
v1.0.0-rc.50 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Action

type Action struct {
	Title    string  `json:"title,omitempty"`
	Key      string  `json:"key,omitempty"`
	OnAction Command `json:"onAction,omitempty"`
}

type Application

type Application struct {
	Windows string `json:"windows,omitempty"`
	Mac     string `json:"mac,omitempty"`
	Linux   string `json:"linux,omitempty"`
}

type Command

type Command struct {
	Type CommandType `json:"type,omitempty"`

	Text string `json:"text,omitempty"`

	App    Application `json:"app,omitempty"`
	Target string      `json:"target,omitempty"`

	Exit bool `json:"exit,omitempty"`

	Reload bool `json:"reload,omitempty"`

	Extension string         `json:"extension,omitempty"`
	Command   string         `json:"command,omitempty"`
	Params    map[string]any `json:"params,omitempty"`
}

TODO: move distinct types to their own structs

type CommandInput

type CommandInput struct {
	Params   map[string]any `json:"params"`
	FormData map[string]any `json:"formData,omitempty"`
	Query    string         `json:"query,omitempty"`
	WorkDir  string         `json:"workDir,omitempty"`
}

type CommandMode

type CommandMode string
const (
	CommandModeView   CommandMode = "view"
	CommandModeNoView CommandMode = "no-view"
	CommandModeTTY    CommandMode = "tty"
)

type CommandRef

type CommandRef struct {
	Extension string         `json:"extension,omitempty"`
	Command   string         `json:"command,omitempty"`
	Params    map[string]any `json:"params,omitempty"`
}

type CommandSpec

type CommandSpec struct {
	Name   string      `json:"name"`
	Title  string      `json:"title"`
	Hidden bool        `json:"hidden,omitempty"`
	Params []Param     `json:"params,omitempty"`
	Mode   CommandMode `json:"mode,omitempty"`
}

type CommandType

type CommandType string
const (
	CommandTypeRun    CommandType = "run"
	CommandTypeOpen   CommandType = "open"
	CommandTypeCopy   CommandType = "copy"
	CommandTypeReload CommandType = "reload"
	CommandTypeExit   CommandType = "exit"
	CommandTypePop    CommandType = "pop"
)

type Detail

type Detail struct {
	Title    string   `json:"title,omitempty"`
	Actions  []Action `json:"actions,omitempty"`
	Markdown string   `json:"markdown,omitempty"`
}

func (Detail) MarshalJSON

func (d Detail) MarshalJSON() ([]byte, error)
type DropDownItem struct {
	Title string `json:"title"`
	Value string `json:"value"`
}

type Field

type Field struct {
	Title    string `json:"title"`
	Name     string `json:"name,omitempty"`
	Required bool   `json:"required,omitempty"`
	Input    `json:"input"`
}

type Form

type Form struct {
	Title  string  `json:"title,omitempty"`
	Fields []Field `json:"fields,omitempty"`
}

func (Form) MarshalJSON

func (f Form) MarshalJSON() ([]byte, error)

type Input

type Input struct {
	Type        InputType `json:"type"`
	Placeholder string    `json:"placeholder,omitempty"`
	Default     any       `json:"default,omitempty"`

	// Only for dropdown
	Choices []DropDownItem `json:"choices,omitempty"`

	// Only for checkbox
	Label string `json:"label,omitempty"`
}

TODO: move distinct types to their own structs

type InputType

type InputType string
const (
	TextInput     InputType = "text"
	TextAreaInput InputType = "textarea"
	SelectInput   InputType = "select"
	CheckboxInput InputType = "checkbox"
)

type List

type List struct {
	Title     string     `json:"title,omitempty"`
	Items     []ListItem `json:"items,omitempty"`
	Dynamic   bool       `json:"dynamic,omitempty"`
	EmptyText string     `json:"emptyText,omitempty"`
	Actions   []Action   `json:"actions,omitempty"`
}

func (List) MarshalJSON

func (l List) MarshalJSON() ([]byte, error)

type ListItem

type ListItem struct {
	Id          string   `json:"id,omitempty"`
	Title       string   `json:"title"`
	Subtitle    string   `json:"subtitle,omitempty"`
	Accessories []string `json:"accessories,omitempty"`
	Actions     []Action `json:"actions,omitempty"`
}

type Manifest

type Manifest struct {
	Title       string        `json:"title"`
	Description string        `json:"description,omitempty"`
	Commands    []CommandSpec `json:"commands"`
}

type Metadata

type Metadata struct {
	Title  string `json:"title,omitempty"`
	Text   string `json:"text,omitempty"`
	Target string `json:"target,omitempty"`
}

type Param

type Param struct {
	Name        string    `json:"name"`
	Type        ParamType `json:"type"`
	Description string    `json:"description,omitempty"`
	Required    bool      `json:"required,omitempty"`
	Default     any       `json:"default,omitempty"`
}

type ParamType

type ParamType string
const (
	ParamTypeString  ParamType = "string"
	ParamTypeBoolean ParamType = "boolean"
	ParamTypeNumber  ParamType = "number"
)

type View

type View struct {
	Type  ViewType `json:"type"`
	Title string   `json:"title,omitempty"`
}

type ViewType

type ViewType string
const (
	ViewTypeList   ViewType = "list"
	ViewTypeForm   ViewType = "form"
	ViewTypeDetail ViewType = "detail"
)

Jump to

Keyboard shortcuts

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