client

package
v0.3.7 Latest Latest
Warning

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

Go to latest
Published: May 1, 2026 License: MIT Imports: 10 Imported by: 0

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 (*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