summaryrefslogtreecommitdiff
path: root/lib/api/triggers.rb
diff options
context:
space:
mode:
authorTomasz Maczukin <tomasz@maczukin.pl>2016-01-05 11:44:10 +0100
committerTomasz Maczukin <tomasz@maczukin.pl>2016-01-05 11:47:54 +0100
commit49c8bf4e9b510be51859dcc301cb46b29b750cb0 (patch)
treec3dad654f969d95e508171d4bff9c6fc7eef99ca /lib/api/triggers.rb
parentf00607431cd13a952731e36701ebc3b39e64d09b (diff)
downloadgitlab-ce-49c8bf4e9b510be51859dcc301cb46b29b750cb0.tar.gz
Add create feature to triggers API
Diffstat (limited to 'lib/api/triggers.rb')
-rw-r--r--lib/api/triggers.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/api/triggers.rb b/lib/api/triggers.rb
index 3cb7810241f..38cf1e9a2e0 100644
--- a/lib/api/triggers.rb
+++ b/lib/api/triggers.rb
@@ -62,6 +62,22 @@ module API
present triggers, with: Entities::Trigger
end
+ # Create trigger
+ #
+ # Parameters:
+ # id (required) - The ID of a project
+ # Example Request:
+ # POST /projects/:id/triggers
+ post ':id/triggers' do
+ authenticate!
+ authorize_admin_project
+
+ trigger = user_project.triggers.new
+ trigger.save
+
+ present trigger, with: Entities::Trigger
+ end
+
# Delete trigger
#
# Parameters: