Documentation
¶
Overview ¶
Package externalapi wraps the third-party web APIs allbctl talks to behind small interfaces, so callers can be tested without the network.
Index ¶
Constants ¶
const GithubAuthEnvVar = "GITHUB_TOKEN"
GithubAuthEnvVar is the name of the environment variable the GitHub CLI and allbctl read an access token from. See https://cli.github.com/manual/gh_help_environment (GH_TOKEN is the other default).
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type GithubAuthTokenProvider ¶
type GithubAuthTokenProvider struct{}
GithubAuthTokenProvider reads the GitHub access token from the environment.
func (*GithubAuthTokenProvider) GetAuthToken ¶
func (provider *GithubAuthTokenProvider) GetAuthToken() (string, error)
GetAuthToken returns the token held in GithubAuthEnvVar, or an error when the variable is unset or empty.
type GithubClient ¶
type GithubClient struct {
Users githubUsersService
Search githubSearchService
}
GithubClient is this program's facade of github API client
type GithubClientProvider ¶
type GithubClientProvider struct{}
GithubClientProvider allows consumer to get a GithubClient
func (*GithubClientProvider) GetGithubClient ¶
func (provider *GithubClientProvider) GetGithubClient(ctx context.Context, accessToken string) (GithubClient, error)
GetGithubClient returns a GithubClient whose requests carry accessToken. ctx supplies the HTTP client used for those requests (see oauth2.NewClient); building the client performs no network I/O.
type IGithubClientProvider ¶ added in v0.0.9
type IGithubClientProvider interface {
GetGithubClient(ctx context.Context, accessToken string) (client GithubClient, err error)
}
IGithubClientProvider builds a GithubClient authenticated with an access token.
type IGithubTokenProvider ¶ added in v0.0.9
IGithubTokenProvider supplies a GitHub access token.