diff options
author | Marc Siegfriedt <marc@techaccelerator.com> | 2016-06-08 01:01:54 +0300 |
---|---|---|
committer | Marc Siegfriedt <marc@techaccelerator.com> | 2016-06-23 19:31:48 +0300 |
commit | 6587feba65371a7417a7726b6a19681e99187ecd (patch) | |
tree | 517c1adda34d2c02331a2fffe966d117c4ab65de /lib | |
parent | 26b957771974aee4457af5edf389509eb1ac80e7 (diff) |
gitlab-org/gitlab-ce#17818 - add api call for issues by group
rely only on IssuesFinder
docs and changelog
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/issues.rb | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/lib/api/issues.rb b/lib/api/issues.rb index 4c43257c48a..8a03a41e9c5 100644 --- a/lib/api/issues.rb +++ b/lib/api/issues.rb @@ -59,6 +59,41 @@ module API end end + resource :groups do + # Get a list of group issues + # + # Parameters: + # id (required) - The ID of a group + # state (optional) - Return "opened" or "closed" issues + # labels (optional) - Comma-separated list of label names + # milestone (optional) - Milestone title + # order_by (optional) - Return requests ordered by `created_at` or `updated_at` fields. Default is `created_at` + # sort (optional) - Return requests sorted in `asc` or `desc` order. Default is `desc` + # + # Example Requests: + # GET /groups/:id/issues + # GET /groups/:id/issues?state=opened + # GET /groups/:id/issues?state=closed + # GET /groups/:id/issues?labels=foo + # GET /groups/:id/issues?labels=foo,bar + # GET /groups/:id/issues?labels=foo,bar&state=opened + # GET /groups/:id/issues?milestone=1.0.0 + # GET /groups/:id/issues?milestone=1.0.0&state=closed + get ":id/issues" do + group = find_group(params[:id]) + + params[:state] ||= 'opened' + params[:group_id] = group.id + params[:milestone_title] = params.delete(:milestone) + params[:label_name] = params.delete(:labels) + params[:sort] = "#{params.delete(:order_by)}_#{params.delete(:sort)}" if params[:order_by] && params[:sort] + + issues = IssuesFinder.new(current_user, params).execute + + present paginate(issues), with: Entities::Issue, current_user: current_user + end + end + resource :projects do # Get a list of project issues # |