Documentation
¶
Index ¶
- Constants
- func GetLatestAsset(client Client, dst, assetNameReg, owner, repo string, opts ...Options) (string, error)
- func GetTagAsset(client Client, dst, assetNameReg, owner, repo, tag string, opts ...Options) (string, error)
- func NewBasicAuthGitlabClient(client *http.Client, baseUrl, username, password string) (*gitlabClient, error)
- func NewOAuthGitlabClient(client *http.Client, baseUrl, token string) (*gitlabClient, error)
- func NewPrivateTokenGitlabClient(client *http.Client, baseUrl, token string) (*gitlabClient, error)
- func WithArchive(archive string) func(*Configuration) error
- func WithChecksum(checksum string) func(*Configuration) error
- func WithFileName(fileName string) func(*Configuration) error
- func WithProgress(pl ProgressTracker) func(*Configuration) error
- type Client
- type Configuration
- type GithubClient
- type Options
- type ProgressTracker
Constants ¶
const (
GitlabDefaultBaseURL = "https://gitlab.com/"
)
Variables ¶
This section is empty.
Functions ¶
func GetLatestAsset ¶
func GetLatestAsset(client Client, dst, assetNameReg, owner, repo string, opts ...Options) (string, error)
GetLatestAsset fetches latest release and matches the provided asset name regex with all the assets. If asset is found, it is downloaded in provided dst otherwise error is thrown
func GetTagAsset ¶
func GetTagAsset(client Client, dst, assetNameReg, owner, repo, tag string, opts ...Options) (string, error)
GetTagAsset fetches provided tag release and matches the provided asset name regex with all the assets. If asset is found, it is downloaded in provided dst otherwise error is thrown
func NewBasicAuthGitlabClient ¶
func NewBasicAuthGitlabClient(client *http.Client, baseUrl, username, password string) (*gitlabClient, error)
NewBasicAuthGitlabClient provides connection with gitlab api through basic authentication
func NewOAuthGitlabClient ¶
NewOAuthGitlabClient provides connection with gitlab api through OAuth
func NewPrivateTokenGitlabClient ¶
NewPrivateTokenGitlabClient provides connection with gitlab api through private token
func WithArchive ¶
func WithArchive(archive string) func(*Configuration) error
WithArchive allows for a user to customize unarchiving while working with archived files.
func WithChecksum ¶
func WithChecksum(checksum string) func(*Configuration) error
WithChecksum allows for a user to provide checksum for the file.
func WithFileName ¶
func WithFileName(fileName string) func(*Configuration) error
WithFileName allows for a user to rename downloaded file.
func WithProgress ¶
func WithProgress(pl ProgressTracker) func(*Configuration) error
WithProgress allows for a user to track the progress of a download.
Types ¶
type Client ¶
type Client interface {
// contains filtered or unexported methods
}
Client is one of github, gitlab connection that allows for fetching assets from releases
type Configuration ¶
type Configuration struct { // ProgressTracker allows to track the progress of downloads. ProgressTracker ProgressTracker // Archive is used for specifying achieve type while unarchiving and "false" can be used to turn unarchiving off Archive string // Checksum to verify the downloaded file Checksum string // Filename to rename the downloaded file to FileName string // Pwd is the working directory for detection. If this isn't set, some // detection may fail. Client will not default pwd to the current // working directory for security reasons. Pwd string }
type GithubClient ¶
type GithubClient struct {
// contains filtered or unexported fields
}
GithubClient is a client for github
func NewGithubClient ¶
func NewGithubClient(client *http.Client) *GithubClient
NewGithubClient returns github client
type Options ¶
type Options func(config *Configuration) error
type ProgressTracker ¶
type ProgressTracker interface {
TrackProgress(src string, currentSize, totalSize int64, stream io.ReadCloser) (body io.ReadCloser)
}
ProgressTracker allows to track the progress of downloads.