github

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Sep 15, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TimeToday is limit of the current day.
	TimeToday = "daily"
	// TimeWeek will focus on the complete week
	TimeWeek = "weekly"
	// TimeMonth include the complete month
	TimeMonth = "monthly"
	// Default GitHub URL.
	RepoURL string = "https://api.github.com/search/repositories"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Owner

type Owner struct {
	Login string
}

Owner struct is the author of the repo.

type RepoTrending

type RepoTrending struct {
	FullName        string `json:"full_name"`
	HtmlURL         string `json:"html_url"`
	Description     string
	Owner           Owner
	CreatedAt       time.Time `json:"created_at"`
	UpdatedAt       time.Time `json:"updated_at"`
	PushedAt        time.Time `json:"pushed_at"`
	Size            int
	Language        string
	StargazersCount int `json:"stargazers_count"`
	ForksCount      int `json:"forks_count"`
	Archived        bool
	OpenIssuesCount int `json:"open_issues_count"`
	Topics          []string
}

RepoTrending is the treding repository reprentation.

func GetRepository

func GetRepository(apiURL, name, lang, author string) (*RepoTrending, error)

GetRepository returns a repository given the name of the repo, the underylying programming language and the author. The first option is cosindered mandatory. The latter parameters are optionals and empty strings can be safely passed into The function calls.

type TrendingSearchResult

type TrendingSearchResult struct {
	TotalCount int
	Items      []*RepoTrending
}

TrendingSearchResult struct holds an slice of trending repositories on GitHub and its count.

func GetTrendingRepos

func GetTrendingRepos(time, language string) (*TrendingSearchResult, error)

GetProjects provides a slice of Projects filtered by the given time and language.

func SearchGithubTrending

func SearchGithubTrending(term, APIurl string) (*TrendingSearchResult, error)

SearchGithubTrending function returns a list treding repositores on GitHub. The function returns this list in the form of a pointer to a TrendingSearchResult. If some thing wrong happens, it returns an error.

Jump to

Keyboard shortcuts

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