github

package
v0.0.0-...-160fd46 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2018 License: MIT Imports: 9 Imported by: ? 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

View Source
const (

	// DefualtClientTag is used when the tag is "".
	DefualtClientTag = "defualt"
)

Variables

View Source
var (
	// ErrInvalidToken occurs when the token object is nil or token is "".
	ErrInvalidToken = errors.New("invalid token")
)

Functions

func IsTokenValid

func IsTokenValid(token *Token) error

IsTokenValid returns ErrInvalidToken if token is invalid.

Types

type Client

type Client struct {
	*github.Client

	Tag string
	// contains filtered or unexported fields
}

Client contains a available GitHub Client.

func NewClient

func NewClient(token *Token) (*Client, error)

NewClient returns a Client.

func (*Client) List

func (c *Client) List(owner, repo, path string) ([]*github.RepositoryContent, *github.Response, error)

List returns the contents of a file or directory in a repository.

https://developer.github.com/v3/repos/contents/#get-contents

func (*Client) Search

func (c *Client) Search(language string, pushed time.Duration, min, max, page int) (*github.RepositoriesSearchResult, *github.Response, error)

Search searches repositories via various criteria.

https://developer.github.com/v3/search/#search-repositories https://help.github.com/articles/searching-repositories

type Pool

type Pool interface {
	Get(string) *Client
	Put(*Client)
}

Pool provides Get and Put function.

func NewPool

func NewPool(tokens ...*Token) Pool

NewPool returns a GitHub Client Pool. It returns nil if there is no available Token.

type Token

type Token struct {
	Tag   string `json:"tag,omitempty"`
	Token string `json:"token"`
}

Token contains tag and github.

Jump to

Keyboard shortcuts

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