github

package
v0.99.0 Latest Latest
Warning

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

Go to latest
Published: Jan 26, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package github provides clients for interacting with the GitHub API and downloading GitHub releases.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DownloadResult

type DownloadResult struct {
	PackageFile     string
	ChecksumFile    string
	ChecksumSigFile string
}

DownloadResult represents the result of downloading release assets.

type GitHubAPIClient

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

GitHubAPIClient represents a GitHub API client.

func NewGitHubAPIClient

func NewGitHubAPIClient(opts ...GitHubAPIClientOption) *GitHubAPIClient

NewGitHubAPIClient creates a new GitHub API client with optional configuration.

func (*GitHubAPIClient) GetLatestRelease

func (c *GitHubAPIClient) GetLatestRelease(ctx context.Context, repository string) (*Release, error)

GetLatestRelease fetches the latest release for a given repository. The repository should be in the format "owner/repo".

func (*GitHubAPIClient) GetLatestReleaseTag

func (c *GitHubAPIClient) GetLatestReleaseTag(ctx context.Context, repository string) (string, error)

GetLatestReleaseTag is a convenience method that returns just the tag name of the latest release for a repository.

type GitHubAPIClientOption

type GitHubAPIClientOption func(*GitHubAPIClient)

GitHubAPIClientOption is a function that configures a GitHubAPIClient.

func WithBaseURL

func WithBaseURL(baseURL string) GitHubAPIClientOption

WithBaseURL sets the base URL for the GitHub API.

func WithHTTPClient

func WithHTTPClient(httpClient *http.Client) GitHubAPIClientOption

WithHTTPClient sets the HTTP client for the GitHub client.

type GitHubReleasesDownloadClient

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

GitHubReleasesDownloadClient represents a client for downloading GitHub release assets.

func NewGitHubReleasesDownloadClient

func NewGitHubReleasesDownloadClient(opts ...GitHubReleasesDownloadClientOption) *GitHubReleasesDownloadClient

NewGitHubReleasesDownloadClient creates a new GitHub releases download client.

func (*GitHubReleasesDownloadClient) DownloadReleaseAssets

func (c *GitHubReleasesDownloadClient) DownloadReleaseAssets(
	ctx context.Context,
	assets *ReleaseAssets,
) (*DownloadResult, error)

DownloadReleaseAssets downloads the specified release assets from a GitHub repository. It supports downloading from either full URLs (when repository contains "://") or from GitHub releases using the standard GitHub releases URL format.

type GitHubReleasesDownloadClientOption

type GitHubReleasesDownloadClientOption func(*GitHubReleasesDownloadClient)

GitHubReleasesDownloadClientOption is a function that configures a GitHubReleasesDownloadClient.

func WithLogger

WithLogger sets the logger for the download client.

type Release

type Release struct {
	TagName string `json:"tag_name"`
	Name    string `json:"name"`
	URL     string `json:"html_url"`
}

Release represents a GitHub repository release.

type ReleaseAssets

type ReleaseAssets struct {
	Repository      string
	Version         string
	PackageFile     string
	ChecksumFile    string
	ChecksumSigFile string
}

ReleaseAssets represents the assets to download for a GitHub release.

Jump to

Keyboard shortcuts

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