githubapp

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2026 License: Apache-2.0 Imports: 23 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrUnconfiguredHost = errors.New("GitHub request host is not configured")

Functions

func EndpointURL

func EndpointURL(base *url.URL, segments ...string) string

func NewHTTPClient

func NewHTTPClient(caPEM []byte, endpoints Endpoints, timeout time.Duration) (*http.Client, error)

func SetAPIHeaders

func SetAPIHeaders(header http.Header, apiVersion string)

Types

type Client

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

func NewClient

func NewClient(endpoints Endpoints, httpClient *http.Client, signer *Signer, apiVersion string, maxBytes int64, now func() time.Time, metricSet ...*observability.Metrics) *Client

func (*Client) DefaultBranchSHA

func (c *Client) DefaultBranchSHA(ctx context.Context, installationID int64, owner, name, branch string) (string, error)

func (*Client) DependencySBOM

func (c *Client) DependencySBOM(ctx context.Context, installationID int64, owner, name string) (SBOM, bool, error)

func (*Client) DownloadArchive

func (c *Client) DownloadArchive(ctx context.Context, owner, repository, sha, token string) (io.ReadCloser, error)

func (*Client) InstallationRepositories

func (c *Client) InstallationRepositories(ctx context.Context, installationID int64) ([]Repository, error)

func (*Client) InstallationToken

func (c *Client) InstallationToken(ctx context.Context, installationID int64, repositoryIDs []int64) (Token, error)

func (*Client) Installations

func (c *Client) Installations(ctx context.Context) ([]Installation, error)

func (*Client) ReadContents

func (c *Client) ReadContents(ctx context.Context, installationID int64, owner, name, path, ref string, maxBytes int64) (Content, error)

func (*Client) SearchCode

func (c *Client) SearchCode(ctx context.Context, installationID int64, query string, repositoryIDs []int64) (api.SearchResponse, error)

SearchCode performs a deliberately best-effort installation-scoped code search. GitHub does not provide an exact-commit consistency guarantee here.

type Content

type Content struct {
	Type     string `json:"type"`
	Encoding string `json:"encoding"`
	Content  string `json:"content"`
	SHA      string `json:"sha"`
	Size     int64  `json:"size"`
}

type Endpoints

type Endpoints struct {
	Web, API, Upload, Git, Archive *url.URL
}

type HTTPStatusError

type HTTPStatusError struct {
	StatusCode  int
	RateLimited bool
}

func (HTTPStatusError) Error

func (err HTTPStatusError) Error() string

func (HTTPStatusError) HTTPStatus

func (err HTTPStatusError) HTTPStatus() int

func (HTTPStatusError) IsRateLimited

func (err HTTPStatusError) IsRateLimited() bool

type Installation

type Installation struct {
	ID           int64
	AccountLogin string
	AccountType  string
	Status       string
	SuspendedAt  *time.Time
}

type ReconcileAPI

type ReconcileAPI interface {
	Installations(context.Context) ([]Installation, error)
	InstallationRepositories(context.Context, int64) ([]Repository, error)
	DefaultBranchSHA(context.Context, int64, string, string, string) (string, error)
}

type ReconcileStore

type ReconcileStore interface {
	InstallationIDs(context.Context) ([]int64, error)
	ReconcileInstallation(context.Context, Installation, []Repository) error
	DisableInstallation(context.Context, int64, string) error
}

type Reconciler

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

func NewReconciler

func NewReconciler(client *Client, store ReconcileStore) *Reconciler

func (*Reconciler) All

func (r *Reconciler) All(ctx context.Context) error

func (*Reconciler) Installation

func (r *Reconciler) Installation(ctx context.Context, installationID int64) error

type Repository

type Repository struct {
	ID             int64
	InstallationID int64
	SizeBytes      int64
	FullName       string
	Owner          string
	Name           string
	CloneURL       string
	HTMLURL        string
	DefaultBranch  string
	DefaultSHA     string
	Private        bool
	Archived       bool
	Disabled       bool
}

type SBOM

type SBOM struct {
	DocumentSPDXID    string
	DocumentDescribes []string
	Packages          []SBOMPackage
	Relationships     []SBOMRelationship
}

type SBOMPackage

type SBOMPackage struct {
	SPDXID string
	PURLs  []string
}

type SBOMRelationship

type SBOMRelationship struct {
	SPDXElementID      string
	Type               string
	RelatedSPDXElement string
}

type Signer

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

func NewSigner

func NewSigner(appID int64, pemBytes []byte, now func() time.Time) (*Signer, error)

func (*Signer) JWT

func (signer *Signer) JWT() (string, error)

type Token

type Token struct {
	Value     string
	ExpiresAt time.Time
}

Jump to

Keyboard shortcuts

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