client

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithTimeout

func WithTimeout(timeout time.Duration) (context.Context, context.CancelFunc)

WithTimeout is a helper to create a context with timeout.

Types

type AddOptions

type AddOptions struct {
	Name            string
	Path            string
	AutoStart       bool
	Port            int
	CreateIfMissing bool // Create directory if it doesn't exist
}

AddOptions contains options for adding a workspace.

type Client

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

Client is a JSON-RPC 2.0 client for WebSocket communication.

func NewClient

func NewClient(url string) (*Client, error)

NewClient creates a new JSON-RPC client connected to the given WebSocket URL.

func (*Client) Call

func (c *Client) Call(ctx context.Context, method string, params interface{}) (*message.Response, error)

Call makes a JSON-RPC call and waits for the response.

func (*Client) Close

func (c *Client) Close() error

Close closes the WebSocket connection.

type WorkspaceClient

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

WorkspaceClient provides JSON-RPC methods for workspace operations.

func NewWorkspaceClient

func NewWorkspaceClient(url string) (*WorkspaceClient, error)

NewWorkspaceClient creates a new workspace client connected via JSON-RPC.

func (*WorkspaceClient) Add

func (wc *WorkspaceClient) Add(ctx context.Context, name, path string, autoStart bool, port int) (*workspace.WorkspaceInfo, error)

Add creates a new workspace.

func (*WorkspaceClient) AddWithOptions

func (wc *WorkspaceClient) AddWithOptions(ctx context.Context, opts AddOptions) (*workspace.WorkspaceInfo, error)

AddWithOptions creates a new workspace with additional options. Use CreateIfMissing to create the directory if it doesn't exist.

func (*WorkspaceClient) Close

func (wc *WorkspaceClient) Close() error

Close closes the underlying connection.

func (*WorkspaceClient) Discover

func (wc *WorkspaceClient) Discover(ctx context.Context, paths []string) ([]workspace.DiscoveredRepo, error)

Discover scans for Git repositories.

func (*WorkspaceClient) Get

Get returns a specific workspace by ID.

func (*WorkspaceClient) List

List returns all workspaces.

func (*WorkspaceClient) Remove

func (wc *WorkspaceClient) Remove(ctx context.Context, id string) error

Remove deletes a workspace.

func (*WorkspaceClient) Restart

Restart restarts a workspace.

func (*WorkspaceClient) Start

Start starts a workspace.

func (*WorkspaceClient) Stop

Stop stops a workspace.

Jump to

Keyboard shortcuts

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