github

package
v0.9.3 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2025 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Overview

Package github fetches GitHub profile data.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthRequired

func AuthRequired() bool

AuthRequired returns false because GitHub profiles are public.

func Match

func Match(urlStr string) bool

Match returns true if the URL is a GitHub profile URL.

Types

type APIError added in v0.5.0

type APIError struct {
	StatusCode      int
	RateLimitRemain int
	RateLimitReset  time.Time
	Message         string
	IsRateLimit     bool
}

APIError contains details about a GitHub API error.

func (*APIError) Error added in v0.5.0

func (e *APIError) Error() string

type Client

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

Client handles GitHub requests.

func New

func New(ctx context.Context, opts ...Option) (*Client, error)

New creates a GitHub client.

func (*Client) Fetch

func (c *Client) Fetch(ctx context.Context, urlStr string) (*profile.Profile, error)

Fetch retrieves a GitHub profile.

func (*Client) UsernameFromEmail added in v0.7.8

func (c *Client) UsernameFromEmail(ctx context.Context, email string) string

UsernameFromEmail looks up a GitHub username from an email address. It first searches users with the email, then falls back to searching commits. Returns empty string if no username is found.

type Option

type Option func(*config)

Option configures a Client.

func WithHTTPCache

func WithHTTPCache(httpCache httpcache.Cacher) Option

WithHTTPCache sets the HTTP cache.

func WithLogger

func WithLogger(logger *slog.Logger) Option

WithLogger sets a custom logger.

func WithToken added in v0.5.0

func WithToken(token string) Option

WithToken sets the GitHub API token.

Jump to

Keyboard shortcuts

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