diff options
Diffstat (limited to 'vendor/github.com/gogs/go-gogs-client/repo_file.go')
-rw-r--r-- | vendor/github.com/gogs/go-gogs-client/repo_file.go | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/vendor/github.com/gogs/go-gogs-client/repo_file.go b/vendor/github.com/gogs/go-gogs-client/repo_file.go index c50708b4..d766fb6d 100644 --- a/vendor/github.com/gogs/go-gogs-client/repo_file.go +++ b/vendor/github.com/gogs/go-gogs-client/repo_file.go @@ -13,3 +13,11 @@ import ( func (c *Client) GetFile(user, repo, ref, tree string) ([]byte, error) { return c.getResponse("GET", fmt.Sprintf("/repos/%s/%s/raw/%s/%s", user, repo, ref, tree), nil, nil) } + +// GetArchive downloads the full contents of a repository. Ref can be a branch/tag/commit. +func (c *Client) GetArchive(user, repo, ref, format string) ([]byte, error) { + if format != ".zip" && format != ".tar.gz" { + return nil, fmt.Errorf("invalid format: %s (must be .zip or .tar.gz)", format) + } + return c.getResponse("GET", fmt.Sprintf("/repos/%s/%s/archive/%s%s", user, repo, ref, format), nil, nil) +} |