debian-mirror-gitlab/lib/api/merge_request_diffs.rb

52 lines
1.8 KiB
Ruby
Raw Normal View History

2018-12-05 23:21:45 +05:30
# frozen_string_literal: true
2016-09-29 09:46:39 +05:30
module API
# MergeRequestDiff API
2021-01-03 14:25:43 +05:30
class MergeRequestDiffs < ::API::Base
2017-08-17 22:00:37 +05:30
include PaginationParams
2016-09-29 09:46:39 +05:30
before { authenticate! }
2023-03-17 16:20:25 +05:30
feature_category :code_review_workflow
2021-01-29 00:20:46 +05:30
2017-08-17 22:00:37 +05:30
params do
2023-01-13 00:05:48 +05:30
requires :id, types: [String, Integer], desc: 'The ID or URL-encoded path of the project'
2017-08-17 22:00:37 +05:30
end
2019-02-15 15:39:39 +05:30
resource :projects, requirements: API::NAMESPACE_OR_PROJECT_REQUIREMENTS do
2016-09-29 09:46:39 +05:30
desc 'Get a list of merge request diff versions' do
detail 'This feature was introduced in GitLab 8.12.'
success Entities::MergeRequestDiff
2023-01-13 00:05:48 +05:30
tags %w[merge_requests]
is_array true
2016-09-29 09:46:39 +05:30
end
params do
2023-01-13 00:05:48 +05:30
requires :merge_request_iid, type: Integer, desc: 'The internal ID of the merge request'
2017-08-17 22:00:37 +05:30
use :pagination
2016-09-29 09:46:39 +05:30
end
2017-08-17 22:00:37 +05:30
get ":id/merge_requests/:merge_request_iid/versions" do
merge_request = find_merge_request_with_access(params[:merge_request_iid])
2016-09-29 09:46:39 +05:30
2018-03-17 18:26:18 +05:30
present paginate(merge_request.merge_request_diffs.order_id_desc), with: Entities::MergeRequestDiff
2016-09-29 09:46:39 +05:30
end
desc 'Get a single merge request diff version' do
detail 'This feature was introduced in GitLab 8.12.'
success Entities::MergeRequestDiffFull
2023-01-13 00:05:48 +05:30
tags %w[merge_requests]
2016-09-29 09:46:39 +05:30
end
params do
2023-01-13 00:05:48 +05:30
requires :merge_request_iid, type: Integer, desc: 'The internal ID of the merge request'
requires :version_id, type: Integer, desc: 'The ID of the merge request diff version'
2016-09-29 09:46:39 +05:30
end
2022-01-26 12:08:38 +05:30
get ":id/merge_requests/:merge_request_iid/versions/:version_id", urgency: :low do
2017-08-17 22:00:37 +05:30
merge_request = find_merge_request_with_access(params[:merge_request_iid])
2016-09-29 09:46:39 +05:30
2021-04-29 21:17:54 +05:30
present_cached merge_request.merge_request_diffs.find(params[:version_id]), with: Entities::MergeRequestDiffFull, cache_context: nil
2016-09-29 09:46:39 +05:30
end
end
end
end