Documentation
¶
Overview ¶
Code generated by apic; DO NOT EDIT.
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
- func (c *Client) ConnectItems(ctx context.Context) (*JSONSocket[types.ItemEvent], error)
- func (c *Client) Gallery(ctx context.Context, req *types.GalleryUploadReq) (*types.GalleryUploadResp, error)
- func (c *Client) GetItemID(ctx context.Context, req *types.ItemGetReq) (*types.ItemGetResp, error)
- func (c *Client) GetItems(ctx context.Context, req *types.ItemListReq) (*types.ItemListResp, error)
- func (c *Client) GetModuleLatest(ctx context.Context, req map[string]any) (map[string]any, error)
- func (c *Client) GraphQLCreateItem(ctx context.Context, req *types.ItemCreateReq) (*types.ItemCreateResp, error)
- func (c *Client) GraphQLListItems(ctx context.Context, req *types.ItemListReq) (*types.ItemListResp, error)
- func (c *Client) GraphQLSubscribeItemEvents(ctx context.Context) (*GraphQLSubscription[types.ItemEvent], error)
- func (c *Client) PostItems(ctx context.Context, req *types.ItemCreateReq) (*types.ItemCreateResp, error)
- func (c *Client) PostUpload(ctx context.Context, req *types.ItemUploadReq) (*types.ItemUploadResp, error)
- func (c *Client) PutItemID(ctx context.Context, req *types.ItemUpdateReq) (*types.ItemUpdateResp, error)
- func (c *Client) RemoveItem(ctx context.Context, req *types.ItemDeleteReq) (*types.ItemDeleteResp, error)
- func (c *Client) Tags(ctx context.Context, req *types.TagCreateReq) (*types.TagCreateResp, error)
- 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 GraphQLSubscription
- 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.1
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.1
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) ConnectItems ¶
ConnectItems opens /ws/items.
func (*Client) Gallery ¶
func (c *Client) Gallery(ctx context.Context, req *types.GalleryUploadReq) (*types.GalleryUploadResp, error)
Gallery performs POST /v1/gallery.
func (*Client) GetItemID ¶
func (c *Client) GetItemID(ctx context.Context, req *types.ItemGetReq) (*types.ItemGetResp, error)
GetItemID performs GET /v1/items/{item_id}.
func (*Client) GetItems ¶
func (c *Client) GetItems(ctx context.Context, req *types.ItemListReq) (*types.ItemListResp, error)
GetItems performs GET /v1/items.
func (*Client) GetModuleLatest ¶
GetModuleLatest performs GET /v1/modules/{mod}/latest.
func (*Client) GraphQLCreateItem ¶
func (c *Client) GraphQLCreateItem(ctx context.Context, req *types.ItemCreateReq) (*types.ItemCreateResp, error)
GraphQLCreateItem performs the createItem GraphQL mutation.
func (*Client) GraphQLListItems ¶
func (c *Client) GraphQLListItems(ctx context.Context, req *types.ItemListReq) (*types.ItemListResp, error)
GraphQLListItems performs the listItems GraphQL query.
func (*Client) GraphQLSubscribeItemEvents ¶
func (c *Client) GraphQLSubscribeItemEvents(ctx context.Context) (*GraphQLSubscription[types.ItemEvent], error)
GraphQLSubscribeItemEvents opens a typed GraphQL subscription stream.
func (*Client) PostItems ¶
func (c *Client) PostItems(ctx context.Context, req *types.ItemCreateReq) (*types.ItemCreateResp, error)
PostItems performs POST /v1/items.
func (*Client) PostUpload ¶
func (c *Client) PostUpload(ctx context.Context, req *types.ItemUploadReq) (*types.ItemUploadResp, error)
PostUpload performs POST /v1/items/{item_id}/upload.
func (*Client) PutItemID ¶
func (c *Client) PutItemID(ctx context.Context, req *types.ItemUpdateReq) (*types.ItemUpdateResp, error)
PutItemID performs PUT /v1/items/{item_id}.
func (*Client) RemoveItem ¶
func (c *Client) RemoveItem(ctx context.Context, req *types.ItemDeleteReq) (*types.ItemDeleteResp, error)
RemoveItem performs DELETE /v1/items/{item_id}.
func (*Client) Tags ¶
func (c *Client) Tags(ctx context.Context, req *types.TagCreateReq) (*types.TagCreateResp, error)
Tags performs POST /v1/items/{item_id}/tags.
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.1
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 GraphQLSubscription ¶
type GraphQLSubscription[T any] struct { // contains filtered or unexported fields }
GraphQLSubscription streams typed messages from a graphql-transport-ws subscription.
func (*GraphQLSubscription[T]) Close ¶
func (s *GraphQLSubscription[T]) Close() error
Close terminates the subscription and underlying websocket.
func (*GraphQLSubscription[T]) Next ¶
func (s *GraphQLSubscription[T]) Next() (T, error)
Next blocks until the next payload, completion, or error.
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.