github

package
v0.0.0-...-cb0b8ae Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cache

type Cache interface {
	// SetRepoBranchStatus writes repo branch status to the cache.
	SetRepoBranchStatus(owner, repo, branch, status string) error
	// GetRepoBranchStatus reads repo branch status from the cache. The empty
	// string is a legitimate return value that indicates the empty string was
	// actually found in the cache. Cache misses return an *ErrCacheMiss.
	GetRepoBranchStatus(
		owner string,
		repo string,
		branch string,
		warm bool,
	) (string, error)
	// SetCheckSuiteStatus writes github.CheckSuiteStatus to the cache.
	SetCheckSuiteStatus(
		appID int,
		owner string,
		repo string,
		branch string,
		status *CheckSuiteStatus,
	) error
	// GetCheckSuiteStatus reads a github.CheckSuiteStatus from the cache. nil is
	// a legitimate return value that indicates nil was actually found in the
	// cache. Cache misses return an *ErrCacheMiss.
	GetCheckSuiteStatus(
		appID int,
		owner string,
		repo string,
		branch string,
		warm bool,
	) (*CheckSuiteStatus, error)
	// TestConnection tests the connection to the underlying cache service (if
	// there is one).
	TestConnection() error
}

Cache is the public interface for any component that can store results to allow continuity of service in the event that Badgr cannot reach GitHub or (more likely) gets rate-limited by GitHub.

type CheckSuiteStatus

type CheckSuiteStatus struct {
	Status     string `json:"status"`
	Conclusion string `json:"conclusion"`
}

CheckSuiteStatus encapsulates both the status and conclusion of

type Client

type Client interface {
	// 	GetRepoBranchStatus returns the status of the the specified repository
	// 	branch.
	GetRepoBranchStatus(
		ctx context.Context,
		owner string,
		repo string,
		branch string,
	) (string, error)
	// GetCheckSuiteStatus returns the status of the check suite for the specified
	// appID, owner, repo, and branch.
	GetCheckSuiteStatus(
		ctx context.Context,
		appID int,
		owner string,
		repo string,
		branch string,
	) (*CheckSuiteStatus, error)
	// TestCacheConnection test makes the implementation of the Cache interface
	// (if one is in use) test its connection to the underlying cache service (if
	// it uses one).
	TestCacheConnection() error
}

Client is the public interface for our custom GitHub client

func NewClient

func NewClient(cache Cache) Client

NewClient returns a new GitHub client.

type ErrCacheMiss

type ErrCacheMiss struct{}

ErrCacheMiss represents a cache miss.

func (*ErrCacheMiss) Error

func (e *ErrCacheMiss) Error() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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