github

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WebhookHandler added in v0.3.1

func WebhookHandler(handlers WebhookHandlers, secret string, logger *slog.Logger) http.Handler

WebhookHandler returns a generic GitHub Webhook handler for GitHub events.

Types

type Activity

type Activity interface {
	ListStargazers(ctx context.Context, owner string, repo string, opts *github.ListOptions) ([]*github.Stargazer, *github.Response, error)
}

type Client

type Client struct {
	Repositories
	Activity
}

func NewGitHubClient

func NewGitHubClient(token string) *Client

func (Client) Stargazers added in v0.3.1

func (c Client) Stargazers(ctx context.Context, user string, includeArchived bool) ([]Stargazer, error)

Stargazers returns the list of stargazers for a user's repositories. If includeArchived is true, archived repositories are included.

type Repositories

type Repositories interface {
	ListByUser(ctx context.Context, user string, opts *github.RepositoryListByUserOptions) ([]*github.Repository, *github.Response, error)
}

type Stargazer added in v0.3.1

type Stargazer struct {
	StarredAt   time.Time `json:"starred_at"`
	Action      string    `json:"-"`
	RepoName    string    `json:"repo_name"`
	RepoHTMLURL string    `json:"repo_html_url"`
	Login       string    `json:"login"`
	UserHTMLURL string    `json:"user_html_url"`
}

Stargazer represents a star from one user for one repository.

type WebhookHandlers added in v0.3.1

type WebhookHandlers struct {
	StarEvent func(context.Context, Stargazer) error
}

WebhookHandlers is a collection of handlers for GitHub events.

func (WebhookHandlers) Has added in v0.3.1

func (h WebhookHandlers) Has(evt string) bool

Has returns true if the handler for the given event is defined.

Jump to

Keyboard shortcuts

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