Documentation
¶
Index ¶
- Variables
- func BindPATFlag() *string
- func BindRepoFlag() *string
- func DownloadFile(ctx context.Context, client *github.Client, owner, repo, branch, path string) ([]byte, error)
- func FetchEachPage(f func(options github.ListOptions) (*github.Response, error)) error
- func NewClient(ctx context.Context, pat string) (*github.Client, error)
- func ParseRepoFlag(repo *string) (owner, name string, err error)
- func Retry(f func() error) error
- func UploadFile(ctx context.Context, client *github.Client, ...) error
Constants ¶
This section is empty.
Variables ¶
var ErrNotExists = errors.New("file does not exist in the given repository and branch")
ErrNotExists indicates that the requested file does not exist in the specified GitHub repository and branch.
Functions ¶
func BindPATFlag ¶
func BindPATFlag() *string
BindPATFlag returns a flag to specify the personal access token.
func BindRepoFlag ¶
func BindRepoFlag() *string
BindRepoFlag returns a flag to specify a GitHub repo to target. Parse it with ParseRepoFlag.
func DownloadFile ¶ added in v0.0.3
func DownloadFile(ctx context.Context, client *github.Client, owner, repo, branch, path string) ([]byte, error)
DownloadFile downloads a file from a given repository.
func FetchEachPage ¶
FetchEachPage helps fetch all data from a GitHub API call that may or may not span multiple pages. FetchEachPage initially calls f with no paging parameters, then inspects the GitHub response to see if there are more pages to fetch. If so, it constructs paging parameters that will fetch the next page and calls f again. This repeats until there aren't any more pages.
Note that FetchEachPage doesn't process any of the result data, and doesn't actually call the GitHub API. f must do this itself. This allows FetchEachPage to work with any GitHub API.
func ParseRepoFlag ¶
ParseRepoFlag splits a given repo (owner/name) into owner and name, or returns an error.
Types ¶
This section is empty.