Documentation
¶
Index ¶
- Constants
- type Client
- func (c *Client) CheckForUpdates(currentVersion string) (*VersionInfo, error)
- func (c *Client) DownloadArchive(version string) (io.ReadCloser, int64, error)
- func (c *Client) DownloadBranchArchive(branch string) (io.ReadCloser, int64, error)
- func (c *Client) DownloadFile(version, path string) ([]byte, error)
- func (c *Client) GetArchiveURL(version string) string
- func (c *Client) GetBranchArchiveURL(branch string) string
- func (c *Client) GetLatestRelease() (*Release, error)
- func (c *Client) GetLatestVersionOrBranch() (version string, isBranch bool, err error)
- func (c *Client) GetTags() ([]Tag, error)
- type Release
- type Tag
- type VersionInfo
Constants ¶
View Source
const ( // GitHubAPI is the base URL for GitHub API GitHubAPI = "https://api.github.com" // ArchiveURLTemplate is the template for downloading release archives // Format: https://github.com/{owner}/{repo}/archive/refs/tags/{tag}.tar.gz ArchiveURLTemplate = "https://github.com/%s/%s/archive/refs/tags/v%s.tar.gz" // BranchArchiveURLTemplate is the template for downloading branch archives // Format: https://github.com/{owner}/{repo}/archive/refs/heads/{branch}.tar.gz BranchArchiveURLTemplate = "https://github.com/%s/%s/archive/refs/heads/%s.tar.gz" // LatestReleaseURLTemplate is the template for fetching latest release info LatestReleaseURLTemplate = "https://api.github.com/repos/%s/%s/releases/latest" // TagsURLTemplate is the template for fetching tags TagsURLTemplate = "https://api.github.com/repos/%s/%s/tags" // DefaultBranch is the fallback when no releases exist DefaultBranch = "main" // DevVersion is returned when using main branch DevVersion = "dev" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client provides GitHub API operations
func (*Client) CheckForUpdates ¶
func (c *Client) CheckForUpdates(currentVersion string) (*VersionInfo, error)
CheckForUpdates compares current version with latest
func (*Client) DownloadArchive ¶
DownloadArchive downloads the archive for a specific version
func (*Client) DownloadBranchArchive ¶
DownloadBranchArchive downloads the archive for a branch
func (*Client) DownloadFile ¶
DownloadFile downloads a single file from the repository
func (*Client) GetArchiveURL ¶
GetArchiveURL returns the URL to download a specific version
func (*Client) GetBranchArchiveURL ¶
GetBranchArchiveURL returns the URL to download from a branch
func (*Client) GetLatestRelease ¶
GetLatestRelease fetches the latest release information Returns nil without error if no releases exist (use GetLatestVersionOrBranch instead)
func (*Client) GetLatestVersionOrBranch ¶
GetLatestVersionOrBranch returns the latest version, falling back to "dev" if no releases
Click to show internal directories.
Click to hide internal directories.