From 8bf89cb4aba188cd9abc41bb9eefb92458cfb75b Mon Sep 17 00:00:00 2001 From: Toon Claes Date: Thu, 20 Jul 2017 22:44:48 +0200 Subject: Add author_id & assignee_id param to /issues API Allow issues filtering on `author_id` and `assignee_id`. --- lib/api/issues.rb | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'lib/api') diff --git a/lib/api/issues.rb b/lib/api/issues.rb index 14b26f28ebf..621539afeaf 100644 --- a/lib/api/issues.rb +++ b/lib/api/issues.rb @@ -8,6 +8,9 @@ module API def find_issues(args = {}) args = params.merge(args) + # Do not scope to "authored" when author or assignee id is given + args.delete(:scope) if args[:author_id] || args[:assignee_id] + args.delete(:id) args[:milestone_title] = args.delete(:milestone) args[:label_name] = args.delete(:labels) @@ -29,6 +32,8 @@ module API optional :search, type: String, desc: 'Search issues for text present in the title or description' optional :created_after, type: DateTime, desc: 'Return issues created after the specified time' optional :created_before, type: DateTime, desc: 'Return issues created before the specified time' + optional :author_id, type: Integer, desc: 'Return issues which are authored by the user with the given ID' + optional :assignee_id, type: Integer, desc: 'Return issues which are assigned to the user with the given ID' use :pagination end -- cgit v1.2.3 From d8798c907dfb960856423422a91eb1e6dc8db090 Mon Sep 17 00:00:00 2001 From: Toon Claes Date: Mon, 24 Jul 2017 22:41:33 +0200 Subject: Allow query param scope for /issues API endpoint --- lib/api/issues.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'lib/api') diff --git a/lib/api/issues.rb b/lib/api/issues.rb index 621539afeaf..8f8d622fd34 100644 --- a/lib/api/issues.rb +++ b/lib/api/issues.rb @@ -8,9 +8,6 @@ module API def find_issues(args = {}) args = params.merge(args) - # Do not scope to "authored" when author or assignee id is given - args.delete(:scope) if args[:author_id] || args[:assignee_id] - args.delete(:id) args[:milestone_title] = args.delete(:milestone) args[:label_name] = args.delete(:labels) @@ -34,6 +31,8 @@ module API optional :created_before, type: DateTime, desc: 'Return issues created before the specified time' optional :author_id, type: Integer, desc: 'Return issues which are authored by the user with the given ID' optional :assignee_id, type: Integer, desc: 'Return issues which are assigned to the user with the given ID' + optional :scope, type: String, values: %w[created-by-me assigned-to-me all], + desc: 'Return merge requests for the given scope: `created-by-me`, `assigned-to-me` or `all`' use :pagination end @@ -60,9 +59,11 @@ module API optional :state, type: String, values: %w[opened closed all], default: 'all', desc: 'Return opened, closed, or all issues' use :issues_params + optional :scope, type: String, values: %w[created-by-me assigned-to-me all], default: 'created-by-me', + desc: 'Return merge requests for the given scope: `created-by-me`, `assigned-to-me` or `all`' end get do - issues = find_issues(scope: 'authored') + issues = find_issues present paginate(issues), with: Entities::IssueBasic, current_user: current_user end -- cgit v1.2.3