Commit dfe7e589 authored by Sander van Harmelen's avatar Sander van Harmelen

Add support for different archive formats

Fixes #587
parent c0af6af6
......@@ -137,7 +137,8 @@ func (s *RepositoriesService) RawBlobContent(pid interface{}, sha string, option
// GitLab API docs:
// https://docs.gitlab.com/ce/api/repositories.html#get-file-archive
type ArchiveOptions struct {
SHA *string `url:"sha,omitempty" json:"sha,omitempty"`
Format *string `url:"-" json:"-"`
SHA *string `url:"sha,omitempty" json:"sha,omitempty"`
}
// Archive gets an archive of the repository.
......@@ -151,6 +152,11 @@ func (s *RepositoriesService) Archive(pid interface{}, opt *ArchiveOptions, opti
}
u := fmt.Sprintf("projects/%s/repository/archive", url.QueryEscape(project))
// Set an optional format for the archive.
if opt != nil && opt.Format != nil {
u = fmt.Sprintf("%s.%s", u, *opt.Format)
}
req, err := s.client.NewRequest("GET", u, opt, options)
if err != nil {
return nil, nil, err
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment