-
-
Notifications
You must be signed in to change notification settings - Fork 395
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Notes api for wall, issues, and snippets notes. List, read and create.
- Loading branch information
1 parent
11e4c0c
commit 63c3592
Showing
2 changed files
with
107 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
class Gitlab::Client | ||
# Defines methods related to notes. | ||
module Notes | ||
# Gets a list of projects notes. | ||
# | ||
# @example | ||
# Gitlab.notes(5) | ||
# | ||
# @param [Integer, String] project The ID or code name of a project. | ||
# @return [Array<Gitlab::ObjectifiedHash>] | ||
def notes(project) | ||
get("/projects/#{project}/notes") | ||
end | ||
|
||
# Gets a list of notes for a issue. | ||
# | ||
# @example | ||
# Gitlab.issue_notes(5, 10) | ||
# | ||
# @param [Integer, String] project The ID or code name of a project. | ||
# @param [Integer] issue The ID of an issue. | ||
# @return [Array<Gitlab::ObjectifiedHash>] | ||
def issue_notes(project, issue) | ||
get("/projects/#{project}/issues/#{issue}/notes") | ||
end | ||
|
||
# Gets a list of notes for a snippet. | ||
# | ||
# @example | ||
# Gitlab.snippet_notes(5, 1) | ||
# | ||
# @param [Integer, String] project The ID or code name of a project. | ||
# @param [Integer] snippet The ID of a snippet. | ||
# @return [Array<Gitlab::ObjectifiedHash>] | ||
def snippet_notes(project, snippet) | ||
get("/projects/#{project}/snippets/#{snippet}/notes") | ||
end | ||
|
||
# Return single wall note | ||
# | ||
# @example | ||
# Gitlab.note(5, 15) | ||
# | ||
# @param [Integer, String] project The ID or code name of a project. | ||
# @param [Integer] id The ID of a note. | ||
# @return [Gitlab::ObjectifiedHash] | ||
def note(project, id) | ||
get("/projects/#{project}/notes/#{id}") | ||
end | ||
|
||
# Return single issue note | ||
# | ||
# @example | ||
# Gitlab.issue_note(5, 10, 1) | ||
# | ||
# @param [Integer, String] project The ID or code name of a project. | ||
# @param [Integer] issue The ID of a issue. | ||
# @param [Integer] id The ID of a note. | ||
# @return [Gitlab::ObjectifiedHash] | ||
def issue_note(project, issue, id) | ||
get("/projects/#{project}/issues/#{issue}/notes/#{id}") | ||
end | ||
|
||
# Return single snippet note | ||
# | ||
# @example | ||
# Gitlab.snippet_note(5, 11, 3) | ||
# | ||
# @param [Integer, String] project The ID or code name of a project. | ||
# @param [Integer] snippet The ID of an snippet. | ||
# @param [Integer] id The ID of an note. | ||
# @return [Gitlab::ObjectifiedHash] | ||
def snippet_note(project, id) | ||
get("/projects/#{project}/snippets/#{snippet}/notes/#{id}") | ||
end | ||
|
||
# Creates a new wall note. | ||
# | ||
# @param [Integer, String] project The ID or code name of a project. | ||
# @param [String] body The body of a note. | ||
# @return [Gitlab::ObjectifiedHash] Information about created note. | ||
def create_note(project, body) | ||
post("/projects/#{project}/notes", :body => {:body => body}) | ||
end | ||
|
||
# Creates a new issue note. | ||
# | ||
# @param [Integer, String] project The ID or code name of a project. | ||
# @param [Integer] issue The ID of an issue. | ||
# @param [String] body The body of a note. | ||
# @return [Gitlab::ObjectifiedHash] Information about created note. | ||
def create_issue_note(project, issue, body) | ||
post("/projects/#{project}/issues/#{issue}/notes", :body => {:body => body}) | ||
end | ||
|
||
# Creates a new snippet note. | ||
# | ||
# @param [Integer, String] project The ID or code name of a project. | ||
# @param [Integer] snippet The ID of an issue. | ||
# @param [String] body The body of a note. | ||
# @return [Gitlab::ObjectifiedHash] Information about created note. | ||
def create_snippet_note(project, snippet, body) | ||
post("/projects/#{project}/snippets/#{snippet}/notes", :body => {:body => body}) | ||
end | ||
end | ||
end |