summaryrefslogtreecommitdiff
path: root/lib/api/discussions.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/api/discussions.rb')
-rw-r--r--lib/api/discussions.rb94
1 files changed, 47 insertions, 47 deletions
diff --git a/lib/api/discussions.rb b/lib/api/discussions.rb
index 91eb6a23701..06d9c53c2ab 100644
--- a/lib/api/discussions.rb
+++ b/lib/api/discussions.rb
@@ -22,7 +22,7 @@ module API
success Entities::Discussion
end
params do
- requires :noteable_id, types: [Integer, String], desc: 'The ID of the noteable'
+ requires :noteable_id, types: [Integer, String], desc: "The ID of the noteable"
use :pagination
end
# rubocop: disable CodeReuse/ActiveRecord
@@ -45,8 +45,8 @@ module API
success Entities::Discussion
end
params do
- requires :discussion_id, type: String, desc: 'The ID of a discussion'
- requires :noteable_id, types: [Integer, String], desc: 'The ID of the noteable'
+ requires :discussion_id, type: String, desc: "The ID of a discussion"
+ requires :noteable_id, types: [Integer, String], desc: "The ID of the noteable"
end
get ":id/#{noteables_path}/:noteable_id/discussions/:discussion_id" do
noteable = find_noteable(parent_type, noteables_str, params[:noteable_id])
@@ -65,36 +65,36 @@ module API
success Entities::Discussion
end
params do
- requires :noteable_id, types: [Integer, String], desc: 'The ID of the noteable'
- requires :body, type: String, desc: 'The content of a note'
- optional :created_at, type: String, desc: 'The creation date of the note'
+ requires :noteable_id, types: [Integer, String], desc: "The ID of the noteable"
+ requires :body, type: String, desc: "The content of a note"
+ optional :created_at, type: String, desc: "The creation date of the note"
optional :position, type: Hash do
- requires :base_sha, type: String, desc: 'Base commit SHA in the source branch'
- requires :start_sha, type: String, desc: 'SHA referencing commit in target branch'
- requires :head_sha, type: String, desc: 'SHA referencing HEAD of this merge request'
- requires :position_type, type: String, desc: 'Type of the position reference', values: %w(text image)
- optional :new_path, type: String, desc: 'File path after change'
- optional :new_line, type: Integer, desc: 'Line number after change'
- optional :old_path, type: String, desc: 'File path before change'
- optional :old_line, type: Integer, desc: 'Line number before change'
- optional :width, type: Integer, desc: 'Width of the image'
- optional :height, type: Integer, desc: 'Height of the image'
- optional :x, type: Integer, desc: 'X coordinate in the image'
- optional :y, type: Integer, desc: 'Y coordinate in the image'
+ requires :base_sha, type: String, desc: "Base commit SHA in the source branch"
+ requires :start_sha, type: String, desc: "SHA referencing commit in target branch"
+ requires :head_sha, type: String, desc: "SHA referencing HEAD of this merge request"
+ requires :position_type, type: String, desc: "Type of the position reference", values: %w[text image]
+ optional :new_path, type: String, desc: "File path after change"
+ optional :new_line, type: Integer, desc: "Line number after change"
+ optional :old_path, type: String, desc: "File path before change"
+ optional :old_line, type: Integer, desc: "Line number before change"
+ optional :width, type: Integer, desc: "Width of the image"
+ optional :height, type: Integer, desc: "Height of the image"
+ optional :x, type: Integer, desc: "X coordinate in the image"
+ optional :y, type: Integer, desc: "Y coordinate in the image"
end
end
post ":id/#{noteables_path}/:noteable_id/discussions" do
noteable = find_noteable(parent_type, noteables_str, params[:noteable_id])
- type = params[:position] ? 'DiffNote' : 'DiscussionNote'
+ type = params[:position] ? "DiffNote" : "DiscussionNote"
id_key = noteable.is_a?(Commit) ? :commit_id : :noteable_id
opts = {
- note: params[:body],
- created_at: params[:created_at],
- type: type,
- noteable_type: noteables_str.classify,
- position: params[:position],
- id_key => noteable.id
+ :note => params[:body],
+ :created_at => params[:created_at],
+ :type => type,
+ :noteable_type => noteables_str.classify,
+ :position => params[:position],
+ id_key => noteable.id,
}
note = create_note(noteable, opts)
@@ -110,8 +110,8 @@ module API
success Entities::Discussion
end
params do
- requires :discussion_id, type: String, desc: 'The ID of a discussion'
- requires :noteable_id, types: [Integer, String], desc: 'The ID of the noteable'
+ requires :discussion_id, type: String, desc: "The ID of a discussion"
+ requires :noteable_id, types: [Integer, String], desc: "The ID of the noteable"
end
get ":id/#{noteables_path}/:noteable_id/discussions/:discussion_id/notes" do
noteable = find_noteable(parent_type, noteables_str, params[:noteable_id])
@@ -128,10 +128,10 @@ module API
success Entities::Note
end
params do
- requires :noteable_id, types: [Integer, String], desc: 'The ID of the noteable'
- requires :discussion_id, type: String, desc: 'The ID of a discussion'
- requires :body, type: String, desc: 'The content of a note'
- optional :created_at, type: String, desc: 'The creation date of the note'
+ requires :noteable_id, types: [Integer, String], desc: "The ID of the noteable"
+ requires :discussion_id, type: String, desc: "The ID of a discussion"
+ requires :body, type: String, desc: "The content of a note"
+ optional :created_at, type: String, desc: "The creation date of the note"
end
post ":id/#{noteables_path}/:noteable_id/discussions/:discussion_id/notes" do
noteable = find_noteable(parent_type, noteables_str, params[:noteable_id])
@@ -142,9 +142,9 @@ module API
opts = {
note: params[:body],
- type: 'DiscussionNote',
+ type: "DiscussionNote",
in_reply_to_discussion_id: params[:discussion_id],
- created_at: params[:created_at]
+ created_at: params[:created_at],
}
note = create_note(noteable, opts)
@@ -159,9 +159,9 @@ module API
success Entities::Note
end
params do
- requires :noteable_id, types: [Integer, String], desc: 'The ID of the noteable'
- requires :discussion_id, type: String, desc: 'The ID of a discussion'
- requires :note_id, type: Integer, desc: 'The ID of a note'
+ requires :noteable_id, types: [Integer, String], desc: "The ID of the noteable"
+ requires :discussion_id, type: String, desc: "The ID of a discussion"
+ requires :note_id, type: Integer, desc: "The ID of a note"
end
get ":id/#{noteables_path}/:noteable_id/discussions/:discussion_id/notes/:note_id" do
noteable = find_noteable(parent_type, noteables_str, params[:noteable_id])
@@ -173,11 +173,11 @@ module API
success Entities::Note
end
params do
- requires :noteable_id, types: [Integer, String], desc: 'The ID of the noteable'
- requires :discussion_id, type: String, desc: 'The ID of a discussion'
- requires :note_id, type: Integer, desc: 'The ID of a note'
- optional :body, type: String, desc: 'The content of a note'
- optional :resolved, type: Boolean, desc: 'Mark note resolved/unresolved'
+ requires :noteable_id, types: [Integer, String], desc: "The ID of the noteable"
+ requires :discussion_id, type: String, desc: "The ID of a discussion"
+ requires :note_id, type: Integer, desc: "The ID of a note"
+ optional :body, type: String, desc: "The content of a note"
+ optional :resolved, type: Boolean, desc: "Mark note resolved/unresolved"
exactly_one_of :body, :resolved
end
put ":id/#{noteables_path}/:noteable_id/discussions/:discussion_id/notes/:note_id" do
@@ -194,9 +194,9 @@ module API
success Entities::Note
end
params do
- requires :noteable_id, types: [Integer, String], desc: 'The ID of the noteable'
- requires :discussion_id, type: String, desc: 'The ID of a discussion'
- requires :note_id, type: Integer, desc: 'The ID of a note'
+ requires :noteable_id, types: [Integer, String], desc: "The ID of the noteable"
+ requires :discussion_id, type: String, desc: "The ID of a discussion"
+ requires :note_id, type: Integer, desc: "The ID of a note"
end
delete ":id/#{noteables_path}/:noteable_id/discussions/:discussion_id/notes/:note_id" do
noteable = find_noteable(parent_type, noteables_str, params[:noteable_id])
@@ -209,9 +209,9 @@ module API
success Entities::Discussion
end
params do
- requires :noteable_id, types: [Integer, String], desc: 'The ID of the noteable'
- requires :discussion_id, type: String, desc: 'The ID of a discussion'
- requires :resolved, type: Boolean, desc: 'Mark discussion resolved/unresolved'
+ requires :noteable_id, types: [Integer, String], desc: "The ID of the noteable"
+ requires :discussion_id, type: String, desc: "The ID of a discussion"
+ requires :resolved, type: Boolean, desc: "Mark discussion resolved/unresolved"
end
put ":id/#{noteables_path}/:noteable_id/discussions/:discussion_id" do
noteable = find_noteable(parent_type, noteables_str, params[:noteable_id])