github

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Nov 11, 2025 License: Apache-2.0 Imports: 11 Imported by: 1

Documentation

Index

Constants

View Source
const StepNameAuthLogin = "gh auth login"

Variables

This section is empty.

Functions

func GHLoginStep

func GHLoginStep(opts GHLoginOpts) *bootstrap.Step

func PackageSource

func PackageSource(
	ghc *Client,
	owner, repo, tag string,
	assetMatch func(*Release, *ReleaseAsset) bool,
) apt.PackageSource[*ghr]

Types

type Client

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

Client provides a rudimentary client for acccessing GitHub resources over its REST api, without pulling in large dependencies.

func NewClient

func NewClient(opts ...ClientOpt) *Client

func (*Client) Do

func (c *Client) Do(req *http.Request) (*http.Response, error)

func (*Client) DoAndParse

func (c *Client) DoAndParse(req *http.Request, respData any) error

func (*Client) Download

func (c *Client) Download(ctx context.Context, url string) (*http.Response, error)

func (*Client) DownloadReq

func (c *Client) DownloadReq(ctx context.Context, url string) (*http.Request, error)

func (*Client) Get

func (c *Client) Get(ctx context.Context, path string, respData any) error

func (*Client) GetRelease

func (c *Client) GetRelease(ctx context.Context, owner, repo, tag string) (*Release, error)

type ClientOpt

type ClientOpt func(*Client)

func WithToken

func WithToken(token string) ClientOpt

type GHLoginOpts

type GHLoginOpts struct {
	// value for `--git-protocol` arg, "https" or "ssh", or empty string to omit
	// the arg.
	GitProtocol string
	// value for `--hostname` arg, or empty string to omit it
	Hostname string
	// values to pass to `--scopes`, or nil/empty to omit it
	Scopes []string
}

type Release

type Release struct {
	TagName string         `json:"tag_name"`
	Assets  []ReleaseAsset `json:"assets"`
}

type ReleaseAsset

type ReleaseAsset struct {
	URL string `json:"url"`

	Name        string `json:"name"`
	Label       string `json:"label"`
	ContentType string `json:"content_type"`
	Size        int    `json:"size"`
}

Jump to

Keyboard shortcuts

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