ghtrending

package module
v0.0.0-...-9c70844 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2021 License: GPL-3.0 Imports: 5 Imported by: 0

README

ghtrending

API to fetch github trending

Usage

install package:

$ go get -u github.com/darjun/ghtrending

fetch trending repositories:

import "github.com/darjun/ghtrending"

t := ghtrending.New()
repos, err := t.FetchRepos()

fetch trending developers:

t := ghtrending.New()
developers, err := t.FetchDevelopers()

use options:

// Go weekly trending
t := ghtrending.New(ghtrending.WithWeekly(), ghtrending.WithLanguage("Go"))

// C++ monthly trending
t := ghtrending.New(ghtrending.WithMonthly(), ghtrending.WithLanguage("C++"))

// 中文
t := ghtrending.New(ghtrending.WithSpokenLanguageCode("cn"))

you don't need to create object:

repos := ghtrending.TrendingRepositories()
developers := ghtrending.TrendingDevelopers()

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithDaily

func WithDaily() option

func WithDateRange

func WithDateRange(dr string) option

func WithLanguage

func WithLanguage(lang string) option

func WithMonthly

func WithMonthly() option

func WithSpokenLanguageCode

func WithSpokenLanguageCode(code string) option

func WithSpokenLanguageFull

func WithSpokenLanguageFull(lang string) option

func WithURL

func WithURL(url string) option

func WithWeekly

func WithWeekly() option

Types

type Developer

type Developer struct {
	Name        string
	Username    string
	PopularRepo string
	Desc        string
}

Developer represent a developer in the developer trending list.

func TrendingDevelopers

func TrendingDevelopers(opts ...option) ([]*Developer, error)

TrendingRepositories fetch all developers from GitHub trending.

type Fetcher

type Fetcher interface {
	FetchRepos() ([]*Repository, error)
	FetchDevelopers() ([]*Developer, error)
}

Fetcher defines methods to fetch trending repos and developers

func New

func New(opts ...option) Fetcher

New returns a Fetcher

type Repository

type Repository struct {
	Author  string
	Name    string
	Link    string
	Desc    string
	Lang    string
	Stars   int
	Forks   int
	Add     int
	BuiltBy []string
}

Repository represent a repository in the trending list.

func TrendingRepositories

func TrendingRepositories(opts ...option) ([]*Repository, error)

TrendingRepositories fetch all repositories from GitHub trending.

Jump to

Keyboard shortcuts

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