Documentation ¶
Index ¶
- func NewClient(ctx context.Context, appID int64, installationID int64, keyPEM []byte) (*github.Client, error)
- type App
- type CheckRunsClient
- type CheckRunsClientFactory
- type MockCheckRunsClient
- func (m *MockCheckRunsClient) CreateCheckRun(ctx context.Context, owner string, repo string, ...) (*github.CheckRun, *github.Response, error)
- func (m *MockCheckRunsClient) UpdateCheckRun(ctx context.Context, owner string, repo string, checkRunID int64, ...) (*github.CheckRun, *github.Response, error)
- type MockCheckRunsClientFactory
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewClient ¶
func NewClient( ctx context.Context, appID int64, installationID int64, keyPEM []byte, ) (*github.Client, error)
NewClient returns a new GitHub API client. This function abstracts the onerous process of authenticating as an installation. It uses the provided appID and ASCII-armored x509 certificate key to create a JWT (JSON web token) that is used to authenticate to the GitHub Apps API. Using that API, an installation token is obtained for the given installationID. This token is ultimately used by the returned client to authenticate as the specified installation.
See the following for further details: https://docs.github.com/en/developers/apps/authenticating-with-github-apps
Types ¶
type App ¶ added in v0.3.0
type App struct { // AppID specifies the ID of the GitHub App. AppID int64 `json:"appID"` // GitHub App. This secret can be used to validate the authenticity and // integrity of payloads received by this gateway. SharedSecret string `json:"sharedSecret"` // APIKey is the private API key for the GitHub App. APIKey string `json:"apiKey"` }
App encapsulates the details of a GitHub App that sends webbooks to this gateway.
type CheckRunsClient ¶
type CheckRunsClient interface { CreateCheckRun( ctx context.Context, owner string, repo string, opts github.CreateCheckRunOptions, ) (*github.CheckRun, *github.Response, error) UpdateCheckRun( ctx context.Context, owner string, repo string, checkRunID int64, opts github.UpdateCheckRunOptions, ) (*github.CheckRun, *github.Response, error) }
type CheckRunsClientFactory ¶
type CheckRunsClientFactory interface { NewCheckRunsClient( ctx context.Context, appID int64, installationID int64, apiKey []byte, ) (CheckRunsClient, error) }
func NewCheckRunsClientFactory ¶
func NewCheckRunsClientFactory() CheckRunsClientFactory
type MockCheckRunsClient ¶
type MockCheckRunsClient struct { CreateCheckRunFn func( ctx context.Context, owner string, repo string, opts github.CreateCheckRunOptions, ) (*github.CheckRun, *github.Response, error) UpdateCheckRunFn func( ctx context.Context, owner string, repo string, checkRunID int64, opts github.UpdateCheckRunOptions, ) (*github.CheckRun, *github.Response, error) }
func (*MockCheckRunsClient) CreateCheckRun ¶
func (*MockCheckRunsClient) UpdateCheckRun ¶
type MockCheckRunsClientFactory ¶
type MockCheckRunsClientFactory struct { NewCheckRunsClientFn func( ctx context.Context, appID int64, installationID int64, apiKey []byte, ) (CheckRunsClient, error) }
func (*MockCheckRunsClientFactory) NewCheckRunsClient ¶
func (m *MockCheckRunsClientFactory) NewCheckRunsClient( ctx context.Context, appID int64, installationID int64, apiKey []byte, ) (CheckRunsClient, error)