github

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ApplySort

func ApplySort(deliveries []Delivery, sortBy string, ascending bool)

ApplySort sorts deliveries based on the specified field and direction

func SortDeliveriesByEvent

func SortDeliveriesByEvent(deliveries []Delivery, ascending bool)

SortDeliveriesByEvent sorts deliveries alphabetically by event type

func SortDeliveriesByRepository

func SortDeliveriesByRepository(deliveries []Delivery, ascending bool)

SortDeliveriesByRepository sorts deliveries alphabetically by repository name

func SortDeliveriesByStatusCode

func SortDeliveriesByStatusCode(deliveries []Delivery, ascending bool)

SortDeliveriesByStatusCode sorts deliveries numerically by HTTP status code

func SortDeliveriesByTime

func SortDeliveriesByTime(deliveries []Delivery, ascending bool)

SortDeliveriesByTime sorts deliveries by timestamp ascending=true sorts oldest first, ascending=false sorts newest first

Types

type Client

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

Client wraps the GitHub API client

func NewClient

func NewClient() (*Client, error)

NewClient creates a new GitHub API client Uses gh CLI's authentication automatically

func (*Client) GetOrgHookDeliveryDetail

func (c *Client) GetOrgHookDeliveryDetail(org string, hookID int, deliveryID int) (*DeliveryDetail, error)

GetOrgHookDeliveryDetail retrieves detailed information for a specific delivery

func (*Client) GetRepoHookDeliveryDetail

func (c *Client) GetRepoHookDeliveryDetail(repo string, hookID int, deliveryID int) (*DeliveryDetail, error)

GetRepoHookDeliveryDetail retrieves detailed information for a specific delivery

func (*Client) ListOrgHookDeliveries

func (c *Client) ListOrgHookDeliveries(org string, hookID int, perPage int) ([]Delivery, error)

ListOrgHookDeliveries retrieves all deliveries for an organization hook

func (*Client) ListOrgRepos

func (c *Client) ListOrgRepos(org string) ([]string, error)

ListOrgRepos retrieves all repositories for an organization

func (*Client) ListOrgWebhooks

func (c *Client) ListOrgWebhooks(org string) ([]Hook, error)

ListOrgWebhooks retrieves all webhooks for an organization

func (*Client) ListRepoHookDeliveries

func (c *Client) ListRepoHookDeliveries(repo string, hookID int, perPage int) ([]Delivery, error)

ListRepoHookDeliveries retrieves all deliveries for a repository hook

func (*Client) ListRepoWebhooks

func (c *Client) ListRepoWebhooks(repo string) ([]Hook, error)

ListRepoWebhooks retrieves all webhooks for a repository

type Delivery

type Delivery struct {
	ID          int       `json:"id"`
	GUID        string    `json:"guid"`
	DeliveredAt time.Time `json:"delivered_at"`
	Redelivery  bool      `json:"redelivery"`
	Duration    float64   `json:"duration"`
	Status      string    `json:"status"`
	StatusCode  int       `json:"status_code"`
	Event       string    `json:"event"`
	Action      string    `json:"action"`
	URL         string    `json:"url,omitempty"` // Only available in detailed view
	Repository  string    `json:"-"`             // Added by us to track which repo
	HookID      int       `json:"-"`             // Added by us to track which hook
}

Delivery represents a webhook delivery

type DeliveryDetail

type DeliveryDetail struct {
	Delivery
	Request struct {
		Headers map[string]string `json:"headers"`
		Payload interface{}       `json:"payload"`
	} `json:"request"`
	Response struct {
		Headers map[string]string `json:"headers"`
		Payload string            `json:"payload"`
	} `json:"response"`
}

DeliveryDetail represents a detailed webhook delivery with full information

type Hook

type Hook struct {
	ID     int    `json:"id"`
	URL    string `json:"url"`
	Active bool   `json:"active"`
	Config struct {
		URL string `json:"url"`
	} `json:"config"`
}

Hook represents a GitHub webhook

func (*Hook) GetTargetURL

func (h *Hook) GetTargetURL() string

GetWebhookTargetURL extracts the target URL from a webhook

func (*Hook) MatchesFilter

func (h *Hook) MatchesFilter(pattern string) bool

MatchesFilter checks if the webhook's target URL matches the filter pattern

Jump to

Keyboard shortcuts

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