Documentation ¶
Index ¶
- func RepoFromGitHub(r *github.Repository) host.Repo
- func ReposFromGitHub(rs []*github.Repository) []host.Repo
- type AppAuth
- type Client
- func (c *Client) GetIssues(ctx context.Context, user, repo string, filter ItemFilter, ...) error
- func (c *Client) GetPullRequests(ctx context.Context, user, repo string, filter ItemFilter, ...) error
- func (c *Client) GetRepository(ctx context.Context, owner, repo string) (*github.Repository, error)
- func (c *Client) InstallationToken() string
- type Event
- type InstallationAuth
- type IssueState
- type ItemFilter
- type Repo
- type SigningClient
- type SyncOptions
- type Syncer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func RepoFromGitHub ¶
func RepoFromGitHub(r *github.Repository) host.Repo
RepoFromGitHub wraps a github repository in a Repo
func ReposFromGitHub ¶
func ReposFromGitHub(rs []*github.Repository) []host.Repo
ReposFromGitHub wraps a slice of repositories in a slice of Repos
Types ¶
type AppAuth ¶
AppAuth is a container for authorization configuration
func NewEnvAuth ¶
func NewEnvAuth() *AppAuth
NewEnvAuth instantiates authentication from environment variables
func (*AppAuth) GenerateJWT ¶
GenerateJWT signs a new JWT for use with the GitHub API
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client handles GitHub sync and API requests
func NewClient ¶
func NewClient(ctx context.Context, l *zap.SugaredLogger, auth oauth2.TokenSource) (*Client, error)
NewClient instantiates a new github client. This package offers several implementations of auth, and different clients should be instantiated for different purposes.
- a "signing client" should use AppAuth and NewSigningClient, and only be used to create installation clients.
- a "installation client" should use InstallationAuth, and only be created from a SigningClient
- a "default client" should use nil auth, and be used for unauthenticated requests
func (*Client) GetIssues ¶
func (c *Client) GetIssues( ctx context.Context, user, repo string, filter ItemFilter, issuesC chan<- *github.Issue, wait *sync.WaitGroup, ) error
GetIssues retrieves all issues for a project
func (*Client) GetPullRequests ¶
func (c *Client) GetPullRequests( ctx context.Context, user, repo string, filter ItemFilter, prC chan<- *github.PullRequest, wait *sync.WaitGroup, ) error
GetPullRequests retrieves all pull requests for a project
func (*Client) GetRepository ¶
GetRepository fetches the given repository
func (*Client) InstallationToken ¶
InstallationToken returns the token in use by the client, if there is one
type Event ¶
type Event struct { GitHubEvent string `json:"X-GitHub-Event"` GitHubDelivery string `json:"X-GitHub-Delivery"` HubSignature string `json:"X-Hub-Signature"` }
Event denotes basic event metadata
type InstallationAuth ¶
type InstallationAuth struct { ID int64 // contains filtered or unexported fields }
InstallationAuth contains parameters for a specific installation
func NewInstallationAuth ¶
func NewInstallationAuth(ctx context.Context, gh *github.Client, logger *zap.SugaredLogger, id string) (*InstallationAuth, error)
NewInstallationAuth instantiates a new installation-specific token generator
type IssueState ¶
type IssueState string
IssueState denotes whether to get issues that are closed, open, or all
const ( // IssueStateAll = all issues IssueStateAll IssueState = "all" // IssueStateClosed = closed issues IssueStateClosed IssueState = "closed" // IssueStateOpen = open issues IssueStateOpen IssueState = "open" )
type ItemFilter ¶
type ItemFilter struct { MinNumber int State IssueState Interval time.Duration }
ItemFilter denotes options to filter issues and PRs by
type SigningClient ¶
type SigningClient struct {
// contains filtered or unexported fields
}
SigningClient is a client dedicated to generating installation clients and doing other app-management stuff
func NewSigningClient ¶
func NewSigningClient(l *zap.SugaredLogger, auth oauth2.TokenSource) (*SigningClient, error)
NewSigningClient instantiates a new SigningClient
func (*SigningClient) GetInstallationClient ¶
GetInstallationClient gets an installation-specific client
type SyncOptions ¶
type SyncOptions struct { Repo Repo Filter ItemFilter DetailsFetchWorkers int OutputBufferSize int }
SyncOptions denotes options for a syncer
type Syncer ¶
type Syncer struct {
// contains filtered or unexported fields
}
Syncer manages all GitHub synchronization tasks
func NewSyncer ¶
func NewSyncer( l *zap.SugaredLogger, client *Client, opts SyncOptions, ) *Syncer
NewSyncer instantiates a new GitHub Syncer. It Syncer::Sync() can only be used once. TODO: should it be reusable?