github

package
v0.0.0-...-12fbc85 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 9, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultOrganization = "navikt"
)

Variables

This section is empty.

Functions

func NewHTTPClientFromGithubAppCredentials

func NewHTTPClientFromGithubAppCredentials(applicationID, installationID int64, privateKey string) (*http.Client, error)

Types

type Branch

type Branch struct {
	Name string
}

type Client

type Client struct {
	Org string
	// contains filtered or unexported fields
}

func New

func New(org string, ghc *github.Client) *Client

func NewFromHTTPClient

func NewFromHTTPClient(org string, c *http.Client) *Client

func (*Client) Branches

func (c *Client) Branches(ctx context.Context, r Repository) ([]Branch, error)

func (*Client) Repositories

func (c *Client) Repositories(ctx context.Context) ([]Repository, error)

type Fetcher

type Fetcher struct {
	// contains filtered or unexported fields
}

func NewFetcher

func NewFetcher(l Lister, log *logrus.Entry) *Fetcher

func (*Fetcher) Branches

func (s *Fetcher) Branches(ctx context.Context, repo Repository) (Repository, error)

func (*Fetcher) Refresh

func (s *Fetcher) Refresh(ctx context.Context) (int, error)

func (*Fetcher) Repositories

func (s *Fetcher) Repositories() map[string]Repository

func (*Fetcher) StartRefreshLoop

func (s *Fetcher) StartRefreshLoop(ctx context.Context, interval time.Duration)

type Lister

type Lister interface {
	Repositories(ctx context.Context) ([]Repository, error)
	Branches(ctx context.Context, r Repository) ([]Branch, error)
}

type Repository

type Repository struct {
	Name     string
	FullName string
	Branches []Branch
}

type StaticLister

type StaticLister struct {
	// contains filtered or unexported fields
}

func NewStaticLister

func NewStaticLister(repos []Repository, branches map[string][]Branch) *StaticLister

func (*StaticLister) Branches

func (s *StaticLister) Branches(_ context.Context, r Repository) ([]Branch, error)

func (*StaticLister) Repositories

func (s *StaticLister) Repositories(_ context.Context) ([]Repository, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL