Documentation
¶
Overview ¶
Package client provides the public PowerContext HTTP client.
Index ¶
Constants ¶
const DefaultTimeout = 10 * time.Second
Variables ¶
This section is empty.
Functions ¶
func IsConfigurationError ¶
IsConfigurationError reports configuration failures without requiring users to import generated transport packages.
Types ¶
type Client ¶
Client exposes all 53 strongly typed operations from the authoritative ogen contract. Embedding the generated invoker keeps new OpenAPI operations a compile-time concern instead of a handwritten transport drift risk.
func New ¶
New validates transport configuration and constructs a no-redirect client. Server URLs may contain a path prefix but never credentials, query values, or fragments.
func (*Client) DownloadHandoffReport ¶
func (c *Client) DownloadHandoffReport(ctx context.Context, request v1.GetHandoffReportRequest) ([]byte, error)
DownloadHandoffReport returns the exact Markdown or canonical JSON bytes supplied by the Server. The response is bounded to the public 10 MiB report limit and request is copied before download=true is applied.
func (*Client) Raw ¶
Raw returns the generated client for advanced transport access such as a per-request server URL override. Raw calls intentionally bypass Client's stable error normalization; most callers should use the promoted methods.
func (*Client) RenderHandoffReport ¶
func (c *Client) RenderHandoffReport(ctx context.Context, request v1.GetHandoffReportRequest) (string, error)
RenderHandoffReport renders one Markdown report without mutating request. Call GetHandoffReport directly when a typed JSON projection is required.
type ConfigurationError ¶
type ConfigurationError struct{ Field string }
ConfigurationError deliberately excludes the rejected value so URLs and tokens cannot leak through logs or command-line diagnostics.
func (*ConfigurationError) Error ¶
func (e *ConfigurationError) Error() string
func (*ConfigurationError) GoString ¶
func (e *ConfigurationError) GoString() string
type InvalidResponseError ¶
type InvalidResponseError struct {
Path string
RequestID string
// contains filtered or unexported fields
}
InvalidResponseError reports a response returned with the operation's exact success status whose body or headers violate the OpenAPI contract.
func (*InvalidResponseError) Error ¶
func (e *InvalidResponseError) Error() string
func (*InvalidResponseError) GoString ¶
func (e *InvalidResponseError) GoString() string
func (*InvalidResponseError) LogValue ¶
func (e *InvalidResponseError) LogValue() slog.Value
func (*InvalidResponseError) Unwrap ¶
func (e *InvalidResponseError) Unwrap() error
type Options ¶
type Options struct {
BearerToken string `json:"-"`
Timeout time.Duration `json:"timeout"`
HTTPClient *http.Client `json:"-"`
// TrustTransportSecurity permits a caller-supplied HTTPClient to use an
// http:// label only when its transport is secured outside ordinary TCP,
// such as an in-process handler, Unix socket, or TLS-terminating proxy.
TrustTransportSecurity bool `json:"trust_transport_security"`
TracerProvider trace.TracerProvider `json:"-"`
MeterProvider metric.MeterProvider `json:"-"`
}
Options configures the public HTTP client without exposing credentials in generated-client errors. A caller-supplied HTTP client is shallow-cloned and is never mutated.
type PlaintextNonLoopbackError ¶
type PlaintextNonLoopbackError struct{}
PlaintextNonLoopbackError reports that the Client refused plaintext HTTP to a non-loopback host. It excludes the rejected URL from every representation and unwraps to ConfigurationError for compatibility with existing callers.
func (*PlaintextNonLoopbackError) Error ¶
func (*PlaintextNonLoopbackError) Error() string
func (*PlaintextNonLoopbackError) GoString ¶
func (*PlaintextNonLoopbackError) GoString() string
func (*PlaintextNonLoopbackError) Unwrap ¶
func (*PlaintextNonLoopbackError) Unwrap() error
type RequestValidationError ¶
type RequestValidationError struct {
Path string
// contains filtered or unexported fields
}
RequestValidationError reports that a caller-supplied wire request violates the OpenAPI schema before any network request is sent.
func (*RequestValidationError) Error ¶
func (e *RequestValidationError) Error() string
func (*RequestValidationError) GoString ¶
func (e *RequestValidationError) GoString() string
func (*RequestValidationError) LogValue ¶
func (e *RequestValidationError) LogValue() slog.Value
func (*RequestValidationError) Unwrap ¶
func (e *RequestValidationError) Unwrap() error
type ServerError ¶
type ServerError struct {
StatusCode int
RequestID string
Code string
Message string
Details map[string]any
}
ServerError is the stable error context decoded from a declared non-success response. Use AsServerError on any operation result before treating it as a successful response variant.
func AsServerError ¶
func AsServerError(response any) (*ServerError, bool)
AsServerError recognizes every shared OpenAPI error response wrapper.
func (*ServerError) Error ¶
func (e *ServerError) Error() string
func (*ServerError) GoString ¶
func (e *ServerError) GoString() string
func (*ServerError) LogValue ¶
func (e *ServerError) LogValue() slog.Value
type TransportError ¶
type TransportError struct {
Path string
// contains filtered or unexported fields
}
TransportError reports that no valid HTTP response was received. Its text is deliberately stable; the original error remains available through Unwrap.
func (*TransportError) Error ¶
func (e *TransportError) Error() string
func (*TransportError) GoString ¶
func (e *TransportError) GoString() string
func (*TransportError) LogValue ¶
func (e *TransportError) LogValue() slog.Value
func (*TransportError) Unwrap ¶
func (e *TransportError) Unwrap() error