github

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2020 License: GPL-3.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrFewerResultsThanDesired = fmt.Errorf("contains fewer results than desired")

ErrFewerResultsThanDesired is used to indicate that it was not possible to fulfill the request from the user (i.e., could not find the number of results specified by the user).

This is important to specify because, for example, in research you might want to guarantee that you are analyzing _exactly_ the number of projects specifed or the search query may need to be tweaked.

Functions

func Factory

func Factory(ctx context.Context, conf *search.BackendConfig) (search.Backend, error)

Factory is the factory function to be used to create a GitHub search backend.

Types

type Backend

type Backend struct {
	// contains filtered or unexported fields
}

Backend is a GitHub search backend.

func (*Backend) Search

func (b *Backend) Search(ctx context.Context, query string, numDesiredResults int) ([]project.Backend, error)

Search is the search function for searching GitHub for projects, code snippets, labels, topics, etc. and transparently paginating results.

type Client

type Client struct {
	SearchService     SearchService
	RepositoryService RepositoryService

	*github.Client
}

Client is a minimal wrapper of the *github.Client. This makes it possible to test the GitHub search backend by mocking the GitHub client.

type RepositoryService

type RepositoryService interface {
	// ListCommits lists the commits for a specific repository.
	ListCommits(context.Context, string, string, *github.CommitsListOptions) ([]*github.RepositoryCommit, *github.Response, error)
}

RepositoryService is the minimal repository search interface required by the GitHub search backend. https://github.com/google/go-github/issues/113#issuecomment-454308733

type SearchService

type SearchService interface {
	// Repositories returns the repositories for a given search query.
	Repositories(context.Context, string, *github.SearchOptions) (*github.RepositoriesSearchResult, *github.Response, error)
	Code(context.Context, string, *github.SearchOptions) (*github.CodeSearchResult, *github.Response, error)
}

SearchService is the minimal search service interface required by the GitHub search backend. https://github.com/google/go-github/issues/113#issuecomment-454308733

type URLRetriever

type URLRetriever interface {
	GetCloneURL() string
	GetHTMLURL() string
}

Jump to

Keyboard shortcuts

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