summaryrefslogtreecommitdiff
path: root/lib/api/triggers.rb
diff options
context:
space:
mode:
authorTomasz Maczukin <tomasz@maczukin.pl>2016-01-04 16:38:32 +0100
committerTomasz Maczukin <tomasz@maczukin.pl>2016-01-04 16:44:09 +0100
commitd9da81f736b770bb44c4869aef5d5c455e74ab7a (patch)
treeeee8dad25362491e89c750e822e01bcdd0266d9d /lib/api/triggers.rb
parent0a62d3b5d55311eb425e92ca161d1786d16d2a0c (diff)
downloadgitlab-ce-d9da81f736b770bb44c4869aef5d5c455e74ab7a.tar.gz
Add triggers feature to API
Diffstat (limited to 'lib/api/triggers.rb')
-rw-r--r--lib/api/triggers.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/lib/api/triggers.rb b/lib/api/triggers.rb
index 2781f1cf191..9a1e3fdc976 100644
--- a/lib/api/triggers.rb
+++ b/lib/api/triggers.rb
@@ -43,6 +43,24 @@ module API
render_api_error!(errors, 400)
end
end
+
+ # Get triggers list
+ #
+ # Parameters:
+ # id (required) - The ID of a project
+ # page (optional) - The page number for pagination
+ # per_page (optional) - The value of items per page to show
+ # Example Request:
+ # GET /projects/:id/triggers
+ get ':id/triggers' do
+ authenticate!
+ authorize_admin_project
+
+ triggers = user_project.triggers.includes(:trigger_requests)
+ triggers = paginate(triggers)
+
+ present triggers, with: Entities::Trigger
+ end
end
end
end