client

package
v0.1.58-rc.0 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2026 License: MIT Imports: 14 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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsDebug

func IsDebug(cmd *cobra.Command) bool

IsDebug returns true when --debug is set and --dry-run is not. When both flags are set, dry-run takes precedence.

func IsDryRun

func IsDryRun(cmd *cobra.Command) bool

IsDryRun returns true when --dry-run is set on the command.

func NewClient

func NewClient(cmd *cobra.Command) (*sdk.CompassCLI, error)

NewClient creates a new SDK client configured from command flags and environment. It handles global security, server URL/selection override, global parameters, retry configuration, timeout, and test client injection.

Types

type DebugClient

type DebugClient struct {
	Inner  HTTPClient
	Stderr io.Writer
}

DebugClient wraps an HTTP client and logs request/response diagnostics to stderr.

func (*DebugClient) Do

func (c *DebugClient) Do(req *http.Request) (*http.Response, error)

Do executes the request, logging diagnostics before and after.

type DryRunClient

type DryRunClient struct {
	Stderr io.Writer
}

DryRunClient intercepts HTTP requests and returns a synthetic response without making any network calls.

func (*DryRunClient) Do

func (c *DryRunClient) Do(req *http.Request) (*http.Response, error)

Do logs the request preview and returns a synthetic 200 response.

type HTTPClient

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

HTTPClient is the interface that SDK clients implement.

func WrapClientForDiagnostics

func WrapClientForDiagnostics(cmd *cobra.Command, inner HTTPClient) HTTPClient

WrapClientForDiagnostics wraps an HTTP client based on diagnostics mode. Returns the original client if no diagnostics flags are set.

Jump to

Keyboard shortcuts

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