Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
java-gitlab-api
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
沈俊林
java-gitlab-api
Commits
fea8b0f7
Commit
fea8b0f7
authored
Dec 10, 2015
by
Erhan Sunar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
commit comment creation and listing added
parent
4fb0c518
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
0 deletions
+43
-0
GitlabAPI.java
src/main/java/org/gitlab/api/GitlabAPI.java
+43
-0
No files found.
src/main/java/org/gitlab/api/GitlabAPI.java
View file @
fea8b0f7
...
@@ -1572,4 +1572,47 @@ public class GitlabAPI {
...
@@ -1572,4 +1572,47 @@ public class GitlabAPI {
throw
new
RuntimeException
((
e
));
throw
new
RuntimeException
((
e
));
}
}
}
}
/**
* Post comment to commit
*
* @param projectId (required) - The ID of a project
* @param sha (required) - The name of a repository branch or tag or if not given the default branch
* @param note (required) - Text of comment
* @param path (optional) - The file path
* @param line (optional) - The line number
* @param line_type (optional) - The line type (new or old)
* @return A CommitComment
* @throws IOException on gitlab api call error
* @see <a href="http://doc.gitlab.com/ce/api/commits.html#post-comment-to-commit">http://doc.gitlab.com/ce/api/commits.html#post-comment-to-commit</a>
*/
public
CommitComment
createCommitComment
(
Integer
projectId
,
String
sha
,
String
note
,
String
path
,
String
line
,
String
line_type
)
throws
IOException
{
Query
query
=
new
Query
()
.
append
(
"id"
,
projectId
.
toString
())
.
appendIf
(
"sha"
,
sha
)
.
appendIf
(
"note"
,
note
)
.
appendIf
(
"path"
,
path
)
.
appendIf
(
"line"
,
line
);
String
tailUrl
=
GitlabProject
.
URL
+
"/"
+
sanitizeProjectId
(
projectId
)
+
"/repository/commits/"
+
sha
+
CommitComment
.
URL
+
query
.
toString
();
return
dispatch
().
to
(
tailUrl
,
CommitComment
.
class
);
}
/**
* Get the comments of a commit
*
* @param projectId (required) - The ID of a project
* @param sha (required) - The name of a repository branch or tag or if not given the default branch
* @return A CommitComment
* @throws IOException on gitlab api call error
* @see <a href="http://doc.gitlab.com/ce/api/commits.html#post-comment-to-commit">http://doc.gitlab.com/ce/api/commits.html#post-comment-to-commit</a>
*/
public
List
<
CommitComment
>
getCommitComments
(
Integer
projectId
,
String
sha
)
throws
IOException
{
String
tailUrl
=
GitlabProject
.
URL
+
"/"
+
sanitizeProjectId
(
projectId
)
+
"/repository/commits/"
+
sha
+
CommitComment
.
URL
;
return
Arrays
.
asList
(
retrieve
().
to
(
tailUrl
,
CommitComment
[].
class
));
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment