Module: Gitlab::Client::Notes

Included in:
Gitlab::Client
Defined in:
lib/gitlab/client/notes.rb

Overview

Defines methods related to notes.

Instance Method Summary collapse

Instance Method Details

#create_epic_note(group, epic, body) ⇒ Gitlab::ObjectifiedHash

Creates a new epic note.

Examples:

Gitlab.create_epic_note(6, 1, 'Adding a note to my epic.')

Parameters:

  • group (Integer, String)

    The ID or name of a group.

  • epic (Integer)

    The ID of an epic.

  • body (String)

    The body of a note.

Returns:



188
189
190
# File 'lib/gitlab/client/notes.rb', line 188

def create_epic_note(group, epic, body)
  post("/groups/#{url_encode group}/epics/#{epic}/notes", body: { body: body })
end

#create_issue_note(project, issue, body) ⇒ Gitlab::ObjectifiedHash

Creates a new issue note.

Examples:

Gitlab.create_issue_note(6, 1, 'Adding a note to my issue.')

Parameters:

  • project (Integer, String)

    The ID or name of a project.

  • issue (Integer)

    The ID of an issue.

  • body (String)

    The body of a note.

Returns:



149
150
151
# File 'lib/gitlab/client/notes.rb', line 149

def create_issue_note(project, issue, body)
  post("/projects/#{url_encode project}/issues/#{issue}/notes", body: { body: body })
end

#create_merge_request_note(project, merge_request, body) ⇒ Object Also known as: create_merge_request_comment

Creates a new note for a single merge request.

Examples:

Gitlab.create_merge_request_note(5, 3, 'This MR is ready for review.')

Parameters:

  • project (Integer)

    The ID of a project.

  • merge_request (Integer)

    The ID of a merge request.

  • body (String)

    The content of a note.



174
175
176
# File 'lib/gitlab/client/notes.rb', line 174

def create_merge_request_note(project, merge_request, body)
  post("/projects/#{url_encode project}/merge_requests/#{merge_request}/notes", body: { body: body })
end

#create_note(project, body) ⇒ Gitlab::ObjectifiedHash

Creates a new wall note.

Examples:

Gitlab.create_note(5, 'This is a wall note!')

Parameters:

  • project (Integer, String)

    The ID or name of a project.

  • body (String)

    The body of a note.

Returns:



136
137
138
# File 'lib/gitlab/client/notes.rb', line 136

def create_note(project, body)
  post("/projects/#{url_encode project}/notes", body: { body: body })
end

#create_snippet_note(project, snippet, body) ⇒ Gitlab::ObjectifiedHash

Creates a new snippet note.

Examples:

Gitlab.create_snippet_note(3, 2, 'Look at this awesome snippet!')

Parameters:

  • project (Integer, String)

    The ID or name of a project.

  • snippet (Integer)

    The ID of a snippet.

  • body (String)

    The body of a note.

Returns:



162
163
164
# File 'lib/gitlab/client/notes.rb', line 162

def create_snippet_note(project, snippet, body)
  post("/projects/#{url_encode project}/snippets/#{snippet}/notes", body: { body: body })
end

#delete_issue_note(project, issue, id) ⇒ Gitlab::ObjectifiedHash

Deletes an issue note.

Examples:

Gitlab.delete_issue_note(5, 10, 1)

Parameters:

  • project (Integer)

    The ID of a project.

  • issue (Integer)

    The ID of an issue.

  • id (Integer)

    The ID of a note.

Returns:



213
214
215
# File 'lib/gitlab/client/notes.rb', line 213

def delete_issue_note(project, issue, id)
  delete("/projects/#{url_encode project}/issues/#{issue}/notes/#{id}")
end

#delete_merge_request_note(project, merge_request, id) ⇒ Gitlab::ObjectifiedHash Also known as: delete_merge_request_comment

Deletes a merge_request note.

Examples:

Gitlab.delete_merge_request_note(5, 11, 3)

Parameters:

  • project (Integer)

    The ID of a project.

  • merge_request (Integer)

    The ID of a merge_request.

  • id (Integer)

    The ID of a note.

Returns:



239
240
241
# File 'lib/gitlab/client/notes.rb', line 239

def delete_merge_request_note(project, merge_request, id)
  delete("/projects/#{url_encode project}/merge_requests/#{merge_request}/notes/#{id}")
end

#delete_note(project, id) ⇒ Gitlab::ObjectifiedHash

