Documentation ¶
Index ¶
- func GetAccessToken(ctx context.Context, logger *zap.Logger, ...) (string, error)
- func GetFirstAccessToken(ctx context.Context, gitHubAppConfig *config.GitHubAppConfig, ...) (*gh.InstallationToken, error)
- func NewInstallationClient(gitHubAppConfig *config.GitHubAppConfig, installationID int64) (tokenClient *GitHubClients, appsClient AppsClient, err error)
- type AppClientProvider
- type AppsClient
- type GitHubClients
- type InstallationClientProvider
- type PersonalClientProvider
- type PullRequestsClient
- type RepositoriesClient
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetAccessToken ¶
func GetAccessToken(ctx context.Context, logger *zap.Logger, gitHubAppConfig *config.GitHubAppConfig, installation *github.GitHubInstallation, gitHubRepositoryID int64, repo db.GitHubRepositoryRepo, githubClientProvider InstallationClientProvider) (string, error)
func GetFirstAccessToken ¶
func GetFirstAccessToken(ctx context.Context, gitHubAppConfig *config.GitHubAppConfig, installation *github.GitHubInstallation, gitHubRepositoryID int64, githubClientProvider InstallationClientProvider) (*gh.InstallationToken, error)
func NewInstallationClient ¶
func NewInstallationClient(gitHubAppConfig *config.GitHubAppConfig, installationID int64) (tokenClient *GitHubClients, appsClient AppsClient, err error)
NewInstallationClient creates a client for installationID that's acting on behalf of the app
Types ¶
type AppClientProvider ¶
type AppClientProvider func(gitHubAppConfig *config.GitHubAppConfig) (appsClient AppsClient, err error)
type AppsClient ¶
type AppsClient interface { CreateInstallationToken(ctx context.Context, id int64, opts *github.InstallationTokenOptions) (*github.InstallationToken, *github.Response, error) GetInstallation(ctx context.Context, id int64) (*github.Installation, *github.Response, error) Get(ctx context.Context, appSlug string) (*github.App, *github.Response, error) }
func NewAppClient ¶
func NewAppClient(gitHubAppConfig *config.GitHubAppConfig) (appsClient AppsClient, err error)
NewAppClient creates a client for the app (not authenticated towards any installation)
type GitHubClients ¶
type GitHubClients struct { Repositories RepositoriesClient PullRequests PullRequestsClient }
func NewPersonalClient ¶
func NewPersonalClient(personalOauthToken string) (personalClient *GitHubClients, err error)
NewPersonalClient returns a client that users the users GitHub OAuth token to act on their behalf On GitHub these actions shows up as "$USERNAME via Sturdy"
type InstallationClientProvider ¶
type InstallationClientProvider func(gitHubAppConfig *config.GitHubAppConfig, installationID int64) (tokenClient *GitHubClients, appsClient AppsClient, err error)
type PersonalClientProvider ¶
type PersonalClientProvider func(personalOauthToken string) (personalClient *GitHubClients, err error)
type PullRequestsClient ¶
type PullRequestsClient interface { List(ctx context.Context, owner string, repo string, opts *github.PullRequestListOptions) ([]*github.PullRequest, *github.Response, error) Create(ctx context.Context, owner string, repo string, pull *github.NewPullRequest) (*github.PullRequest, *github.Response, error) Get(ctx context.Context, owner string, repo string, number int) (*github.PullRequest, *github.Response, error) Edit(ctx context.Context, owner string, repo string, number int, pull *github.PullRequest) (*github.PullRequest, *github.Response, error) }
type RepositoriesClient ¶
type RepositoriesClient interface { Get(ctx context.Context, owner, repo string) (*github.Repository, *github.Response, error) GetByID(ctx context.Context, id int64) (*github.Repository, *github.Response, error) ListCollaborators(ctx context.Context, owner, repo string, opts *github.ListCollaboratorsOptions) ([]*github.User, *github.Response, error) }
Click to show internal directories.
Click to hide internal directories.