rest

package
v1.3.1 Latest Latest
Warning

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

Go to latest
Published: Jul 21, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultAddr = ":8080"

DefaultAddr is the shared HTTP listen address.

Variables

This section is empty.

Functions

func API

func API() *echo.Echo

API returns the shared Echo instance, building it on first call.

func Addr

func Addr() string

Addr returns the listen address, or "" if not started.

func EnsureBackground

func EnsureBackground(addr string) error

EnsureBackground starts the REST server in a goroutine if not already running.

func OnAPI

func OnAPI(fn func(*echo.Echo))

OnAPI registers routes on the shared Echo instance at first use.

func OnFeatures

func OnFeatures(fn func() Features)

OnFeatures registers a provider called when /features is queried.

func Running

func Running() bool

Running reports whether the REST server is active.

func SetConnect

func SetConnect(connect func(ui.UI))

SetConnect registers the terminal session handler before the REST server starts.

func StartBlocking

func StartBlocking(addr string) error

StartBlocking runs the REST server on the main goroutine (blocks).

func StartWeb

func StartWeb(connect func(ui.UI)) error

StartWeb runs the REST server and calls connect for each new browser client (blocks).

Types

type Features

type Features struct {
	Terminal bool `json:"terminal"`
	Graph    bool `json:"graph"`
}

Features reports which optional REST capabilities are active.

type Session

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

Session is one persistent REST client's stdin/stdout as ui.UI.

func (*Session) Print

func (s *Session) Print(a ...any)

func (*Session) Printf

func (s *Session) Printf(format string, a ...any)

func (*Session) Println

func (s *Session) Println(a ...any)

func (*Session) Prompt

func (s *Session) Prompt(prompt string) string

Jump to

Keyboard shortcuts

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