summaryrefslogtreecommitdiff
path: root/lib/api/entities/draft_note.rb
blob: 70b32bac5026b8ec0f0f476341b625fc4aa30b85 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# frozen_string_literal: true

module API
  module Entities
    class DraftNote < Grape::Entity
      expose :id,                 documentation: { type: 'integer', example: 2 }
      expose :author_id,          documentation: { type: 'integer', example: 4 }
      expose :merge_request_id,   documentation: { type: 'integer', example: 52 }
      expose :resolve_discussion, documentation: { type: 'boolean', example: true }
      expose :discussion_id,      documentation: { type: 'integer', example: 613 }
      expose :note,               documentation: { type: 'string',  example: 'This is a note' }
      expose :commit_id,          documentation: { type: 'integer', example: 4 }
      expose :line_code,          documentation: { type: 'string',  example: '1c497fbb3a46b78edf0_2_4' }
      expose :position, documentation: {
        type: 'Hash',
        example: {
          base_sha: "aa149113",
          start_sha: "b3a0a8c4",
          head_sha: "be3020c7",
          old_path: "example.md",
          new_path: "example.md",
          position_type: "text",
          old_line: 2,
          new_line: 4,
          line_range: {
            start: {
              line_code: "1c497fbb3a46b78edf04cc2a2fa33f67e3ffbe2a_2_4",
              type: nil,
              old_line: 2,
              new_line: 4
            },
            end: {
              line_code: "1c497fbb3a46b78edf04cc2a2fa33f67e3ffbe2a_2_4",
              type: nil,
              old_line: 2,
              new_line: 4
            }
          }
        }
      } do |note|
        note.position.to_h
      end
    end
  end
end