Unverified Commit 294b2a04 authored by Sander van Harmelen's avatar Sander van Harmelen Committed by GitHub

Merge pull request #542 from julienroland/master

[Jobs] Pass job query string parameter to opt{} instead of static definition
parents 198acc90 2d67eb55
......@@ -178,19 +178,28 @@ func (s *JobsService) GetJobArtifacts(pid interface{}, jobID int, options ...Opt
return artifactsBuf, resp, err
}
// DownloadArtifactsFileOptions represents the available DownloadArtifactsFile()
// options.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/jobs.html#download-the-artifacts-file
type DownloadArtifactsFileOptions struct {
Job *string `url:"job" json:"job"`
}
// DownloadArtifactsFile download the artifacts file from the given
// reference name and job provided the job finished successfully.
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/jobs.html#download-the-artifacts-file
func (s *JobsService) DownloadArtifactsFile(pid interface{}, refName string, job string, options ...OptionFunc) (io.Reader, *Response, error) {
func (s *JobsService) DownloadArtifactsFile(pid interface{}, refName string, opt *DownloadArtifactsFileOptions, options ...OptionFunc) (io.Reader, *Response, error) {
project, err := parseID(pid)
if err != nil {
return nil, nil, err
}
u := fmt.Sprintf("projects/%s/jobs/artifacts/%s/download?job=%s", url.QueryEscape(project), refName, job)
u := fmt.Sprintf("projects/%s/jobs/artifacts/%s/download", url.QueryEscape(project), refName)
req, err := s.client.NewRequest("GET", u, nil, options)
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