Deletes a wall note.

Examples:

Gitlab.delete_note(5, 15)

Parameters:

  • project (Integer)

    The ID of a project.

  • id (Integer)

    The ID of a note.

Returns:



200
201
202
# File 'lib/gitlab/client/notes.rb', line 200

def delete_note(project, id)
  delete("/projects/#{url_encode project}/notes/#{id}")
end

#delete_snippet_note(project, snippet, id) ⇒ Gitlab::ObjectifiedHash

Deletes a snippet note.

Examples:

Gitlab.delete_snippet_note(5, 11, 3)

Parameters:

  • project (Integer)

    The ID of a project.

  • snippet (Integer)

    The ID of a snippet.

  • id (Integer)

    The ID of a note.

Returns:



226
227
228
# File 'lib/gitlab/client/notes.rb', line 226

def delete_snippet_note(project, snippet, id)
  delete("/projects/#{url_encode project}/snippets/#{snippet}/notes/#{id}")
end

#edit_issue_note(project, issue, id, body) ⇒ Gitlab::ObjectifiedHash

Modifies an issue note.

Examples:

Gitlab.edit_issue_note(5, 10, 1, 'This is an edited issue note')

Parameters:

  • project (Integer)

    The ID of a project.

  • issue (Integer)

    The ID of an issue.

  • id (Integer)

    The ID of a note.

  • body (String)

    The content of a note.

Returns:



267
268
269
# File 'lib/gitlab/client/notes.rb', line 267

def edit_issue_note(project, issue, id, body)
  put("/projects/#{url_encode project}/issues/#{issue}/notes/#{id}", body: note_content(body))
end

#edit_merge_request_note(project, merge_request, id, body) ⇒ Gitlab::ObjectifiedHash Also known as: edit_merge_request_comment

Modifies a merge_request note.

Examples:

Gitlab.edit_merge_request_note(5, 11, 3, 'This is an edited merge request note')

Parameters:

  • project (Integer)

    The ID of a project.

  • merge_request (Integer)

    The ID of a merge_request.

  • id (Integer)

    The ID of a note.

  • body (String)

    The content of a note.

Returns:



295
296
297
# File 'lib/gitlab/client/notes.rb', line 295

def edit_merge_request_note(project, merge_request, id, body)
  put("/projects/#{url_encode project}/merge_requests/#{merge_request}/notes/#{id}", body: note_content(body))
end

#edit_note(project, id, body) ⇒ Gitlab::ObjectifiedHash

Modifies a wall note.

Examples:

Gitlab.edit_note(5, 15, 'This is an edited note')

Parameters:

  • project (Integer)

    The ID of a project.

  • id (Integer)

    The ID of a note.

  • body (String)

    The content of a note.

Returns:



253
254
255
# File 'lib/gitlab/client/notes.rb', line 253

def edit_note(project, id, body)
  put("/projects/#{url_encode project}/notes/#{id}", body: note_content(body))
end

#edit_snippet_note(project, snippet, id, body) ⇒ Gitlab::ObjectifiedHash

Modifies a snippet note.

Examples:

Gitlab.edit_snippet_note(5, 11, 3, 'This is an edited snippet note')

Parameters:

  • project (Integer)

    The ID of a project.

  • snippet (Integer)

    The ID of a snippet.

  • id (Integer)

    The ID of a note.

  • body (String)

    The content of a note.

Returns:



281
282
283
# File 'lib/gitlab/client/notes.rb', line 281

def edit_snippet_note(project, snippet, id, body)
  put("/projects/#{url_encode project}/snippets/#{snippet}/notes/#{id}", body: note_content(body))
end

#epic_notes(group, epic, options = {}) ⇒ Array<Gitlab::ObjectifiedHash>

Gets a list of notes for an epic.

Examples:

Gitlab.epic_notes(5, 10)

Parameters:

  • project (Integer)

    The ID of a group.

  • epic (Integer)

    The ID of an epic.

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :page (Integer)

    The page number.

  • :per_page (Integer)

    The number of results per page.

Returns:



73
74
75
# File 'lib/gitlab/client/notes.rb', line 73

def epic_notes(group, epic, options = {})
  get("/groups/#{url_encode group}/epics/#{epic}/notes", query: options)
end

#issue_note(project, issue, id) ⇒ Gitlab::ObjectifiedHash

Gets a single issue note.

Examples:

Gitlab.issue_note(5, 10, 1)

