update

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2026 License: Apache-2.0, BSD-3-Clause, MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const ReleasesURL = "https://api.github.com/repos/apimgr/search/releases"

ReleasesURL is the URL to check for releases

Variables

This section is empty.

Functions

This section is empty.

Types

type Asset

type Asset struct {
	Name        string `json:"name"`
	Size        int64  `json:"size"`
	DownloadURL string `json:"browser_download_url"`
	ContentType string `json:"content_type"`
}

Asset represents a release asset

type Manager

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

Manager handles update operations

func NewManager

func NewManager() *Manager

NewManager creates a new update manager

func (*Manager) CheckForUpdates

func (m *Manager) CheckForUpdates(includePrerelease bool) (*UpdateInfo, error)

CheckForUpdates checks if a new version is available

func (*Manager) DownloadUpdate

func (m *Manager) DownloadUpdate(downloadURL string, progressFn func(downloaded, total int64)) (string, error)

DownloadUpdate downloads the update to a temporary location

func (*Manager) GetCurrentVersion

func (m *Manager) GetCurrentVersion() string

GetCurrentVersion returns the current version

func (*Manager) InstallUpdate

func (m *Manager) InstallUpdate(archivePath string) error

InstallUpdate installs an update from a downloaded archive

func (*Manager) ListAvailableVersions

func (m *Manager) ListAvailableVersions() ([]string, error)

ListAvailableVersions returns a list of available versions

func (*Manager) Rollback

func (m *Manager) Rollback() error

Rollback rolls back to the previous version

type Release

type Release struct {
	TagName     string    `json:"tag_name"`
	Name        string    `json:"name"`
	Body        string    `json:"body"`
	Draft       bool      `json:"draft"`
	Prerelease  bool      `json:"prerelease"`
	CreatedAt   time.Time `json:"created_at"`
	PublishedAt time.Time `json:"published_at"`
	Assets      []Asset   `json:"assets"`
}

Release represents a GitHub release

type UpdateInfo

type UpdateInfo struct {
	Available      bool      `json:"available"`
	CurrentVersion string    `json:"current_version"`
	LatestVersion  string    `json:"latest_version"`
	ReleaseNotes   string    `json:"release_notes"`
	DownloadURL    string    `json:"download_url"`
	AssetSize      int64     `json:"asset_size"`
	PublishedAt    time.Time `json:"published_at"`
	IsPrerelease   bool      `json:"is_prerelease"`
}

UpdateInfo contains information about an available update

Jump to

Keyboard shortcuts

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