Documentation ¶
Overview ¶
Package githubrepo implements clients.RepoClient for GitHub.
Index ¶
- Variables
- func CreateGithubRepoClient(ctx context.Context, client *github.Client, graphClient *githubv4.Client) clients.RepoClient
- func MakeGitHubTransport(innerTransport http.RoundTripper, accessTokens []string) http.RoundTripper
- type Client
- func (client *Client) Close() error
- func (client *Client) GetDefaultBranch() (clients.BranchRef, error)
- func (client *Client) GetFileContent(filename string) ([]byte, error)
- func (client *Client) InitRepo(owner, repoName string) error
- func (client *Client) IsArchived() (bool, error)
- func (client *Client) ListCommits() ([]clients.Commit, error)
- func (client *Client) ListFiles(predicate func(string) (bool, error)) ([]string, error)
- func (client *Client) ListMergedPRs() ([]clients.PullRequest, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // RemainingTokens measures the remaining number of API tokens. RemainingTokens = stats.Int64("RemainingTokens", "Measures the remaining count of API tokens", stats.UnitDimensionless) // TokenIndex is the tag key for specifying a unique token. TokenIndex = tag.MustNewKey("tokenIndex") // ResourceType specifies the type of GitHub resource. ResourceType = tag.MustNewKey("resourceType") // GithubTokens tracks the usage/remaining stats per token per resource-type. GithubTokens = view.View{ Name: "GithubTokens", Description: "Token usage/remaining stats for Github API tokens", Measure: RemainingTokens, TagKeys: []tag.Key{TokenIndex, ResourceType}, Aggregation: view.LastValue(), } )
Functions ¶
func CreateGithubRepoClient ¶
func CreateGithubRepoClient(ctx context.Context, client *github.Client, graphClient *githubv4.Client) clients.RepoClient
CreateGithubRepoClient returns a Client which implements RepoClient interface.
func MakeGitHubTransport ¶
func MakeGitHubTransport(innerTransport http.RoundTripper, accessTokens []string) http.RoundTripper
MakeGitHubTransport wraps input RoundTripper with GitHub authorization logic.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is GitHub-specific implementation of RepoClient.
func (*Client) GetDefaultBranch ¶
GetDefaultBranch implements RepoClient.GetDefaultBranch.
func (*Client) GetFileContent ¶
GetFileContent implements RepoClient.GetFileContent.
func (*Client) InitRepo ¶
InitRepo sets up the GitHub repo in local storage for improving performance and GitHub token usage efficiency.
func (*Client) IsArchived ¶ added in v2.1.3
IsArchived implements RepoClient.IsArchived.
func (*Client) ListCommits ¶ added in v2.1.3
ListCommits implements RepoClient.ListCommits.
func (*Client) ListMergedPRs ¶
func (client *Client) ListMergedPRs() ([]clients.PullRequest, error)
ListMergedPRs implements RepoClient.ListMergedPRs.
Click to show internal directories.
Click to hide internal directories.