Versions in this module Expand all Collapse all v2 v2.0.3 Aug 25, 2026 v2.0.2 Aug 25, 2026 Changes in this version + const AlreadyIngested + const DefaultMaxPayloadBytes + const DefaultMaxResponseBytes + const DefaultRequestTimeout + const MaxAttemptsCap + const MaxHeadBytes + const MaxHeaderBytes + const MaxResponseHeaders + const RateLimited + var ErrAnswerAboveABound = errors.New("the API answered more than this client reads") + var ErrHeaderNotDelivered = errors.New("a header the signature covers was not delivered") + var ErrInvalidEventType = errors.New("the event type does not have a valid syntax") + var ErrPayloadTooLarge = errors.New("the event payload is larger than this client sends") + var ErrSignatureMismatch = errors.New("the signature does not match what the subscription secret produces") + var ErrSignatureOutsideTolerance = errors.New("the signature's moment sits outside the tolerance accepted") + var ErrSignatureUnreadable = errors.New("the signature header cannot be read") + var ErrUnreachable = errors.New("the API could not be reached") + var ErrUnusableAPIURL = errors.New("the API URL is not one a request can be sent to") + func GenerateEventId() string + func VerifyWebhookSignature(signature string, payload []byte, headers http.Header, ...) error + func VerifyWebhookSignatureAt(signature string, payload []byte, headers http.Header, ...) error + type Client struct + func NewClient(apiURL string, applicationId string, token string, options Options) *Client + func (c *Client) APIURL() string + func (c *Client) ApplicationId() string + func (c *Client) Options() Options + func (c *Client) SendEvent(ctx context.Context, event Event) (string, error) + func (c *Client) Transport() *Transport + func (c *Client) UpsertEventTypes(ctx context.Context, eventTypes []string) ([]string, error) + type Event struct + EventId string + EventType string + Labels map[string]string + Metadata map[string]string + OccurredAt time.Time + Payload string + PayloadContentType string + type EventType struct + ResourceType string + Service string + Verb string + func ParseEventType(written string) (EventType, error) + func (e EventType) String() string + type EventTypeError struct + Detail string + Err error + EventType string + func (e *EventTypeError) Error() string + func (e *EventTypeError) Unwrap() error + type Options struct + MaxPayloadBytes int + MaxResponseBytes int64 + RequestTimeout time.Duration + RetryPolicy RetryPolicy + func DefaultOptions() Options + type RetryPolicy struct + InitialBackoff time.Duration + MaxAttempts int + MaxBackoff time.Duration + MaxTotalDelay time.Duration + func DefaultRetryPolicy() RetryPolicy + func DisabledRetryPolicy() RetryPolicy + func (p RetryPolicy) Attempts() int + func (p RetryPolicy) BackoffCeiling(retry int) time.Duration + func (p RetryPolicy) Delays(draws []float64) []time.Duration + type SendError struct + Attempts int + Detail string + Err error + EventId string + Waited time.Duration + func (e *SendError) Error() string + func (e *SendError) Unwrap() error + type Signature struct + BodyCode []byte + CoveredHeaders []string + HeadersCode []byte + Timestamp int64 + func ParseSignature(signature string) (*Signature, error) + func (s *Signature) Verify(payload []byte, coveredValues []string, subscriptionSecret string) bool + type Transport struct + func NewTransport(baseURL string, token string, timeout time.Duration, maxResponseBytes int64) *Transport + func (t *Transport) Deliver(ctx context.Context, method string, path string, query url.Values, body any) (int, http.Header, []byte, error) + func (t *Transport) Request(ctx context.Context, method string, path string, query url.Values, body any) (int, []byte, error) + type TransportError struct + Detail string + Err error + func (e *TransportError) Error() string + func (e *TransportError) Unwrap() error