From ee6187bd554f6f257600a67f65f8af95cf9afa9a Mon Sep 17 00:00:00 2001 From: Nihad Abbasov Date: Thu, 29 Nov 2012 15:52:56 -0800 Subject: API: ability to create a wall note --- lib/api/notes.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'lib/api') diff --git a/lib/api/notes.rb b/lib/api/notes.rb index 924eeaa3618..b47ff5c300f 100644 --- a/lib/api/notes.rb +++ b/lib/api/notes.rb @@ -17,6 +17,24 @@ module Gitlab present paginate(@notes), with: Entities::Note end + # Create a new project wall note + # + # Parameters: + # id (required) - The ID or code name of a project + # body (required) - The content of a note + # Example Request: + # POST /projects/:id/notes + post ":id/notes" do + @note = user_project.notes.new(note: params[:body]) + @note.author = current_user + + if @note.save + present @note, with: Entities::Note + else + not_found! + end + end + NOTEABLE_TYPES.each do |noteable_type| noteables_str = noteable_type.to_s.underscore.pluralize noteable_id_str = "#{noteable_type.to_s.underscore}_id" -- cgit v1.2.1