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:

PageAbout
TransportRuntime configuration: TLS, timeouts, proxy, keepalive, debug logging
AuthenticationClientAuthInfoWriter and the built-in helpers (Basic, API key, Bearer)
TracingOpenTelemetry support and the legacy OpenTracing compat module
Building & submitting requestsClientOperation, 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.