Documentation
¶
Overview ¶
Package api talks to the Bachs HTTP API.
Only the handful of calls the CLI needs. Errors carry the server's own message rather than a bare status code: a bad event name or a key missing webhooks:write is worth reading, and hiding it behind "400" wastes the user's time.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Version = "dev"
Version is the CLI version, overridden at build time via -ldflags. Set by main before any request is made, so the user agent is computed per call rather than frozen at init.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func (*Client) CloseSession ¶
CloseSession releases a session so fanout stops aiming at a socket nobody holds. Best-effort at shutdown — the server's reaper covers the case where this never runs, which is why a failure here is not worth surfacing.
func (*Client) CreateSession ¶
func (c *Client) CreateSession( ctx context.Context, req CreateSessionRequest, ) (*CreateSessionResponse, error)
type CreateSessionRequest ¶
type CreateSessionResponse ¶
type CreateSessionResponse struct {
SessionID string `json:"session_id"`
Token string `json:"token"`
SigningSecret string `json:"signing_secret"`
WebSocketPath string `json:"websocket_path"`
Events []string `json:"events"`
// How often to cycle the connection. Server-dictated so deploys can
// drain sockets without stranding them.
ReconnectAfterSeconds int `json:"reconnect_after_seconds"`
}
type ReplayRequest ¶
type ReplayRequest struct {
EventID string `json:"event_id,omitempty"`
}