feat(pipelines): add list pipelines of the current user

Adds PipelinesService.ListUserPipelines for GET /pipelines, which lists pipelines across all projects that were triggered by the authenticated user.

References

GitLab API docs: https://docs.gitlab.com/api/pipelines/#list-pipelines

Changes

  • ListUserPipelines(opt *ListUserPipelinesOptions, options ...RequestOptionFunc) ([]*UserPipeline, *Response, error) is added to PipelinesServiceInterface and implemented on the service.
  • ListUserPipelinesOptions has CreatedAfter, CreatedBefore, Cursor, OrderBy, Sort, Source and PerPage. It does not embed ListOptions, because the endpoint supports keyset pagination only. The next page URL is in Response.NextLink.
  • UserPipeline models the response, including Project (BasicProject), StartedAt, FinishedAt, Duration, QueuedDuration, DetailedStatus and MergeRequest.
  • UserPipelineMergeRequest models the slim merge request (iid, title, web_url). It is only returned for visible merge request pipelines.
  • A new route, pipelines.
  • testing/pipelines_mock.go is regenerated with make generate.

Testing

TestListUserPipelines covers every query parameter, the decoded response, the next page link and a failing request option. TestListUserPipelines_Unauthorized covers a 401. make reviewable passes.

Closes #2322 (closed)

Merge request reports

Loading
Loading