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

Add support for different archive formats

Fixes #587
parent c0af6af6
...@@ -137,6 +137,7 @@ func (s *RepositoriesService) RawBlobContent(pid interface{}, sha string, option ...@@ -137,6 +137,7 @@ func (s *RepositoriesService) RawBlobContent(pid interface{}, sha string, option
// GitLab API docs: // GitLab API docs:
// https://docs.gitlab.com/ce/api/repositories.html#get-file-archive // https://docs.gitlab.com/ce/api/repositories.html#get-file-archive
type ArchiveOptions struct { type ArchiveOptions struct {
Format *string `url:"-" json:"-"`
SHA *string `url:"sha,omitempty" json:"sha,omitempty"` SHA *string `url:"sha,omitempty" json:"sha,omitempty"`
} }
...@@ -151,6 +152,11 @@ func (s *RepositoriesService) Archive(pid interface{}, opt *ArchiveOptions, opti ...@@ -151,6 +152,11 @@ func (s *RepositoriesService) Archive(pid interface{}, opt *ArchiveOptions, opti
} }
u := fmt.Sprintf("projects/%s/repository/archive", url.QueryEscape(project)) 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) req, err := s.client.NewRequest("GET", u, opt, options)
if err != nil { if err != nil {
return nil, nil, err 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