Documentation
¶
Overview ¶
Package client provides an HTTP client for the ToolHive Skills API.
Index ¶
- Variables
- type Client
- func (c *Client) Build(ctx context.Context, opts skills.BuildOptions) (*skills.BuildResult, error)
- func (c *Client) Info(ctx context.Context, opts skills.InfoOptions) (*skills.SkillInfo, error)
- func (c *Client) Install(ctx context.Context, opts skills.InstallOptions) (*skills.InstallResult, error)
- func (c *Client) List(ctx context.Context, opts skills.ListOptions) ([]skills.InstalledSkill, error)
- func (c *Client) Push(ctx context.Context, opts skills.PushOptions) error
- func (c *Client) Uninstall(ctx context.Context, opts skills.UninstallOptions) error
- func (c *Client) Validate(ctx context.Context, path string) (*skills.ValidationResult, error)
- type Option
Constants ¶
This section is empty.
Variables ¶
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 NewDefaultClient ¶ added in v0.11.0
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) Install ¶ added in v0.11.0
func (c *Client) Install(ctx context.Context, opts skills.InstallOptions) (*skills.InstallResult, error)
Install installs a skill from a remote source.
func (*Client) List ¶ added in v0.11.0
func (c *Client) List(ctx context.Context, opts skills.ListOptions) ([]skills.InstalledSkill, error)
List returns all installed skills matching the given options.
type Option ¶ added in v0.11.0
type Option func(*Client)
Option configures a Client.
func WithHTTPClient ¶ added in v0.11.0
WithHTTPClient replaces the underlying *http.Client entirely. This overrides any previously applied options such as WithTimeout.
func WithTimeout ¶ added in v0.11.0
WithTimeout sets the HTTP client timeout.