API:merge request show && list
This commit is contained in:
parent
42abdf69d5
commit
bd049e5e7c
3 changed files with 38 additions and 0 deletions
|
@ -18,5 +18,6 @@ module Gitlab
|
||||||
mount Issues
|
mount Issues
|
||||||
mount Milestones
|
mount Milestones
|
||||||
mount Session
|
mount Session
|
||||||
|
mount MergeRequests
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -63,5 +63,11 @@ module Gitlab
|
||||||
class SSHKey < Grape::Entity
|
class SSHKey < Grape::Entity
|
||||||
expose :id, :title, :key
|
expose :id, :title, :key
|
||||||
end
|
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
|
||||||
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…
Add table
Reference in a new issue