github

package
v0.0.0-...-e2ffb22 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2018 License: BSD-2-Clause, BSD-3-Clause Imports: 19 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrInvalidPackage = errors.New("the package is not a Go package")
View Source
var ErrInvalidRepository = errors.New("the repository is not found")
View Source
var ErrRateLimited = errors.New("Github rate limited")

Functions

This section is empty.

Types

type Package

type Package struct {
	Name        string // package "name"
	Path        string // Relative path to the repository
	Description string
	ReadmeFn    string // No directory info
	ReadmeData  string // Raw content, cound be md, txt, etc.
	Imports     []string
	TestImports []string
}

type Spider

type Spider struct {
	FileCache spider.FileCache
	// contains filtered or unexported fields
}

func NewSpiderWithContents

func NewSpiderWithContents(contents map[string]string) *Spider

func NewSpiderWithToken

func NewSpiderWithToken(token string) *Spider

func (*Spider) ReadPackage

func (s *Spider) ReadPackage(ctx context.Context, user, repo, path string) (*Package, []*gpb.FolderInfo, error)

Even an error is returned, the folders may still contain useful elements.

func (*Spider) ReadRepo

func (s *Spider) ReadRepo(ctx context.Context, user, repo, sha string, f func(path string, pkg *gpb.Package) error) error

ReadRepo reads all packages of a repository. For pkg given to f, it will not be reused. path in f is relative to the repository path.

func (*Spider) ReadRepository

func (s *Spider) ReadRepository(ctx context.Context, user, name string) (*gpb.RepoInfo, error)

func (*Spider) ReadUser

func (s *Spider) ReadUser(ctx context.Context, name string) (*User, error)

func (*Spider) RepoBranchSHA

func (s *Spider) RepoBranchSHA(ctx context.Context, owner, repo, branch string) (sha string, err error)

func (*Spider) SearchRepositories

func (s *Spider) SearchRepositories(ctx context.Context, q string) ([]github.Repository, error)

type User

type User struct {
	Repos map[string]*gpb.RepoInfo
}

Jump to

Keyboard shortcuts

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