github

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: May 18, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package github is a minimal GitHub API client covering only the endpoints notifycat needs for validation. It is intentionally narrow — adding a new endpoint means adding one method, not pulling in go-github.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIError

type APIError struct {
	Method  string
	Status  int
	Message string
}

APIError represents a non-2xx GitHub response.

func (*APIError) Error

func (e *APIError) Error() string

type Client

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

Client talks to the GitHub REST API.

func NewClient

func NewClient(hc *http.Client, token string, opts ...Option) *Client

NewClient builds a Client. The httpClient is used as-is; callers should configure timeouts on it.

func (*Client) ListHookEvents

func (c *Client) ListHookEvents(ctx context.Context, owner, repo, urlSuffix string) ([]string, error)

ListHookEvents returns the union of events configured across active hooks pointing at notifycat (matched by `urlSuffix` against hook.config.url). Returns an empty slice when no matching hook exists, so callers can distinguish "no notifycat hook" from "hook misconfigured".

func (*Client) ListOrgRepos

func (c *Client) ListOrgRepos(ctx context.Context, org string) ([]string, error)

ListOrgRepos returns the names of every repository in the org, following GitHub's Link header for pagination. Empty result is a normal outcome (org with no repos or all repos filtered by token scope).

type Hook

type Hook struct {
	ID     int64    `json:"id"`
	Active bool     `json:"active"`
	Events []string `json:"events"`
	Config struct {
		URL string `json:"url"`
	} `json:"config"`
}

Hook is the subset of a repository webhook record we care about.

type Option

type Option func(*Client)

Option configures Client construction.

func WithBaseURL

func WithBaseURL(u string) Option

WithBaseURL overrides the GitHub API base URL.

Jump to

Keyboard shortcuts

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