github

package
v0.1.38 Latest Latest
Warning

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

Go to latest
Published: Dec 16, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrRequestFailed   = errors.New("request failed")
	ErrArchiveNotFound = errors.New("archive not found")
)

Functions

This section is empty.

Types

type Client

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

Client defines the configuration for GitHub client

func NewClient

func NewClient(opts ...ClientOption) *Client

func (*Client) CheckConnection

func (c *Client) CheckConnection() error

CheckConnection is validating connection to the API end point

func (*Client) GetLatestVersion

func (c *Client) GetLatestVersion(ctx context.Context) (latest upgrade.Release, err error)

GetLatestVersion returns latest version from the github API

func (*Client) GetReleaseArchive

func (c *Client) GetReleaseArchive(ctx context.Context, latestVersion upgrade.Release) ([]byte, error)

GetReleaseArchive returns archive based on the OS type and arc

type ClientConfig

type ClientConfig struct {
	Client  http.Client
	BaseURL string
}

ClientConfig defines http client and base url for the API

func (*ClientConfig) Default

func (c *ClientConfig) Default()

func (*ClientConfig) Option

func (c *ClientConfig) Option(opts ...ClientOption)

type ClientOption

type ClientOption interface {
	ConfigureClient(*ClientConfig)
}

type OSConfig

type OSConfig struct {
	OSType string
	OSArch string
}

OSConfig defines os type and arch

func (*OSConfig) FindAssetURL

func (osConfig *OSConfig) FindAssetURL(latestVersion upgrade.Release) (string, bool)

FindAssetURL returns the matching browser download url and matching status

type WithBaseURL

type WithBaseURL string

func (WithBaseURL) ConfigureClient

func (w WithBaseURL) ConfigureClient(c *ClientConfig)

type WithClient

type WithClient http.Client

func (WithClient) ConfigureClient

func (w WithClient) ConfigureClient(c *ClientConfig)

Jump to

Keyboard shortcuts

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