Remove opts from ListPullReviewComments #411

Merged
techknowlogick merged 5 commits from 6543/go-sdk:GetPullReviewComments-has-no-opts into master 2020-09-07 03:01:32 +00:00
2 changed files with 26 additions and 0 deletions
Showing only changes of commit 65d8d41d79 - Show all commits

View File

@ -390,3 +390,19 @@ func (c *Client) GetRepoLanguages(owner, repo string) (map[string]int64, error)
}
return langMap, nil
}
// ArchiveType represent supported archive formats by gitea
type ArchiveType string
const (
// ZipArchive represent zip format
ZipArchive ArchiveType = ".zip"
// TarGZArchive represent tar.gz format
TarGZArchive ArchiveType = ".tar.gz"
)
// GetArchive get an archive of a repository by git reference
// e.g.: ref -> master, 70b7c74b33, v1.2.1, ...
func (c *Client) GetArchive(owner, repo, ref string, ext ArchiveType) ([]byte, error) {
return c.getResponse("GET", fmt.Sprintf("/repos/%s/%s/archive/%s%s", owner, repo, url.PathEscape(ref), ext), nil, nil)
}

View File

@ -125,6 +125,16 @@ func TestDeleteRepo(t *testing.T) {
assert.NoError(t, c.DeleteRepo(repo.Owner.UserName, repo.Name))
}
func TestGetArchive(t *testing.T) {
log.Println("== TestGetArchive ==")
c := newTestClient()
repo, _ := createTestRepo(t, "ToDownload", c)
time.Sleep(time.Second / 2)
archive, err := c.GetArchive(repo.Owner.UserName, repo.Name, "master", ZipArchive)
assert.NoError(t, err)
assert.EqualValues(t, 1620, len(archive))
}
// standard func to create a init repo for test routines
func createTestRepo(t *testing.T, name string, c *Client) (*Repository, error) {
user, uErr := c.GetMyUserInfo()