github

package
v0.0.1-pre9 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2025 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RepoURLFromString

func RepoURLFromString(str string) (string, error)

RepoURLFromString

Types

type Asset

type Asset struct {
	// RepoData
	Host string
	Repo string
	Org  string

	// Release
	Version string

	// Asset
	Name        string
	DownloadURL string
	Author      string
	Size        int
	Label       string
	CreatedAt   time.Time
	UpdatedAt   time.Time
	Arch        string
	Os          string
}

Asset is an abstraction of a file released on GitHub. It captures the basic file information but also its type platform and version.

func NewAssetFromURLString

func NewAssetFromURLString(urlString string) *Asset

func (*Asset) GetAuthor

func (a *Asset) GetAuthor() string

func (*Asset) GetCreatedAt

func (a *Asset) GetCreatedAt() time.Time

func (*Asset) GetDownloadURL

func (a *Asset) GetDownloadURL() string

func (*Asset) GetHost

func (a *Asset) GetHost() string

func (*Asset) GetLabel

func (a *Asset) GetLabel() string

func (*Asset) GetName

func (a *Asset) GetName() string

func (*Asset) GetOrg

func (a *Asset) GetOrg() string

func (*Asset) GetRepo

func (a *Asset) GetRepo() string

func (*Asset) GetRepoURL

func (a *Asset) GetRepoURL() string

func (*Asset) GetSize

func (a *Asset) GetSize() int

func (*Asset) GetUpdatedAt

func (a *Asset) GetUpdatedAt() time.Time

func (*Asset) GetVersion

func (a *Asset) GetVersion() string

type AssetDataProvider

type AssetDataProvider interface {
	ReleaseDataProvider

	GetName() string
	GetAuthor() string
	GetSize() int
	GetCreatedAt() time.Time
	GetUpdatedAt() time.Time
	GetDownloadURL() string
	GetLabel() string
}

type Client

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

func New

func New() (*Client, error)

func (*Client) ListReleaseAssets

func (c *Client) ListReleaseAssets(rdata ReleaseDataProvider) ([]AssetDataProvider, error)

func (*Client) ListReleaseInstallables

func (c *Client) ListReleaseInstallables(rdata ReleaseDataProvider) ([]AssetDataProvider, error)

func (*Client) ListReleases

func (c *Client) ListReleases(rdata RepoDataProvider) ([]ReleaseDataProvider, error)

ListReleases returns a list of the latest releases in a repo

type Installable

type Installable struct {
	// RepoData
	Host string
	Repo string
	Org  string

	// Release
	Version string

	Name     string
	Variants []*Asset

	// Asset
	DownloadURL string
	Author      string
	Size        int
	Label       string
	CreatedAt   time.Time
	UpdatedAt   time.Time
	Arch        string
	Os          string
}

Installable abstracts a group of released assets of the same app that are variants for different architectures and OSs.

func (*Installable) GetArchVariants

func (i *Installable) GetArchVariants() []string

func (*Installable) GetArchiveTypes

func (i *Installable) GetArchiveTypes() []string

func (*Installable) GetAuthor

func (i *Installable) GetAuthor() string

func (*Installable) GetCreatedAt

func (i *Installable) GetCreatedAt() time.Time

func (*Installable) GetDownloadURL

func (i *Installable) GetDownloadURL() string

func (*Installable) GetHost

func (i *Installable) GetHost() string

func (*Installable) GetLabel

func (i *Installable) GetLabel() string

func (*Installable) GetName

func (i *Installable) GetName() string

func (*Installable) GetOrg

func (i *Installable) GetOrg() string

func (*Installable) GetOsVariants

func (i *Installable) GetOsVariants() []string

func (*Installable) GetPackageTypes

func (i *Installable) GetPackageTypes() []string

func (*Installable) GetRepo

func (i *Installable) GetRepo() string

func (*Installable) GetRepoURL

func (i *Installable) GetRepoURL() string

func (*Installable) GetSize

func (i *Installable) GetSize() int

func (*Installable) GetUpdatedAt

func (i *Installable) GetUpdatedAt() time.Time

func (*Installable) GetVersion

func (i *Installable) GetVersion() string

func (*Installable) LocalVariant

func (i *Installable) LocalVariant() *Asset

type Options

type Options struct {
	Host string
}

type Release

type Release struct {
	// Repository
	Host string
	Repo string
	Org  string

	// Release
	Version    string
	ID         int64
	PreRelease bool
	CreatedAt  time.Time
	Author     string
}

Release captures the information of a GitHub release.

func (*Release) GetAuthor

func (r *Release) GetAuthor() string

func (*Release) GetCreatedAt

func (r *Release) GetCreatedAt() time.Time

func (*Release) GetHost

func (r *Release) GetHost() string

func (*Release) GetOrg

func (r *Release) GetOrg() string

func (*Release) GetRepo

func (r *Release) GetRepo() string

func (*Release) GetRepoURL

func (r *Release) GetRepoURL() string

func (*Release) GetVersion

func (r *Release) GetVersion() string

type ReleaseDataProvider

type ReleaseDataProvider interface {
	RepoDataProvider
	GetVersion() string
	GetCreatedAt() time.Time
	GetAuthor() string
}

type RepoDataProvider

type RepoDataProvider interface {
	GetHost() string
	GetRepo() string
	GetOrg() string
	GetRepoURL() string
}

type Repository

type Repository struct {
	Host string
	Repo string
	Org  string
}

Repository is the basic construct that exposes information of a repository.

func (*Repository) GetHost

func (r *Repository) GetHost() string

func (*Repository) GetOrg

func (r *Repository) GetOrg() string

func (*Repository) GetRepo

func (r *Repository) GetRepo() string

func (*Repository) GetRepoURL

func (r *Repository) GetRepoURL() string

Jump to

Keyboard shortcuts

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