github

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2026 License: MIT Imports: 5 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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	API      *gh.Client
	Username string
}

Client wraps the GitHub API client with the target username.

func NewClient

func NewClient(token, username string) *Client

NewClient creates a GitHub client for the given username. If token is empty, the client is unauthenticated (public API only, lower rate limits).

func (*Client) Context

func (c *Client) Context() context.Context

Context returns a background context.

func (*Client) EnsureProfileRepo

func (c *Client) EnsureProfileRepo() error

EnsureProfileRepo checks if the username/username repo exists, creates it if not.

func (*Client) FetchAllRepos

func (c *Client) FetchAllRepos() ([]Repo, error)

FetchAllRepos retrieves all owned, non-fork repositories with pagination.

func (*Client) FetchProfile

func (c *Client) FetchProfile() (*Profile, error)

FetchProfile retrieves the GitHub user profile and social accounts.

func (*Client) FetchRepoLanguages

func (c *Client) FetchRepoLanguages(repoName string) (map[string]int, error)

FetchRepoLanguages retrieves the language breakdown for a repository.

func (*Client) PushReadme

func (c *Client) PushReadme(content string) error

PushReadme creates or updates the README.md in the profile repo.

type Profile

type Profile struct {
	Login          string
	Name           string
	Bio            string
	Location       string
	Blog           string
	Twitter        string
	AvatarURL      string
	Followers      int
	Following      int
	PublicRepos    int
	SocialAccounts []SocialAccount
}

Profile holds the relevant user profile data.

type Repo

type Repo struct {
	Name        string
	Description string
	URL         string
	Stars       int
	Forks       int
	Language    string
	Languages   map[string]int
	PushedAt    time.Time
	Fork        bool
	Archived    bool
}

Repo holds relevant repository data.

type SocialAccount added in v0.2.0

type SocialAccount struct {
	Provider string `json:"provider"`
	URL      string `json:"url"`
}

SocialAccount represents a linked social account on a GitHub profile.

func (SocialAccount) DisplayName added in v0.2.0

func (a SocialAccount) DisplayName() string

DisplayName returns a human-readable name for the social account.

func (SocialAccount) SocialBadge added in v0.2.0

func (a SocialAccount) SocialBadge() string

SocialBadge returns a Shields.io badge URL for a social account.

func (*SocialAccount) UnmarshalJSON added in v0.2.0

func (a *SocialAccount) UnmarshalJSON(data []byte) error

UnmarshalJSON implements json.Unmarshaler.

Jump to

Keyboard shortcuts

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