Commit 61b5c254 authored by Julien Roland's avatar Julien Roland

[Jobs] Add options struct for DownloadArtifactsFile func which contains the job name

parent 313d3b0c
......@@ -178,25 +178,26 @@ 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,omitempty" json:"job,omitempty"`
}
// 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) {
// GitLab API docs: https://docs.gitlab.com/ce/api/jobs.html#download-the-artifacts-file
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
}
var q struct {
Job string `url:"job,omitempty" json:"job,omitempty"`
}
q.Job = job
u := fmt.Sprintf("projects/%s/jobs/artifacts/%s/download", url.QueryEscape(project), refName)
req, err := s.client.NewRequest("GET", u, q, 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