api

package
v0.0.0-...-3ff763c Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2016 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	NoComments bool
	NoForks    bool
	NoIssues   bool
	NoPrivate  bool
	NoPublic   bool
	NoReleases bool
	NoWikis    bool
	Token      string
	User       string

	TestURL string

	github.Rate
}

API holds fields and functions related to querying the GitHub API.

func NewAPI

func NewAPI(config config.Config, testTokenAnswer string) (api API, err error)

NewAPI reads config data and conditionally prompts for the API token (as a password prompt).

Always prompt for token if not specified. There are higher API limits for authenticated users.

:param config: Config struct value with options from the CLI.

:param testTokenAnswer: For testing. Don't prompt for token, use this value instead.

func (*API) Fields

func (a *API) Fields() logrus.Fields

Fields is for logging. Returns the field name and values of the API struct as a logrus.Fields value.

func (*API) GetGists

func (a *API) GetGists(ghGists *GitHubGists) error

GetGists retrieves the list of public and secret GitHub gists on the user's account.

:param ghGists: Add gists to this.

func (*API) GetRepos

func (a *API) GetRepos(ghRepos *GitHubRepos) error

GetRepos retrieves the list of public and private GitHub repos on the user's account.

:param ghRepos: Add repos to this.

type GitHubGist

type GitHubGist struct {
	Name        string
	Size        int
	Private     bool
	PushedAt    time.Time
	CloneURL    string
	HasComments bool
}

GitHubGist holds data for one GitHub Gist.

type GitHubGists

type GitHubGists []GitHubGist

GitHubGists is a slice of GitHubGist with attached convenience function receivers.

func (*GitHubGists) Counts

func (g *GitHubGists) Counts() map[string]int

Counts returns the number of gists (values) for specific types/categories (keys).

type GitHubRepo

type GitHubRepo struct {
	Name      string
	Size      int
	Fork      bool
	Private   bool
	PushedAt  time.Time
	CloneURL  string
	WikiURL   string
	HasIssues bool
}

GitHubRepo holds data for one GitHub repository.

type GitHubRepos

type GitHubRepos []GitHubRepo

GitHubRepos is a slice of GitHubRepo with attached convenience function receivers.

func (*GitHubRepos) Counts

func (g *GitHubRepos) Counts() map[string]int

Counts returns the number of repos (values) for specific types/categories (keys).

Jump to

Keyboard shortcuts

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