go_go_github_badge

package module
v0.0.0-...-28e780c Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2025 License: MIT Imports: 15 Imported by: 0

README

go go github badge

A golang port of github-badge. That version is written in python2 and targets Google App Engine.

In order to remove the dependency on GAE and run it in cleanly in a container, I made this port. It's functionality is almost identical with a few operational changes and the removal of the activity sparkline graph.

Screenshot

License

*.go: MIT, (c) 2021 Chetan Sarva

*.html (including css, images): MPL 2.0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateClient

func CreateClient()

func Generate

func Generate(username string) (string, error)

func GetForkCount

func GetForkCount(login string) (int, error)

func GetUser

func GetUser(username string) (*github.User, error)

func Run

func Run()

func SetAllowedUsers

func SetAllowedUsers(allowed []string)

Types

type ForkCount

type ForkCount struct {
	User struct {
		Repositories struct {
			TotalCount int
		} `graphql:"repositories(isFork: true)"`
	} `graphql:"user(login: $login)"`
}

type Lang

type Lang struct {
	Name  string
	Count int
}

type LatestContributions

type LatestContributions struct {
	User struct {
		Followers struct {
			TotalCount int
		}

		Repositories struct {
			TotalCount int
			Nodes      []struct {
				Name      string
				IsPrivate bool
				PushedAt  githubv4.DateTime

				DefaultBranchRef struct {
					Name   string
					Target struct {
						SpreadCommits struct {
							History struct {
								TotalCount int
							} `graphql:"history(since: $since)"`
						} `graphql:"... on Commit"`
					}
				}
			}
		} `graphql:"repositories(first: 10, orderBy: {field: PUSHED_AT, direction: DESC})"`

		ContributionsCollection struct {
			TotalCommitContributions int
			ContributionCalendar     struct {
				TotalContributions int
			}
			CommitContributionsByRepository []struct {
				Repository struct {
					UpdatedAt githubv4.DateTime
					Name      string
					URL       string
					IsPrivate bool
				}
				Contributions struct {
					TotalCount int
				}
			}
		} `graphql:"contributionsCollection(from: $from, to: $to)"`
	} `graphql:"user(login: $login)"`
}

func GetLatestContributions

func GetLatestContributions(user *github.User, days int) (*LatestContributions, error)

type RepoInfo

type RepoInfo struct {
	StargazerCount  int
	IsFork          bool
	PrimaryLanguage struct {
		Name string
	}
}

type RepoInfoQuery

type RepoInfoQuery struct {
	User struct {
		Repositories struct {
			PageInfo struct {
				HasNextPage bool
				EndCursor   string
			}
			Nodes []RepoInfo
		} `graphql:"repositories(first: 100, after: $cursor, orderBy: {field: PUSHED_AT, direction: DESC})"`
	} `graphql:"user(login: $login)"`
}

type RepoStats

type RepoStats struct {
	StargazerCount int
	Languages      []*Lang
}

func GetRepoStats

func GetRepoStats(login string) (*RepoStats, error)

Directories

Path Synopsis
bin

Jump to

Keyboard shortcuts

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