Parameters:

  • project (Integer)

    The ID of a project.

  • issue (Integer)

    The ID of an issue.

  • id (Integer)

    The ID of a note.

Returns:



98
99
100
# File 'lib/gitlab/client/notes.rb', line 98

def issue_note(project, issue, id)
  get("/projects/#{url_encode project}/issues/#{issue}/notes/#{id}")
end

#issue_notes(project, issue, options = {}) ⇒ Array<Gitlab::ObjectifiedHash>

Gets a list of notes for a issue.

Examples:

Gitlab.issue_notes(5, 10)

Parameters:

  • project (Integer)

    The ID of a project.

  • issue (Integer)

    The ID of an issue.

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :page (Integer)

    The page number.

  • :per_page (Integer)

    The number of results per page.

Returns:



30
31
32
# File 'lib/gitlab/client/notes.rb', line 30

def issue_notes(project, issue, options = {})
  get("/projects/#{url_encode project}/issues/#{issue}/notes", query: options)
end

#merge_request_note(project, merge_request, id) ⇒ Gitlab::ObjectifiedHash

Gets a single merge_request note.

Examples:

Gitlab.merge_request_note(5, 11, 3)

Parameters:

  • project (Integer)

    The ID of a project.

  • merge_request (Integer)

    The ID of a merge_request.

  • id (Integer)

    The ID of a note.

Returns:



124
125
126
# File 'lib/gitlab/client/notes.rb', line 124

def merge_request_note(project, merge_request, id)
  get("/projects/#{url_encode project}/merge_requests/#{merge_request}/notes/#{id}")
end

#merge_request_notes(project, merge_request, options = {}) ⇒ Array<Gitlab::ObjectifiedHash> Also known as: merge_request_comments

Gets a list of notes for a merge request.

Examples:

Gitlab.merge_request_notes(5, 1)

Parameters:

  • project (Integer)

    The ID of a project.

  • merge_request (Integer)

    The ID of a merge request.

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :page (Integer)

    The page number.

  • :per_page (Integer)

    The number of results per page.

Returns:



58
59
60
# File 'lib/gitlab/client/notes.rb', line 58

def merge_request_notes(project, merge_request, options = {})
  get("/projects/#{url_encode project}/merge_requests/#{merge_request}/notes", query: options)
end

#note(project, id) ⇒ Gitlab::ObjectifiedHash

Gets a single wall note.

Examples:

Gitlab.note(5, 15)

Parameters:

  • project (Integer)

    The ID of a project.

  • id (Integer)

    The ID of a note.

Returns:



85
86
87
# File 'lib/gitlab/client/notes.rb', line 85

def note(project, id)
  get("/projects/#{url_encode project}/notes/#{id}")
end

#notes(project, options = {}) ⇒ Array<Gitlab::ObjectifiedHash>

Gets a list of projects notes.

Examples:

Gitlab.notes(5)

Parameters:

  • project (Integer)

    The ID of a project.

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :page (Integer)

    The page number.

  • :per_page (Integer)

    The number of results per page.

Returns:



16
17
18
# File 'lib/gitlab/client/notes.rb', line 16

def notes(project, options = {})
  get("/projects/#{url_encode project}/notes", query: options)
end

#snippet_note(project, snippet, id) ⇒ Gitlab::ObjectifiedHash

Gets a single snippet note.

Examples:

Gitlab.snippet_note(5, 11, 3)

Parameters:

  • project (Integer)

    The ID of a project.

  • snippet (Integer)

    The ID of a snippet.

  • id (Integer)

    The ID of a note.

Returns:



111
112
113
# File 'lib/gitlab/client/notes.rb', line 111

def snippet_note(project, snippet, id)
  get("/projects/#{url_encode project}/snippets/#{snippet}/notes/#{id}")
end

#snippet_notes(project, snippet, options = {}) ⇒ Array<Gitlab::ObjectifiedHash>

Gets a list of notes for a snippet.

Examples:

Gitlab.snippet_notes(5, 1)

Parameters:

  • project (Integer)

    The ID of a project.

  • snippet (Integer)

    The ID of a snippet.

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :page (Integer)

    The page number.

  • :per_page (Integer)

    The number of results per page.

Returns:



44
45
46
# File 'lib/gitlab/client/notes.rb', line 44

def snippet_notes(project, snippet, options = {})
  get("/projects/#{url_encode project}/snippets/#{snippet}/notes", query: options)
end