ghutil

package
v0.19.6 Latest Latest
Warning

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

Go to latest
Published: Mar 18, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const RateLimitThreshold = 10

Variables

This section is empty.

Functions

func AbuseRetryAfter

func AbuseRetryAfter(err error) time.Duration

AbuseRetryAfter returns the retry-after duration if the error is a secondary (abuse) rate limit error. Returns 0 if the error is not an abuse rate limit.

func CheckRateLimit

func CheckRateLimit(resp *github.Response)

func Deref

func Deref(s *string) string

func GetGitHubDeveloper

func GetGitHubDeveloper(ctx context.Context, client *http.Client, username string) (*data.Developer, error)

func GetLabels

func GetLabels(labels []*github.Label) []string

func GetOrgRepoNames

func GetOrgRepoNames(ctx context.Context, client *http.Client, org string) ([]string, error)

func GetOrgRepos

func GetOrgRepos(ctx context.Context, client *http.Client, org string) ([]*data.Repo, error)

func GetUserOrgs

func GetUserOrgs(ctx context.Context, client *http.Client, username string, limit int) ([]*data.Org, error)

func GetUsernames

func GetUsernames(users ...*github.User) []string

func MapGitHubUserToDeveloperListItem

func MapGitHubUserToDeveloperListItem(u *github.User) *data.DeveloperListItem

func MapOrg

func MapOrg(r *github.Organization) *data.Org

func MapRepo

func MapRepo(r *github.Repository) *data.Repo

func MapUserToDeveloper

func MapUserToDeveloper(u *github.User) *data.Developer

func ParseDate

func ParseDate(t *time.Time) string

func ParseUsers

func ParseUsers(body *string) []string

func RateInfo

func RateInfo(r *github.Rate) string

func SearchGitHubUsers

func SearchGitHubUsers(ctx context.Context, client *http.Client, query string, limit int) ([]*data.DeveloperListItem, error)

func Trim

func Trim(s *string) string

Types

type TokenPool added in v0.18.0

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

TokenPool manages a pool of GitHub API tokens using round-robin selection. Safe for concurrent use. Works transparently with a single token.

func NewTokenPool added in v0.18.0

func NewTokenPool(tokens ...string) *TokenPool

NewTokenPool creates a pool from one or more tokens. Tokens can be passed individually or as a single comma-separated string.

func (*TokenPool) Size added in v0.18.0

func (p *TokenPool) Size() int

Size returns the number of tokens in the pool.

func (*TokenPool) Token added in v0.18.0

func (p *TokenPool) Token() string

Token returns the next token in the round-robin rotation.

Jump to

Keyboard shortcuts

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