Skip to content

Commit

Permalink
Correct ordering according to PR suggestion
Browse files Browse the repository at this point in the history
Signed-off-by: Sune Keller <[email protected]>
  • Loading branch information
sirlatrom committed Apr 19, 2021
1 parent 7b254ca commit d0f64fc
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions jobs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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
}
Expand Down

0 comments on commit d0f64fc

Please sign in to comment.