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
6805b061
Commit
6805b061
authored
Dec 14, 2015
by
rockwotj
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of github.com:rockwotj/java-gitlab-api
parents
4fa09068
308a3ac5
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
99 additions
and
0 deletions
+99
-0
GitlabAPI.java
src/main/java/org/gitlab/api/GitlabAPI.java
+43
-0
CommitComment.java
src/main/java/org/gitlab/api/models/CommitComment.java
+56
-0
No files found.
src/main/java/org/gitlab/api/GitlabAPI.java
View file @
6805b061
...
...
@@ -1655,4 +1655,47 @@ public class GitlabAPI {
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
));
}
}
src/main/java/org/gitlab/api/models/CommitComment.java
0 → 100644
View file @
6805b061
package
org
.
gitlab
.
api
.
models
;
import
com.fasterxml.jackson.annotation.JsonProperty
;
public
class
CommitComment
{
public
static
final
String
URL
=
"/comments"
;
private
GitlabUser
author
;
private
String
note
;
private
String
path
;
private
String
line
;
@JsonProperty
(
"line_type"
)
private
String
lineType
;
public
GitlabUser
getAuthor
()
{
return
author
;
}
public
void
setAuthor
(
GitlabUser
author
)
{
this
.
author
=
author
;
}
public
String
getNote
()
{
return
note
;
}
public
void
setNote
(
String
note
)
{
this
.
note
=
note
;
}
public
String
getPath
()
{
return
path
;
}
public
void
setPath
(
String
path
)
{
this
.
path
=
path
;
}
public
String
getLine
()
{
return
line
;
}
public
void
setLine
(
String
line
)
{
this
.
line
=
line
;
}
public
String
getLineType
()
{
return
lineType
;
}
public
void
setLineType
(
String
lineType
)
{
this
.
lineType
=
lineType
;
}
}
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