counters

package
v1.3.2 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2026 License: MIT Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package counters counts live activity through the GitHub API.

It reuses the token `gh auth login` already stored (or GH_TOKEN), so nobody creates a token for this tool. Without one it falls back to the public REST API: merged PRs and stars still count, GraphQL-only data (answers, sponsorships, highlight flags) does not.

Package counters aggregates public contribution metrics including pull requests, repository stars, and accepted discussion answers.

Index

Constants

This section is empty.

Variables

View Source
var ErrRateLimited = errors.New("GitHub's API rate limit for anonymous use was hit; run `gh auth login`")

ErrRateLimited is the unauthenticated API saying no; `gh auth login` lifts it.

Functions

This section is empty.

Types

type Facts

type Facts struct {
	AcceptedAnswers int
	Sponsoring      int
	Flags           map[string]bool // highlight GraphQL field → value
}

Facts are the GraphQL-only user fields.

type MergedPRs

type MergedPRs struct {
	Total int      // GitHub search's issueCount: right even past the listing cap
	Refs  []string // "owner/repo#123", oldest merge first; may be shorter than Total
}

MergedPRs is the result of counting a user's merged pull requests.

func (MergedPRs) IsComplete

func (m MergedPRs) IsComplete() bool

IsComplete reports whether every merged PR was listed, which calibration needs.

type Source

type Source interface {
	IsAuthenticated() bool
	MergedPRs(user string) (MergedPRs, error)
	MaxOwnedStars(user string) (stars int, repo string, err error)
	RepoStars(repo string) (int, error)
	Facts(user string, flagFields []string) (*Facts, error) // nil without a token
}

Source counts activity for one user.

func New

func New() Source

New returns a Source using the gh login when there is one.

func NewWithToken

func NewWithToken(token string) (Source, error)

NewWithToken counts with an explicit token: the site's bot token, or a signed-in user's token for one request. Host, AuthToken, Transport and APIHost are all set, so go-gh takes no host, token or API host from a gh config. LogIgnoreEnv stops GH_DEBUG from turning on request logging: a user's token must never be written to a log.

Jump to

Keyboard shortcuts

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