client

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Mar 4, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Overview

Package client provides an HTTP client for the ToolHive Skills API.

Index

Constants

This section is empty.

Variables

View Source
var ErrServerUnreachable = errors.New("could not reach ToolHive API server — is 'thv serve' running?")

ErrServerUnreachable is returned when the client cannot connect to the ToolHive API server. The most common cause is that "thv serve" is not running.

Functions

This section is empty.

Types

type Client

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

Client is an HTTP client for the ToolHive Skills API.

func NewClient

func NewClient(baseURL string, opts ...Option) *Client

NewClient creates a new Skills API client with the given base URL.

func NewDefaultClient added in v0.11.0

func NewDefaultClient(opts ...Option) *Client

NewDefaultClient creates a Skills API client using the TOOLHIVE_API_URL environment variable, falling back to http://127.0.0.1:8080.

func (*Client) Build added in v0.11.0

func (c *Client) Build(ctx context.Context, opts skills.BuildOptions) (*skills.BuildResult, error)

Build builds a skill from a local directory into an OCI artifact.

func (*Client) Info added in v0.11.0

func (c *Client) Info(ctx context.Context, opts skills.InfoOptions) (*skills.SkillInfo, error)

Info returns detailed information about a skill.

func (*Client) Install added in v0.11.0

Install installs a skill from a remote source.

func (*Client) List added in v0.11.0

List returns all installed skills matching the given options.

func (*Client) Push added in v0.11.0

func (c *Client) Push(ctx context.Context, opts skills.PushOptions) error

Push pushes a built skill artifact to a remote registry.

func (*Client) Uninstall added in v0.11.0

func (c *Client) Uninstall(ctx context.Context, opts skills.UninstallOptions) error

Uninstall removes an installed skill.

func (*Client) Validate added in v0.11.0

func (c *Client) Validate(ctx context.Context, path string) (*skills.ValidationResult, error)

Validate checks whether a skill definition is valid.

type Option added in v0.11.0

type Option func(*Client)

Option configures a Client.

func WithHTTPClient added in v0.11.0

func WithHTTPClient(hc *http.Client) Option

WithHTTPClient replaces the underlying *http.Client entirely. This overrides any previously applied options such as WithTimeout.

func WithTimeout added in v0.11.0

func WithTimeout(d time.Duration) Option

WithTimeout sets the HTTP client timeout.

Jump to

Keyboard shortcuts

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