API:merge request show && list
This commit is contained in:
parent
42abdf69d5
commit
bd049e5e7c
|
@ -18,5 +18,6 @@ module Gitlab
|
|||
mount Issues
|
||||
mount Milestones
|
||||
mount Session
|
||||
mount MergeRequests
|
||||
end
|
||||
end
|
||||
|
|
|
@ -63,5 +63,11 @@ module Gitlab
|
|||
class SSHKey < Grape::Entity
|
||||
expose :id, :title, :key
|
||||
end
|
||||
|
||||
class MergeRequest < Grape::Entity
|
||||
expose :id, :target_branch, :source_branch, :project_id,
|
||||
:title, :closed, :merged
|
||||
expose :author, :assignee, using: Entities::UserBasic
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
31
lib/api/merge_requests.rb
Normal file
31
lib/api/merge_requests.rb
Normal file
|
@ -0,0 +1,31 @@
|
|||
module Gitlab
|
||||
# Issues API
|
||||
class MergeRequests < Grape::API
|
||||
before { authenticate! }
|
||||
|
||||
resource :projects do
|
||||
#list
|
||||
get ":id/merge_requests" do
|
||||
project = current_user.projects.find(params[:id])
|
||||
present project.merge_requests, with: Entities::MergeRequest
|
||||
end
|
||||
|
||||
#show
|
||||
get ":id/merge_request/:merge_request_id" do
|
||||
project = current_user.projects.find(params[:id])
|
||||
present project.merge_requests.find(params[:merge_request_id]), with: Entities::MergeRequest
|
||||
end
|
||||
|
||||
#create merge_request
|
||||
post ":id/merge_requests" do
|
||||
|
||||
end
|
||||
|
||||
#update merge_request
|
||||
put ":id/merge_request/:merge_request_id" do
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
end
|
Loading…
Reference in a new issue