diff --git a/jobs.go b/jobs.go index fcdf58751..e3895c0f3 100644 --- a/jobs.go +++ b/jobs.go @@ -186,18 +186,20 @@ func (s *JobsService) ListPipelineBridges(pid interface{}, pipelineID int, opts return bridges, resp, err } -// GetJob gets a single job of a project. +// GetJobTokensJobOptions represents the available GetJobTokensJob() options. // -// GitLab API docs: -// https://docs.gitlab.com/ce/api/jobs.html#get-a-single-job -func (s *JobsService) GetJob(pid interface{}, jobID int, options ...RequestOptionFunc) (*Job, *Response, error) { - project, err := parseID(pid) - if err != nil { - return nil, nil, err - } - u := fmt.Sprintf("projects/%s/jobs/%d", pathEscape(project), jobID) +// GitLab API docs: https://docs.gitlab.com/ce/api/jobs.html#get-job-tokens-job +type GetJobTokensJobOptions struct { + JobToken *string `url:"job_token,omitempty" json:"job_token,omitempty"` +} - req, err := s.client.NewRequest(http.MethodGet, u, nil, options) +// GetJobTokensJob retrieves the job that generated a job token. +// +// GitLab API docs: https://docs.gitlab.com/ce/api/jobs.html#get-job-tokens-job +func (s *JobsService) GetJobTokensJob(opts *GetJobTokensJobOptions, options ...RequestOptionFunc) (*Job, *Response, error) { + u := "job" + + req, err := s.client.NewRequest(http.MethodGet, u, opts, options) if err != nil { return nil, nil, err } @@ -211,20 +213,18 @@ func (s *JobsService) GetJob(pid interface{}, jobID int, options ...RequestOptio return job, resp, err } -// GetJobTokensJobOptions represents the available GetJobTokensJob() options. -// -// GitLab API docs: https://docs.gitlab.com/ce/api/jobs.html#get-job-tokens-job -type GetJobTokensJobOptions struct { - JobToken *string `url:"job_token,omitempty" json:"job_token,omitempty"` -} - -// GetJobTokensJob retrieves the job that generated a job token. +// GetJob gets a single job of a project. // -// GitLab API docs: https://docs.gitlab.com/ce/api/jobs.html#get-job-tokens-job -func (s *JobsService) GetJobTokensJob(opts *GetJobTokensJobOptions, options ...RequestOptionFunc) (*Job, *Response, error) { - u := "job" +// GitLab API docs: +// https://docs.gitlab.com/ce/api/jobs.html#get-a-single-job +func (s *JobsService) GetJob(pid interface{}, jobID int, options ...RequestOptionFunc) (*Job, *Response, error) { + project, err := parseID(pid) + if err != nil { + return nil, nil, err + } + u := fmt.Sprintf("projects/%s/jobs/%d", pathEscape(project), jobID) - req, err := s.client.NewRequest(http.MethodGet, u, opts, options) + req, err := s.client.NewRequest(http.MethodGet, u, nil, options) if err != nil { return nil, nil, err }