Documentation
¶
Overview ¶
Package webhook provides an HTTP client for posting failure notifications to a configured webhook endpoint.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DefaultPayload ¶
func DefaultPayload(e FailureEvent) ([]byte, error)
DefaultPayload marshals the event into the standard JSON shape:
{"workflow":"...","file_path":"...","step":"...","error":"..."}
Types ¶
type Client ¶
type Client struct {
URL string
Timeout time.Duration // zero → defaultTimeout (10s)
BuildPayload PayloadFunc // nil → DefaultPayload
}
Client sends failure notifications to a webhook endpoint.
func (*Client) NotifyFailure ¶
func (c *Client) NotifyFailure(ctx context.Context, event FailureEvent) error
NotifyFailure sends an HTTP POST to c.URL with the failure event payload. If c.URL is empty the call is a no-op and nil is returned. If the endpoint returns a non-2xx status code, a non-nil error is returned containing the status code.
type FailureEvent ¶
FailureEvent describes a workflow step failure.
type PayloadFunc ¶
type PayloadFunc func(event FailureEvent) ([]byte, error)
PayloadFunc builds the HTTP request body for a given failure event. Implementations can return any JSON structure — for example, Discord's {"content": "..."} format.