Documentation
¶
Index ¶
- Variables
- func CreateRequest(token *HookdeckToken, event *models.Event, metadata map[string]string) (*http.Request, error)
- type HookdeckConfig
- type HookdeckCredentials
- type HookdeckProvider
- func (p *HookdeckProvider) ComputeTarget(destination *models.Destination) destregistry.DestinationTarget
- func (p *HookdeckProvider) CreatePublisher(ctx context.Context, destination *models.Destination) (destregistry.Publisher, error)
- func (p *HookdeckProvider) Preprocess(newDestination *models.Destination, originalDestination *models.Destination, ...) error
- func (p *HookdeckProvider) Validate(ctx context.Context, destination *models.Destination) error
- type HookdeckPublisher
- type HookdeckSourceResponse
- type HookdeckToken
- type ProviderOption
- type PublisherOption
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidTokenBase64 = errors.New("invalid token: not base64 encoded") ErrInvalidTokenFormat = errors.New("invalid token format: expected 'id:random_string'") ErrJSONMarshalFailed = errors.New("failed to marshal event data to JSON") ErrTokenVerification = errors.New("failed to verify token with Hookdeck API") )
Standard error definitions for token parsing
Functions ¶
func CreateRequest ¶
func CreateRequest(token *HookdeckToken, event *models.Event, metadata map[string]string) (*http.Request, error)
CreateRequest creates an HTTP request for a Hookdeck destination
Types ¶
type HookdeckConfig ¶
type HookdeckConfig struct {
}
Configuration type - empty since we don't have config fields
type HookdeckProvider ¶
type HookdeckProvider struct {
*destregistry.BaseProvider
// contains filtered or unexported fields
}
Provider implementation
func New ¶
func New(loader metadata.MetadataLoader, opts ...ProviderOption) (*HookdeckProvider, error)
Constructor
func (*HookdeckProvider) ComputeTarget ¶
func (p *HookdeckProvider) ComputeTarget(destination *models.Destination) destregistry.DestinationTarget
ComputeTarget returns a human-readable target
func (*HookdeckProvider) CreatePublisher ¶
func (p *HookdeckProvider) CreatePublisher(ctx context.Context, destination *models.Destination) (destregistry.Publisher, error)
CreatePublisher creates a new publisher instance
func (*HookdeckProvider) Preprocess ¶
func (p *HookdeckProvider) Preprocess(newDestination *models.Destination, originalDestination *models.Destination, opts *destregistry.PreprocessDestinationOpts) error
Preprocess sets defaults and standardizes values
func (*HookdeckProvider) Validate ¶
func (p *HookdeckProvider) Validate(ctx context.Context, destination *models.Destination) error
Validate performs destination-specific validation including token format
type HookdeckPublisher ¶
type HookdeckPublisher struct {
*destregistry.BasePublisher
// contains filtered or unexported fields
}
Publisher implementation
func NewPublisher ¶
func NewPublisher(tokenString string, opts ...PublisherOption) (*HookdeckPublisher, error)
NewPublisher creates a new HookdeckPublisher with the provided token and options
func (*HookdeckPublisher) Close ¶
func (p *HookdeckPublisher) Close() error
Close closes any connections or resources
func (*HookdeckPublisher) Format ¶
Format is a helper method that formats an event into an HTTP request for Hookdeck
func (*HookdeckPublisher) Publish ¶
func (p *HookdeckPublisher) Publish(ctx context.Context, event *models.Event) (*destregistry.Delivery, error)
Publish publishes an event to the Hookdeck destination
type HookdeckSourceResponse ¶
type HookdeckSourceResponse struct {
Name string `json:"name"`
URL string `json:"url"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
DisabledAt *time.Time `json:"disabled_at"`
}
HookdeckSourceResponse represents the response from the Hookdeck API for source verification
func VerifyHookdeckToken ¶
func VerifyHookdeckToken(client *http.Client, ctx context.Context, token *HookdeckToken) (*HookdeckSourceResponse, error)
VerifyHookdeckToken makes an API call to Hookdeck to verify the token and get the source information This function can be used to verify if a token is valid by making an API call to Hookdeck
type HookdeckToken ¶
HookdeckToken represents the decoded Hookdeck token
func ParseHookdeckToken ¶
func ParseHookdeckToken(token string) (*HookdeckToken, error)
ParseHookdeckToken parses a Hookdeck token from the base64 encoded string
type ProviderOption ¶
type ProviderOption func(*HookdeckProvider)
ProviderOption defines a function that configures a HookdeckProvider
func WithHTTPClient ¶
func WithHTTPClient(client *http.Client) ProviderOption
WithHTTPClient sets a custom HTTP client for all publishers created by this provider
func WithUserAgent ¶
func WithUserAgent(userAgent string) ProviderOption
WithUserAgent sets the user agent for the hookdeck request
type PublisherOption ¶
type PublisherOption func(*HookdeckPublisher)
PublisherOption defines a function that configures a HookdeckPublisher
func PublisherWithClient ¶
func PublisherWithClient(client *http.Client) PublisherOption
PublisherWithClient sets a custom HTTP client for the publisher