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_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:



132
133
134
# File 'lib/gitlab/client/notes.rb', line 132

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

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.



157
158
159
# File 'lib/gitlab/client/notes.rb', line 157

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:



119
120
121
# File 'lib/gitlab/client/notes.rb', line 119

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:



145
146
147
# File 'lib/gitlab/client/notes.rb', line 145

def create_snippet_note(project, snippet, body)
  post("/projects/#{url_encode project}/snippets/#{snippet}/notes", body: { body: body })
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:



81
82
83
# File 'lib/gitlab/client/notes.rb', line 81

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:



28
29
30
# File 'lib/gitlab/client/notes.rb', line 28

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:



107
108
109
# File 'lib/gitlab/client/notes.rb', line 107

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>

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:



56
57
58
# File 'lib/gitlab/client/notes.rb', line 56

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:



68
69
70
# File 'lib/gitlab/client/notes.rb', line 68

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:



14
15
16
# File 'lib/gitlab/client/notes.rb', line 14

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:



94
95
96
# File 'lib/gitlab/client/notes.rb', line 94

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:



42
43
44
# File 'lib/gitlab/client/notes.rb', line 42

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