github

package
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2025 License: MIT Imports: 17 Imported by: ? 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

This section is empty.

Functions

func HasRelease

func HasRelease(httpClient *http.Client, owner, repo, tag string) (bool, error)

func NewHTTPClient

func NewHTTPClient(opts ...ClientOption) *http.Client

NewHTTPClient initializes an http.Client

Types

type Asset

type Asset struct {
	Name string
	URL  string
}

Asset represents GitHub release's asset. Basically this means one archive file attached in a release

type Assets

type Assets []Asset

type AssetsResponse

type AssetsResponse struct {
	Name               string `json:"name"`
	BrowserDownloadURL string `json:"browser_download_url"`
}

type Client

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

Client facilitates making HTTP requests to the GitHub API

func NewClient

func NewClient(opts ...ClientOption) *Client

NewClient initializes a Client

func (Client) REST

func (c Client) REST(method string, url string, body io.Reader, data interface{}) error

type ClientOption

type ClientOption = func(http.RoundTripper) http.RoundTripper

ClientOption represents an argument to NewClient

func ReplaceTripper

func ReplaceTripper(tr http.RoundTripper) ClientOption

ReplaceTripper substitutes the underlying RoundTripper with a custom one

type FilterFunc

type FilterFunc func(assets Assets) *Asset

type Option

type Option func(r *Release)

func WithFilter

func WithFilter(filter func(Assets) *Asset) Option

func WithOverwrite

func WithOverwrite() Option

func WithVerbose

func WithVerbose() Option

func WithWorkdir

func WithWorkdir(workdir string) Option

type Release

type Release struct {
	Name   string
	Tag    string
	Assets Assets
	// contains filtered or unexported fields
}

Release represents a GitHub release and its client A difference from Release is whether a client or not

func NewRelease

func NewRelease(ctx context.Context, owner, repo, tag string, opts ...Option) (*Release, error)

func (*Release) Download

func (r *Release) Download(ctx context.Context) (Asset, error)

Download downloads GitHub Release from given page

func (*Release) Install

func (r *Release) Install(to string) error

Install instals unarchived packages to given path

func (*Release) Unarchive

func (r *Release) Unarchive(asset Asset) error

Unarchive extracts downloaded asset

type ReleaseResponse

type ReleaseResponse struct {
	TagName string           `json:"tag_name"`
	Assets  []AssetsResponse `json:"assets"`
}

ReleaseResponse is a response of github release structure TODO: This may be better to become same one strucure as above

Jump to

Keyboard shortcuts

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