diff options
author | James Lopez <james@jameslopez.es> | 2017-07-05 16:27:32 +0200 |
---|---|---|
committer | James Lopez <james@jameslopez.es> | 2017-07-06 15:27:48 +0200 |
commit | 6ee87aea89ef78e2e98df0e61225950446a822aa (patch) | |
tree | c54e96a9917c74a3a3aae97e95abe5c4b1cff0b5 /lib/api | |
parent | e0345c8da11eac8e50981a2e218e6a76e3b4af1f (diff) | |
download | gitlab-ce-6ee87aea89ef78e2e98df0e61225950446a822aa.tar.gz |
add user agent details API endpoints to issues and snippets
Diffstat (limited to 'lib/api')
-rw-r--r-- | lib/api/issues.rb | 17 | ||||
-rw-r--r-- | lib/api/snippets.rb | 17 |
2 files changed, 34 insertions, 0 deletions
diff --git a/lib/api/issues.rb b/lib/api/issues.rb index 09dca0dff8b..88dd31739da 100644 --- a/lib/api/issues.rb +++ b/lib/api/issues.rb @@ -241,6 +241,23 @@ module API present paginate(merge_requests), with: Entities::MergeRequestBasic, current_user: current_user, project: user_project end + + desc 'Get the user agent details for an issue' do + success Entities::UserAgentDetail + end + params do + requires :issue_iid, type: Integer, desc: 'The internal ID of a project issue' + end + get ":id/issues/:issue_iid/user_agent_detail" do + authenticated_as_admin! + + issue = find_project_issue(params[:issue_iid]) + + return not_found!('Issue') unless issue + return not_found!('UserAgentDetail') unless issue.user_agent_detail + + present issue.user_agent_detail, with: Entities::UserAgentDetail, current_user: current_user, project: user_project + end end end end diff --git a/lib/api/snippets.rb b/lib/api/snippets.rb index c630c24c339..db4e0b0b013 100644 --- a/lib/api/snippets.rb +++ b/lib/api/snippets.rb @@ -140,6 +140,23 @@ module API content_type 'text/plain' present snippet.content end + + desc 'Get the user agent details for a snippet' do + success Entities::UserAgentDetail + end + params do + requires :id, type: Integer, desc: 'The ID of a snippet' + end + get ":id/user_agent_detail" do + authenticated_as_admin! + + snippet = Snippet.find_by(id: params[:id]) + + return not_found!('Snippet') unless snippet + return not_found!('UserAgentDetail') unless snippet.user_agent_detail + + present snippet.user_agent_detail, with: Entities::UserAgentDetail + end end end end |