hookdeck

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 1, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package hookdeck provides an HTTP client adapter that satisfies the deploy.Client interface for the Hookdeck REST API.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client is a concrete HTTP client for the Hookdeck API.

func NewClient

func NewClient(apiKey, projectID string, opts ...ClientOption) *Client

NewClient creates a Hookdeck API client. The apiKey is required. The projectID is optional (omit if the API key is scoped to one project).

func (*Client) FindConnectionByFullName

func (c *Client) FindConnectionByFullName(ctx context.Context, fullName string) (*ResourceInfo, error)

FindConnectionByFullName queries GET /connections?full_name=<name> and returns the first match.

func (*Client) FindDestinationByName

func (c *Client) FindDestinationByName(ctx context.Context, name string) (*ResourceInfo, error)

FindDestinationByName queries GET /destinations?name=<name> and returns the first match.

func (*Client) FindSourceByName

func (c *Client) FindSourceByName(ctx context.Context, name string) (*ResourceInfo, error)

FindSourceByName queries GET /sources?name=<name> and returns the first match.

func (*Client) FindTransformationByName

func (c *Client) FindTransformationByName(ctx context.Context, name string) (*ResourceInfo, error)

FindTransformationByName queries GET /transformations?name=<name> and returns the first match.

func (*Client) GetConnectionByFullName

func (c *Client) GetConnectionByFullName(ctx context.Context, fullName string) (*ConnectionDetail, error)

GetConnectionByFullName queries GET /connections?full_name=<name> and returns full connection details.

func (*Client) GetDestinationByName

func (c *Client) GetDestinationByName(ctx context.Context, name string) (*DestinationDetail, error)

GetDestinationByName queries GET /destinations?name=<name> and returns full destination details.

func (*Client) GetSourceByName

func (c *Client) GetSourceByName(ctx context.Context, name string) (*SourceDetail, error)

GetSourceByName queries GET /sources?name=<name> and returns full source details.

func (*Client) GetTransformationByName

func (c *Client) GetTransformationByName(ctx context.Context, name string) (*TransformationDetail, error)

GetTransformationByName queries GET /transformations?name=<name> and returns full transformation details.

func (*Client) UpsertConnection

UpsertConnection creates or updates a connection (PUT /connections).

func (*Client) UpsertDestination

UpsertDestination creates or updates a destination by name (PUT /destinations).

func (*Client) UpsertSource

UpsertSource creates or updates a source by name (PUT /sources).

func (*Client) UpsertTransformation

UpsertTransformation creates or updates a transformation by name (PUT /transformations).

type ClientOption

type ClientOption func(*Client)

ClientOption configures the Client.

func WithBaseURL

func WithBaseURL(baseURL string) ClientOption

WithBaseURL overrides the default API base URL.

func WithHTTPClient

func WithHTTPClient(hc *http.Client) ClientOption

WithHTTPClient overrides the default http.Client.

type ConnectionDetail

type ConnectionDetail struct {
	ID          string                   `json:"id"`
	Name        string                   `json:"name"`
	FullName    string                   `json:"full_name"`
	Source      *SourceDetail            `json:"source"`
	Destination *DestinationDetail       `json:"destination"`
	Rules       []map[string]interface{} `json:"rules"`
}

ConnectionDetail is the full representation of a Hookdeck connection.

type DestinationConfigDetail

type DestinationConfigDetail struct {
	URL             string                 `json:"url"`
	AuthType        string                 `json:"auth_type"`
	Auth            map[string]interface{} `json:"auth"`
	RateLimit       int                    `json:"rate_limit"`
	RateLimitPeriod string                 `json:"rate_limit_period"`
}

DestinationConfigDetail is the config sub-object of a Hookdeck destination.

type DestinationDetail

type DestinationDetail struct {
	ID          string                  `json:"id"`
	Name        string                  `json:"name"`
	Description string                  `json:"description"`
	Type        string                  `json:"type"`
	Config      DestinationConfigDetail `json:"config"`
}

DestinationDetail is the full representation of a Hookdeck destination. The API returns url, auth_type, auth, rate_limit, rate_limit_period inside a config object.

type ResourceInfo

type ResourceInfo struct {
	ID   string `json:"id"`
	Name string `json:"name"`
	URL  string `json:"url,omitempty"`
}

ResourceInfo is a lightweight representation of a Hookdeck resource returned by list endpoints.

type SourceDetail

type SourceDetail struct {
	ID          string `json:"id"`
	Name        string `json:"name"`
	URL         string `json:"url"`
	Description string `json:"description"`
}

SourceDetail is the full representation of a Hookdeck source.

type TransformationDetail

type TransformationDetail struct {
	ID   string            `json:"id"`
	Name string            `json:"name"`
	Code string            `json:"code"`
	Env  map[string]string `json:"env"`
}

TransformationDetail is the full representation of a Hookdeck transformation.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL