api

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2026 License: MIT Imports: 12 Imported by: 0 modules, 0 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

Overview

Package api defines the daemon's unix-socket JSON API and a client for it.

Index

Constants

This section is empty.

Variables

View Source
var ErrDaemonDown = errors.New("wtg daemon is not running")

ErrDaemonDown is returned when nothing listens on the socket.

Functions

This section is empty.

Types

type Client

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

Client talks to the daemon over its unix socket.

func NewClient

func NewClient(socket string) *Client

NewClient returns a client for socket.

func (*Client) Do

func (c *Client) Do(method, path string, query url.Values, in, out any) error

Do sends a request; in and out may be nil.

func (*Client) Ping

func (c *Client) Ping() bool

Ping reports whether the daemon answers.

type DeregisterRequest

type DeregisterRequest struct {
	Path    string `json:"path"`
	Service string `json:"service"`
	PID     int    `json:"pid,omitempty"`
}

type DownRequest

type DownRequest struct {
	Path   string `json:"path"`
	Forget bool   `json:"forget,omitempty"`
}

type EnvRequest

type EnvRequest struct {
	Path    string `json:"path"`
	Service string `json:"service,omitempty"`
	Port    int    `json:"port,omitempty"`
}

type OAuthStateRequest

type OAuthStateRequest struct {
	Path         string        `json:"path"`
	Service      string        `json:"service"`
	CallbackPath string        `json:"callback_path"`
	State        string        `json:"state,omitempty"`
	TTL          time.Duration `json:"ttl,omitempty"`
}

type OAuthStateResponse

type OAuthStateResponse struct {
	State       string `json:"state"`
	RedirectURI string `json:"redirect_uri"`
	Destination string `json:"destination"`
}

type PortRequest

type PortRequest struct {
	Path    string `json:"path"`
	Service string `json:"service"`
}

type PortResponse

type PortResponse struct {
	Port int `json:"port"`
}

type RegisterRequest

type RegisterRequest struct {
	Path    string `json:"path"`
	Service string `json:"service"`
	Host    string `json:"host,omitempty"`
	Port    int    `json:"port"`
	PID     int    `json:"pid,omitempty"`
	Source  string `json:"source,omitempty"`
}

type RegisterResponse

type RegisterResponse struct {
	Worktree WorktreeView `json:"worktree"`
	Service  ServiceView  `json:"service"`
	Evicted  []string     `json:"evicted,omitempty"`
}

type ReplayRequest

type ReplayRequest struct {
	To  string `json:"to,omitempty"`
	Yes bool   `json:"yes,omitempty"`
}

type RequestList

type RequestList struct {
	Requests []capture.Entry `json:"requests"`
}

type ServiceView

type ServiceView struct {
	Name       string   `json:"name"`
	Status     string   `json:"status"` // up | down | starting | missing
	Upstream   string   `json:"upstream,omitempty"`
	Port       int      `json:"port,omitempty"`
	PID        int      `json:"pid,omitempty"`
	Source     string   `json:"source,omitempty"`
	URLs       []string `json:"urls"`
	Public     []string `json:"public_paths,omitempty"`
	Configured bool     `json:"configured"`
	Conflict   string   `json:"conflict,omitempty"`
}

type Status

type Status struct {
	Version    string         `json:"version"`
	PID        int            `json:"pid"`
	Started    time.Time      `json:"started"`
	StateDir   string         `json:"state_dir"`
	HTTP       string         `json:"http"`
	HTTPS      string         `json:"https,omitempty"`
	Ingress    string         `json:"ingress"`
	Proxy      string         `json:"proxy"`
	ProxyError string         `json:"proxy_error,omitempty"`
	Tunnel     tunnel.Status  `json:"tunnel"`
	Worktrees  []WorktreeView `json:"worktrees"`
}

type TunnelRequest

type TunnelRequest struct {
	Provider string `json:"provider,omitempty"`
}

type UpRequest

type UpRequest struct {
	Path string `json:"path"`
	Name string `json:"name,omitempty"`
}

type WorktreeView

type WorktreeView struct {
	ID            string        `json:"id"`
	Project       string        `json:"project"`
	ProjectDomain string        `json:"project_domain"`
	Slug          string        `json:"slug"`
	Branch        string        `json:"branch"`
	Path          string        `json:"path"`
	IsMain        bool          `json:"is_main"`
	Parked        bool          `json:"parked,omitempty"`
	PublicURL     string        `json:"public_url,omitempty"`
	ConfigFile    string        `json:"config_file,omitempty"`
	Services      []ServiceView `json:"services"`
}

Jump to

Keyboard shortcuts

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