nexus.Config is a plain Go struct holding every value required to construct a client. Pass a value (not a pointer) to NewClient.
Field reference
API key types
Where to keep the API key
For services, the conventional Go pattern is environment variables:os.LookupEnv for explicit “missing” handling, or with libraries like github.com/caarlos0/env or github.com/kelseyhightower/envconfig.
The SDK never logs the raw key. Log lines reference key type only:
Choosing the TTL
The TTL is a tradeoff between staleness window and redundant network traffic. With SSE enabled (started automatically byNewClient), changes propagate in milliseconds regardless of the TTL - the TTL only matters as a safety net if the stream falls back.
If SSE is connected, the SDK clamps the effective TTL to at least 60 s - no point polling more aggressively when the stream pushes events the moment they happen.
Custom HTTP client
For tests or when you want explicit control over timeouts / TLS:HTTPClient is nil, the SDK builds its own with a 10-second timeout.
Two clients under the hood
The SDK uses two distinct HTTP clients internally:- The short-request client - your
Config.HTTPClientverbatim (or the default 10 s-timeout client). Used for/v1/sync,/v1/auth/token-exchange, and any future short request. May carry any total request timeout you choose. - A streaming client - derived from your client at construction time (a value-copy with
Timeoutcleared). Used exclusively for the long-lived/v1/streamSSE connection.
This split is not optional - Go’s
http.Client.Timeout applies to the entire request including reading the response body, so a single shared client with a non-zero Timeout would kill SSE connections at the timeout boundary regardless of activity. The SDK makes the split for you so you can keep your familiar http.Client{Timeout: 10*time.Second} pattern without breaking the stream.Transport (proxies, custom TLS, instrumentation), Jar (cookies), CheckRedirect. Cancellation of the SSE goroutine is provided exclusively by the context.Context you pass to RunStream(ctx).
If your client has a non-zero Timeout, the SDK emits a Debug-level log note at startup recording the split:
