github

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: May 18, 2023 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasRelease added in v0.2.0

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

func NewHTTPClient added in v0.1.15

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 added in v0.1.16

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

type Client added in v0.1.15

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

Client facilitates making HTTP requests to the GitHub API

func NewClient added in v0.1.15

func NewClient(opts ...ClientOption) *Client

NewClient initializes a Client

func (Client) REST added in v0.1.15

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

type ClientOption added in v0.1.15

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

ClientOption represents an argument to NewClient

func ReplaceTripper added in v0.1.15

func ReplaceTripper(tr http.RoundTripper) ClientOption

ReplaceTripper substitutes the underlying RoundTripper with a custom one

type FilterFunc added in v0.1.15

type FilterFunc func(assets Assets) *Asset

type Option added in v0.1.15

type Option func(r *Release)

func WithFilter added in v0.1.15

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

func WithOverwrite added in v0.2.0

func WithOverwrite() Option

func WithVerbose added in v0.1.15

func WithVerbose() Option

func WithWorkdir added in v0.1.15

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 added in v0.1.15

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 added in v0.1.15

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 added in v0.1.16

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