Documentation
¶
Overview ¶
Package httpclient provides a domain-aware HTTP client for the TaskFlow API. Consumers use the generic functions GetOne, GetMany, Exec, and ExecNoResult with model.Resource and model.Operation types — no manual URL building needed.
Index ¶
- func Exec[T any](c *Client, op model.Operation, params PathParams, body any) (T, error)
- func ExecNoResult(c *Client, op model.Operation, params PathParams, body any) error
- func GetMany[T any](c *Client, res model.Resource, params PathParams, filter any) ([]T, error)
- func GetOne[T any](c *Client, res model.Resource, params PathParams, filter any) (T, error)
- type APIError
- type Client
- type ConnectionError
- type EventStream
- type PathParams
- type StreamError
- type SubscribeOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExecNoResult ¶
ExecNoResult executes an operation that returns no body (e.g. DELETE → 204).
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client makes authenticated JSON HTTP requests to a TaskFlow server.
func (*Client) ServerVersion ¶
ServerVersion fetches the server's version from the /health endpoint.
func (*Client) Subscribe ¶
func (c *Client) Subscribe(ctx context.Context, opts SubscribeOptions) *EventStream
Subscribe opens a global SSE event stream with optional filtering. Events are delivered on the returned channels until ctx is cancelled.
type ConnectionError ¶
ConnectionError is returned when the HTTP request fails at the transport level (server unreachable, DNS failure, timeout, etc.).
func (*ConnectionError) Error ¶
func (e *ConnectionError) Error() string
func (*ConnectionError) Unwrap ¶
func (e *ConnectionError) Unwrap() error
type EventStream ¶
type EventStream struct {
Events <-chan eventbus.Event // domain events
Errors <-chan StreamError // connection errors; non-permanent errors are retried automatically
Connected <-chan struct{} // sent each time a connection is established
}
EventStream delivers domain events from an SSE connection. The stream reconnects automatically with exponential backoff. Cancel the context passed to Subscribe to stop.
type PathParams ¶
PathParams maps path parameter names to values for URL substitution.
type StreamError ¶
type StreamError struct {
Err error
Permanent bool // if true, the stream will not retry (e.g. 401, 404)
}
StreamError describes an SSE connection error.
type SubscribeOptions ¶
type SubscribeOptions struct {
Boards []string // filter to specific board slugs (empty = all boards)
Assignee string // filter to events on tasks assigned to this user (supports @me)
}
SubscribeOptions configures the event stream filter.