github

package
v0.14.4 Latest Latest
Warning

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

Go to latest
Published: Jul 8, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Parse

func Parse(remotePath string) (*model.Metadata, error)

Parse parses remote path to get its metadata according to github convention

Types

type API added in v0.13.0

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

func NewAPI added in v0.13.0

func NewAPI(baseURL, token string) (*API, error)

func NewGitHubAPI added in v0.13.0

func NewGitHubAPI(repo Repository) *API

func (*API) CompareDiff added in v0.13.0

func (api *API) CompareDiff(ctx context.Context, projectID any, target, source string) ([]*model.Diff, error)

func (*API) GetFileContent added in v0.13.0

func (api *API) GetFileContent(ctx context.Context, projectID any, ref, fileName string) ([]byte, error)

func (*API) GetOwnerAndRepoName added in v0.13.0

func (*API) GetOwnerAndRepoName(projectID any) (owner, repo string, err error)

type Asset

type Asset struct {
	Name               string `json:"name"`
	BrowserDownloadURL string `json:"browser_download_url"`
}

Asset defines github release asset

type Client

type Client struct{}

Client defines github client

func (*Client) DownloadAsset

func (c *Client) DownloadAsset(ctx context.Context, apiPath string) ([]byte, error)

DownloadAsset downloads github asset based on the asset api path. Currently, it can only download asset from publicly available repository. `apiPath` follows prefix [https://api.github.com/repos], which can be generated by this provider parser. For more information, check [this](https://docs.github.com/en/rest/releases/releases) documentation.

func (*Client) DownloadRelease

func (*Client) DownloadRelease(ctx context.Context, apiPath string) (*model.RepositoryRelease, error)

DownloadRelease downloads a release based on the API path

type Release

type Release struct {
	TagName    string   `json:"tag_name"`
	Draft      bool     `json:"draft"`
	Prerelease bool     `json:"prerelease"`
	Assets     []*Asset `json:"assets"`
}

Release defines github repository release

type Repository added in v0.13.0

type Repository interface {
	CompareCommits(ctx context.Context, owner, repo, base, head string, opts *github.ListOptions) (*github.CommitsComparison, *github.Response, error)
	GetContents(ctx context.Context, owner, repo, path string, opts *github.RepositoryContentGetOptions) (fileContent *github.RepositoryContent, directoryContent []*github.RepositoryContent, resp *github.Response, err error)
}

Jump to

Keyboard shortcuts

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