Documentation
¶
Overview ¶
Code generated by apic; DO NOT EDIT.
Code generated by apic; DO NOT EDIT.
Code generated by apic; DO NOT EDIT.
Index ¶
- Variables
- func WithCorrelationID(ctx context.Context, id string) context.Context
- func WithTraceParent(ctx context.Context, traceparent string) context.Context
- type BinarySocket
- type Client
- type ClientOption
- func WithAPIKeySecret(secret []byte) ClientOption
- func WithBearerToken(token string) ClientOption
- func WithHTTPClient(client *http.Client) ClientOption
- func WithRequestEditor(fn RequestEditorFn) ClientOption
- func WithWSHeaders(headers http.Header) ClientOption
- func WithWSOrigin(origin string) ClientOption
- func WithoutTracePropagation() ClientOption
- type HTTPError
- type JSONSocket
- type RequestEditorFn
Constants ¶
This section is empty.
Variables ¶
var ( // ErrMissingAPIKeySecret indicates api_key auth was required but no secret was configured. ErrMissingAPIKeySecret = errors.New("missing API key secret") // ErrMissingBearerToken indicates jwt auth was required but no bearer token was configured. ErrMissingBearerToken = errors.New("missing bearer token") )
Functions ¶
func WithCorrelationID ¶ added in v0.15.0
WithCorrelationID attaches an end-to-end correlation id to ctx. The client sends it as the defaultCorrelationHeader ("X-Correlation-ID") header on every REST, GraphQL, and WebSocket call. When ctx carries none (or an unusable value), the client generates one per call.
func WithTraceParent ¶ added in v0.15.0
WithTraceParent attaches a W3C traceparent to ctx for explicit trace-context passthrough. When well-formed ("00-<32-hex trace-id>-<16-hex span-id>-<2-hex flags>") the client forwards it verbatim as the "traceparent" header on every REST, GraphQL, and WebSocket call. The client links no OpenTelemetry runtime, so it never derives a traceparent from an ambient span — pass it explicitly.
Types ¶
type BinarySocket ¶
type BinarySocket struct {
// contains filtered or unexported fields
}
BinarySocket wraps a binary WebSocket endpoint.
func (*BinarySocket) Close ¶
func (s *BinarySocket) Close() error
Close closes the underlying websocket.
func (*BinarySocket) Receive ¶
func (s *BinarySocket) Receive() ([]byte, error)
Receive blocks until the next binary payload arrives.
func (*BinarySocket) Send ¶
func (s *BinarySocket) Send(payload []byte) error
Send writes one binary payload.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is the generated Go client for REST, GraphQL, and WebSocket APIs.
func New ¶
func New(baseURL string, opts ...ClientOption) (*Client, error)
New constructs a generated client from an absolute base URL.
func (*Client) ConnectMCP ¶
func (c *Client) ConnectMCP(ctx context.Context) (*JSONSocket[types.HealthResp], error)
ConnectMCP opens /ws/mcp.
type ClientOption ¶
type ClientOption func(*Client)
ClientOption mutates a generated client.
func WithAPIKeySecret ¶
func WithAPIKeySecret(secret []byte) ClientOption
WithAPIKeySecret configures the HMAC secret used by api_key endpoints.
func WithBearerToken ¶
func WithBearerToken(token string) ClientOption
WithBearerToken configures the JWT bearer token used by jwt-protected endpoints.
func WithHTTPClient ¶
func WithHTTPClient(client *http.Client) ClientOption
WithHTTPClient overrides the HTTP transport.
func WithRequestEditor ¶
func WithRequestEditor(fn RequestEditorFn) ClientOption
WithRequestEditor appends a request editor.
func WithWSHeaders ¶
func WithWSHeaders(headers http.Header) ClientOption
WithWSHeaders configures extra headers for outbound WebSocket handshakes.
func WithWSOrigin ¶
func WithWSOrigin(origin string) ClientOption
WithWSOrigin sets the Origin header for outbound WebSocket handshakes.
func WithoutTracePropagation ¶ added in v0.15.0
func WithoutTracePropagation() ClientOption
WithoutTracePropagation disables automatic correlation-id and traceparent header injection on outbound REST, GraphQL, and WebSocket calls. Injection is on by default; a request editor set via WithRequestEditor can still add or override these headers regardless of this option.
type JSONSocket ¶
type JSONSocket[T any] struct { // contains filtered or unexported fields }
JSONSocket wraps a typed JSON WebSocket endpoint.
func (*JSONSocket[T]) Close ¶
func (s *JSONSocket[T]) Close() error
Close closes the underlying websocket.
func (*JSONSocket[T]) Receive ¶
func (s *JSONSocket[T]) Receive() (T, error)
Receive blocks until the next JSON message arrives.
func (*JSONSocket[T]) Send ¶
func (s *JSONSocket[T]) Send(msg T) error
Send writes one JSON message.