Documentation ¶
Index ¶
- Constants
- func ApiURL() string
- func DoAuthRequest(log *logging.Logger, method, url, bodyType, token string, ...) (*http.Response, error)
- func GetFileSize(f *os.File) (int64, error)
- func GithubGet(log *logging.Logger, uri string, v interface{}) error
- func IdOfTag(log *logging.Logger, user, repo, tag, token string) (int, error)
- func LoadGithubToken() (string, error)
- func Mark(ok bool) string
- func NewAuthRequest(log *logging.Logger, method, url, bodyType, token string, ...) (*http.Request, error)
- type Asset
- type Commit
- type GithubError
- type GithubService
- type Message
- type Release
- type ReleaseCreate
- type Tag
- type UploadAssetOptions
Constants ¶
View Source
const ( API_URL = "https://api.github.com" GH_URL = "https://github.com" )
View Source
const ( RELEASE_LIST_URI = "/repos/%s/%s/releases%s" RELEASE_LATEST_URI = "/repos/%s/%s/releases/latest%s" RELEASE_DATE_FORMAT = "02/01/2006 at 15:04" )
View Source
const (
ASSET_DOWNLOAD_URI = "/repos/%s/%s/releases/assets/%d"
)
View Source
const (
TAGS_URI = "/repos/%s/%s/tags%s"
)
Variables ¶
This section is empty.
Functions ¶
func DoAuthRequest ¶
func LoadGithubToken ¶
LoadGithubToken tries to load a github access token from: - GITHUB_TOKEN environment variable - ~/.pulcy/github-token file
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"` }
type GithubError ¶
type GithubService ¶
type GithubService struct { Logger *logging.Logger User string // Github username Repository string // Github repository name Token string // Github access token }
func (GithubService) CreateRelease ¶
func (s GithubService) CreateRelease(options ReleaseCreate) error
func (GithubService) UploadAsset ¶
func (s GithubService) UploadAsset(opt UploadAssetOptions) error
func (GithubService) ValidateCredentials ¶
func (s GithubService) ValidateCredentials() error
type Message ¶
type Message struct { Message string `json:"message"` Errors []GithubError `json:"errors"` }
usually when something goes wrong, github sends something like this back
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 ReleaseOfTag ¶
func (*Release) CleanUploadUrl ¶
type ReleaseCreate ¶
Click to show internal directories.
Click to hide internal directories.