client

package
v0.1.79 Latest Latest
Warning

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

Go to latest
Published: Oct 30, 2026 License: MIT Imports: 21 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 IsJSONDryRun added in v0.1.68

func IsJSONDryRun(cmd *cobra.Command) bool

func NewClient

func NewClient(cmd *cobra.Command, allowedSecurityFields ...string) (*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. Empty allowedSecurityFields accepts every global security alternative.

func NewDryRunBody added in v0.1.68

func NewDryRunBody(length int64) io.ReadCloser

NewDryRunBody returns an empty body that previews as <bytes:length> under --dry-run.

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
	Stdout io.Writer
	JSON   bool
	Cmd    *cobra.Command
}

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)

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