diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2016-08-12 14:44:49 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2016-08-12 14:44:49 +0300 |
commit | ac072132b8f0e36badf297208a5964109dbed126 (patch) | |
tree | f09499bbaa3bbcf2910ee1c4cee387125976db9e /lib/api/merge_request_diffs.rb | |
parent | 445edcfacc583ba613a4b865b104d7d7e1f7ec0f (diff) | |
download | gitlab-ce-ac072132b8f0e36badf297208a5964109dbed126.tar.gz |
Add single merge request diff API endpoint
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'lib/api/merge_request_diffs.rb')
-rw-r--r-- | lib/api/merge_request_diffs.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/api/merge_request_diffs.rb b/lib/api/merge_request_diffs.rb index a2f92f81107..07435d78468 100644 --- a/lib/api/merge_request_diffs.rb +++ b/lib/api/merge_request_diffs.rb @@ -21,6 +21,25 @@ module API authorize! :read_merge_request, merge_request present merge_request.merge_request_diffs, with: Entities::MergeRequestDiff end + + desc 'Get a single merge request diff version' do + detail 'This feature was introduced in GitLab 8.12.' + success Entities::MergeRequestDiffFull + end + + params do + requires :id, type: String, desc: 'The ID of a project' + requires :merge_request_id, type: Integer, desc: 'The ID of a merge request' + requires :version_id, type: Integer, desc: 'The ID of a merge request diff version' + end + + get ":id/merge_requests/:merge_request_id/versions/:version_id" do + merge_request = user_project.merge_requests. + find(params[:merge_request_id]) + + authorize! :read_merge_request, merge_request + present merge_request.merge_request_diffs.find(params[:version_id]), with: Entities::MergeRequestDiffFull + end end end end |