client

package
v0.3.13 Latest Latest
Warning

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

Go to latest
Published: Jun 1, 2026 License: MIT Imports: 10 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 BuildHTTPClient added in v0.3.7

func BuildHTTPClient(proxyURL string) (*http.Client, error)

BuildHTTPClient returns an *http.Client whose Transport is a clone of http.DefaultTransport with proxy resolution wired in:

  • if proxyURL is set, all traffic goes through it (supports user:pass@host:port)
  • otherwise, falls back to HTTP_PROXY / HTTPS_PROXY / NO_PROXY env vars

Exported so the MCP path can reuse the same transport (auth-validated proxy, scheme/host check) when building the bron-sdk-go realtime client. Without this the SDK's own proxy-string handling skips the validation pass.

Types

type Client

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

func New

func New(p *config.Profile) (*Client, error)

New builds an HTTP client backed by bron-sdk-go using the resolved profile. The private key (JWK) comes from `config.Profile.LoadKey` — either inline from $BRON_API_KEY or read from KeyFile on disk. Workspace ID is interpolated into request paths via Do().

func NewForBootstrap added in v0.3.8

func NewForBootstrap(p *config.Profile) (*Client, error)

NewForBootstrap is the workspace-less variant of New, intended for the `bron config init` flow before we know which workspace this key is bound to. Right for paths that don't carry `{workspaceId}` (e.g. GET /workspaces); any path that needs interpolation will produce an unresolved literal, which is the desired hard-fail signal for misuse.

func (*Client) Do

func (c *Client) Do(ctx context.Context, method, path string, pathParams map[string]string, body, query, result interface{}) error

Do executes a request, substituting `{workspaceId}` and any other path placeholders (`{accountId}`, `{transactionId}`, ...) before sending. All values are URL-escaped via `url.PathEscape`.

Decoding goes through json.Decoder.UseNumber so decimal payloads keep their exact wire representation. The default decoder converts every JSON number to float64, which truncates large integers and rounds long decimals — fatal for balances/amounts where a single trailing digit can be billions of wei. We capture the raw response into json.RawMessage and re-decode locally so that numeric leaves arrive as json.Number; output formatters then emit them verbatim.

Jump to

Keyboard shortcuts

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