github

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2026 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

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 wraps the GitHub API with rate-limit handling and stargazer sampling.

func NewClient

func NewClient(token string) *Client

NewClient creates a Client. If token is empty, unauthenticated (60 req/hr).

func NewClientWith

func NewClientWith(ghClient *gh.Client, clock func() time.Time) *Client

NewClientWith creates a Client with an injected go-github client (for testing).

func (*Client) FetchRepoInfo

func (c *Client) FetchRepoInfo(ctx context.Context, owner, repo string) (model.RepoInfo, error)

FetchRepoInfo retrieves basic repository statistics.

func (*Client) FetchStargazers

func (c *Client) FetchStargazers(ctx context.Context, owner, repo string, totalStars int) ([]StargazerEntry, error)

FetchStargazers retrieves stargazers with timestamps. For repos with <= maxStargazersFullScan stars, fetches all. For larger repos, samples pages randomly to get ~sampleSize entries.

func (*Client) FetchTotalIssues

func (c *Client) FetchTotalIssues(ctx context.Context, owner, repo string) (int, error)

FetchTotalIssues returns the total number of issues (open + closed) via search.

func (*Client) FetchUserProfile

func (c *Client) FetchUserProfile(ctx context.Context, login string) (model.StargazerProfile, error)

FetchUserProfile fetches a user's profile for stargazer classification.

func (*Client) FetchUserProfiles

func (c *Client) FetchUserProfiles(ctx context.Context, logins []string) ([]model.StargazerProfile, int)

FetchUserProfiles fetches profiles for multiple users with concurrency control. Returns only successfully fetched profiles and the count of failures.

type ProfileResult

type ProfileResult struct {
	Profile model.StargazerProfile
	Err     error
}

ProfileResult pairs a successfully fetched profile with its error state.

type StargazerEntry

type StargazerEntry struct {
	Login     string
	StarredAt time.Time
}

StargazerEntry pairs a login with the time they starred.

Jump to

Keyboard shortcuts

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