Client
The client package provides
client.Runtime,
the configurable HTTP transport that go-swagger-generated clients use
under the hood. You can also drive it directly for untyped API calls.
A minimal client looks like this:
rt := client.New("api.example.com", "/v1", []string{"https"})
rt.DefaultAuthentication = client.BearerToken(token)
result, err := rt.SubmitContext(ctx, op)Full source: docs/examples/client/intro/main.go
What the four pages below cover:
| Page | About |
|---|---|
| Transport | Runtime configuration: TLS, timeouts, proxy, keepalive, debug logging |
| Authentication | ClientAuthInfoWriter and the built-in helpers (Basic, API key, Bearer) |
| Tracing | OpenTelemetry support and the legacy OpenTracing compat module |
| Building & submitting requests | ClientOperation, Submit vs SubmitContext, the v0.30 context-only pivot |
- Configuring client.Runtime — TLS, timeouts, proxy, keepalive and the underlying http.Client.
- Attaching auth information to outgoing requests — Basic, API key, Bearer and OAuth2.
- Built-in OpenTelemetry support on client.Runtime, plus a note on the legacy OpenTracing compatibility module.
- ClientOperation, BuildHTTP and SubmitContext — and the recent pivot to context-only request building.