{"modulePath":"github.com/brigadecore/brigade-github-gateway","version":"v1.2.0","isLatest":true,"isStandardLibrary":false,"goos":"all","goarch":"all","docs":"# package github\n\n## Functions\n\n```go\nfunc NewClient(\n\tctx context.Context,\n\tappID int64,\n\tinstallationID int64,\n\tkeyPEM []byte,\n) (*github.Client, error)\n```\nNewClient 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.\n\nSee the following for further details: [https://docs.github.com/en/developers/apps/authenticating-with-github-apps](https://docs.github.com/en/developers/apps/authenticating-with-github-apps)\n\n## Types\n\n```go\ntype App struct {\n\t// AppID specifies the ID of the GitHub App.\n\tAppID int64 `json:\"appID\"`\n\t// SharedSecret is the secret mutually agreed upon by this gateway and the\n\t// GitHub App. This secret can be used to validate the authenticity and\n\t// integrity of payloads received by this gateway.\n\tSharedSecret string `json:\"sharedSecret\"`\n\t// APIKey is the private API key for the GitHub App.\n\tAPIKey string `json:\"apiKey\"`\n}\n```\nApp encapsulates the details of a GitHub App that sends webbooks to this gateway.\n\n```go\ntype CheckRunsClient interface {\n\tCreateCheckRun(\n\t\tctx context.Context,\n\t\towner string,\n\t\trepo string,\n\t\topts github.CreateCheckRunOptions,\n\t) (*github.CheckRun, *github.Response, error)\n\tUpdateCheckRun(\n\t\tctx context.Context,\n\t\towner string,\n\t\trepo string,\n\t\tcheckRunID int64,\n\t\topts github.UpdateCheckRunOptions,\n\t) (*github.CheckRun, *github.Response, error)\n}\n```\n\n```go\ntype CheckRunsClientFactory interface {\n\tNewCheckRunsClient(\n\t\tctx context.Context,\n\t\tappID int64,\n\t\tinstallationID int64,\n\t\tapiKey []byte,\n\t) (CheckRunsClient, error)\n}\n```\n\n```go\nfunc NewCheckRunsClientFactory() CheckRunsClientFactory\n```\n\n```go\ntype MockCheckRunsClient struct {\n\tCreateCheckRunFn func(\n\t\tctx context.Context,\n\t\towner string,\n\t\trepo string,\n\t\topts github.CreateCheckRunOptions,\n\t) (*github.CheckRun, *github.Response, error)\n\tUpdateCheckRunFn func(\n\t\tctx context.Context,\n\t\towner string,\n\t\trepo string,\n\t\tcheckRunID int64,\n\t\topts github.UpdateCheckRunOptions,\n\t) (*github.CheckRun, *github.Response, error)\n}\n```\n\n```go\nfunc (m *MockCheckRunsClient) CreateCheckRun(\n\tctx context.Context,\n\towner string,\n\trepo string,\n\topts github.CreateCheckRunOptions,\n) (*github.CheckRun, *github.Response, error)\n```\n\n```go\nfunc (m *MockCheckRunsClient) UpdateCheckRun(\n\tctx context.Context,\n\towner string,\n\trepo string,\n\tcheckRunID int64,\n\topts github.UpdateCheckRunOptions,\n) (*github.CheckRun, *github.Response, error)\n```\n\n```go\ntype MockCheckRunsClientFactory struct {\n\tNewCheckRunsClientFn func(\n\t\tctx context.Context,\n\t\tappID int64,\n\t\tinstallationID int64,\n\t\tapiKey []byte,\n\t) (CheckRunsClient, error)\n}\n```\n\n```go\nfunc (m *MockCheckRunsClientFactory) NewCheckRunsClient(\n\tctx context.Context,\n\tappID int64,\n\tinstallationID int64,\n\tapiKey []byte,\n) (CheckRunsClient, error)\n```\n\n","path":"github.com/brigadecore/brigade-github-gateway/internal/github","name":"github","synopsis":"","isRedistributable":true}
