diff options
author | Tomasz Maczukin <tomasz@maczukin.pl> | 2016-01-04 16:38:32 +0100 |
---|---|---|
committer | Tomasz Maczukin <tomasz@maczukin.pl> | 2016-01-04 16:44:09 +0100 |
commit | d9da81f736b770bb44c4869aef5d5c455e74ab7a (patch) | |
tree | eee8dad25362491e89c750e822e01bcdd0266d9d /lib/api/triggers.rb | |
parent | 0a62d3b5d55311eb425e92ca161d1786d16d2a0c (diff) | |
download | gitlab-ce-d9da81f736b770bb44c4869aef5d5c455e74ab7a.tar.gz |
Add triggers feature to API
Diffstat (limited to 'lib/api/triggers.rb')
-rw-r--r-- | lib/api/triggers.rb | 18 |
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 |