github

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2020 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AssetOptions

type AssetOptions struct {
	Tag         string
	Name        string
	OS          string
	OSAlias     []string
	Arch        string
	ArchAlias   []string
	DestPath    string
	Target      string
	PickPattern string
}

AssetOptions are parameters to download an asset file.

type Client

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

Client is a github oauth2 client.

func NewClient

func NewClient(accessToken string, verbose bool) *Client

NewClient creates github client.

func (*Client) DownloadReleaseAsset

func (c *Client) DownloadReleaseAsset(ctx context.Context,
	repo Repository,
	opt *AssetOptions,
) (*ReleaseAsset, rxgo.Observable, error)

DownloadReleaseAsset downloads a release asset file. first returns release asset info. second returns download progress info or error info use a stream. third returns initialize error info.

func (*Client) GetRelease

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

GetRelease gets release info.

func (*Client) ListReleases

func (c *Client) ListReleases(ctx context.Context,
	repo Repository,
	opt *ListOptions,
) ([]*RepositoryRelease, error)

ListReleases get release list.

type DownloadProgress

type DownloadProgress struct {
	Total    int64
	Received int64
}

DownloadProgress is the current downloaded size of a file.

func (*DownloadProgress) Percentage

func (p *DownloadProgress) Percentage() float64

Percentage is downloaded size over total size.

type ListOptions

type ListOptions = ggithub.ListOptions

ListOptions specifies the optional parameters to various List methods that support pagination.

type Progress

type Progress interface {
	Percentage() float64
}

Progress is progress info of work.

type ReleaseAsset

type ReleaseAsset = ggithub.ReleaseAsset

ReleaseAsset represents a GitHub release asset in a repository.

type Repository

type Repository string

Repository is github repository. (owner/name)

func (Repository) Name

func (r Repository) Name() string

Name is a repository name part.

func (Repository) Owner

func (r Repository) Owner() string

Owner is a repository owner part.

type RepositoryRelease

type RepositoryRelease = ggithub.RepositoryRelease

RepositoryRelease represents a GitHub release in a repository.

type WriteCounter

type WriteCounter struct {
	Total   int64
	Written int64
	// contains filtered or unexported fields
}

WriteCounter counts the number of bytes written to it. It implements to the io.Writer interface and we can pass this into io.TeeReader() which will report progress on each write cycle.

func NewWriteCounter

func NewWriteCounter(ch chan<- rxgo.Item, total int64) *WriteCounter

NewWriteCounter creates WriteCounter

func (*WriteCounter) Write

func (w *WriteCounter) Write(p []byte) (int, error)

Jump to

Keyboard shortcuts

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