github

package
v1.0.6-1 Latest Latest
Warning

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

Go to latest
Published: Dec 11, 2015 License: BSD-3-Clause, BSD-3-Clause Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ReleaseListPath   = "/repos/%s/%s/releases"
	ReleaseLatestPath = "/repos/%s/%s/releases/latest"
)
View Source
const (
	AssetDownloadURI = "/repos/%s/%s/releases/assets/%d"
)
View Source
const (
	GithubAPIURL = "https://api.github.com"
)

Variables

This section is empty.

Functions

func CreateRelease

func CreateRelease(token string, repo string, tag string, name string) error

func DoAuthRequest

func DoAuthRequest(method, url, bodyType, token string, headers map[string]string, body io.Reader) (*http.Response, error)

func Download

func Download(token string, url string, name string) error

func DownloadAsset

func DownloadAsset(token string, repo string, tag string, name string) error

func DownloadSource

func DownloadSource(token string, repo string, tag string) error

func Get

func Get(url string, v interface{}) error

func GetFileSize

func GetFileSize(f *os.File) (int64, error)

func NewAuthRequest

func NewAuthRequest(method, url, bodyType, token string, headers map[string]string, body io.Reader) (*http.Request, error)

NewAuthRequest creates a new request that sends the auth token

func Upload

func Upload(token string, repo string, tag string, name string, file string) error

Types

type Asset

type Asset struct {
	URL                string    `json:"url"`
	ID                 int       `json:"id"`
	Name               string    `json:"name"`
	ContentType        string    `json:"content_type"`
	State              string    `json:"state"`
	Size               uint64    `json:"size"`
	Downloads          uint64    `json:"download_count"`
	Created            time.Time `json:"created_at"`
	Published          time.Time `json:"published_at"`
	BrowserDownloadURL string    `json:"browser_download_url"`
}

type ErrNotFound

type ErrNotFound struct {
	Name  string
	Key   string
	Value string
}

func (ErrNotFound) Error

func (e ErrNotFound) Error() string

type Release

type Release struct {
	URL         string     `json:"url"`
	PageURL     string     `json:"html_url"`
	UploadURL   string     `json:"upload_url"`
	ID          int        `json:"id"`
	Name        string     `json:"name"`
	Description string     `json:"body"`
	TagName     string     `json:"tag_name"`
	Draft       bool       `json:"draft"`
	Prerelease  bool       `json:"prerelease"`
	Created     *time.Time `json:"created_at"`
	Published   *time.Time `json:"published_at"`
	Assets      []Asset    `json:"assets"`
}

func LatestRelease

func LatestRelease(user, repo, token string) (release *Release, err error)

func ReleaseOfTag

func ReleaseOfTag(user, repo, tag, token string) (*Release, error)

func Releases

func Releases(user, repo, token string) (releases []Release, err error)

func (*Release) CleanUploadURL

func (r *Release) CleanUploadURL() string

type ReleaseCreate

type ReleaseCreate struct {
	TagName         string `json:"tag_name"`
	TargetCommitish string `json:"target_commitish,omitempty"`
	Name            string `json:"name"`
	Body            string `json:"body"`
	Draft           bool   `json:"draft"`
	Prerelease      bool   `json:"prerelease"`
}

Jump to

Keyboard shortcuts

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