Interface CommentService
- Since:
- 5.0
-
Method Summary
Modifier and TypeMethodDescriptionaddComment
(AddCommentRequest request) Adds a general comment on a commentable.addComment
(AddFileCommentRequest request) Adds a comment on a file in a diff.addComment
(AddLineCommentRequest request) Adds a comment on a line on a file in a diff.addReply
(AddCommentReplyRequest request) Adds a comment reply to atread
.long
countComments
(CommentSearchRequest request) Count all thecomments
matching the provided request.countCommentsByState
(CommentSearchRequest request) long
countThreads
(CommentSearchRequest request) Count all thethreads
matching the provided request.boolean
deleteComment
(long commentId, int version) Delete a comment.getComment
(long commentId) Find a comment with the given ID.search
(CommentSearchRequest request, PageRequest pageRequest) Search for allcomments
matching the provided request.searchThreads
(CommentSearchRequest request, PageRequest pageRequest) Search for allthreads
matching the provided request.updateComment
(CommentUpdateRequest request) Updates acomment
according to the providedrequest
, with the following restrictions: only the author of the comment may update the text of the comment only the author of the comment, the author of the pull request (in the case of comments on pull requests) or repository admins and above may update the other fields of a comment
-
Method Details
-
addComment
Adds a general comment on a commentable.- Parameters:
request
- describes the comment to create- Returns:
- the created comment
- Throws:
RepositoryArchivedException
- if the repository is archived
-
addComment
Adds a comment on a file in a diff.- Parameters:
request
- describes the comment to create- Returns:
- the created comment
- Throws:
RepositoryArchivedException
- if the repository is archived
-
addComment
Adds a comment on a line on a file in a diff.- Parameters:
request
- describes the comment to create- Returns:
- the created comment
- Throws:
RepositoryArchivedException
- if the repository is archived
-
addReply
Adds a comment reply to atread
.- Parameters:
request
- a request describing the comment to be added- Returns:
- the created comment
- Throws:
NoSuchCommentException
- if the parent comment cannot be foundRepositoryArchivedException
- if the repository is archived
-
countComments
Count all thecomments
matching the provided request.If present, each one of the properties in the search request applies an extra filter to the search criteria. A
null
value (or an empty collection) means no filter will be applied for that property.Orphaned
comments are not counted by this endpoint.- Parameters:
request
- the request describing the search- Returns:
- the number of comments matching the request
-
countCommentsByState
Count all thecomments
matching the provided request, grouped bystate
.If present, each one of the properties in the search request applies an extra filter to the search criteria. A
null
value (or an empty collection) means no filter will be applied for that property.- Parameters:
request
- the request describing the search- Returns:
- the number of comments matching the request, grouped by state.
- Since:
- 6.8
-
countThreads
Count all thethreads
matching the provided request.If present, each one of the properties in the search request applies an extra filter to the search criteria. A
null
value (or an empty collection) means no filter will be applied for that property.Orphaned
comments are not counted by this endpoint.- Parameters:
request
- the request describing the search- Returns:
- the number of threads matching the request
-
deleteComment
boolean deleteComment(long commentId, int version) Delete a comment.- Parameters:
commentId
- the ID for the comment that should be deletedversion
- the expected version for the comment to delete- Returns:
true
if the comment existed and was deleted,false
otherwise- Throws:
CommentDeletionException
- if the comment has repliesCommentOutOfDateException
- if the providedversion
doesn't match the comment's current versionNoSuchCommentException
- if the comment to delete cannot be foundRepositoryArchivedException
- if the repository is archived
-
getComment
Find a comment with the given ID.- Parameters:
commentId
- the ID for the comment to look for- Returns:
- the comment with the given ID
-
search
@Nonnull Page<Comment> search(@Nonnull CommentSearchRequest request, @Nonnull PageRequest pageRequest) Search for allcomments
matching the provided request.If present, each one of the properties in the search request applies an extra filter to the search criteria. A
null
value (or an empty collection) means no filter will be applied for that property.- Parameters:
request
- the request describing the searchpageRequest
- the request specifying the start and limit of the page- Returns:
- the comments matching the request
- Since:
- 6.7
-
searchThreads
@Nonnull Page<CommentThread> searchThreads(@Nonnull CommentSearchRequest request, @Nonnull PageRequest pageRequest) Search for allthreads
matching the provided request.If present, each one of the properties in the search request applies an extra filter to the search criteria. A
null
value (or an empty collection) means no filter will be applied for that property.Orphaned
comments are not returned by this endpoint.- Parameters:
request
- the request describing the searchpageRequest
- the request specifying the start and limit of the page- Returns:
- the threads matching the request
-
updateComment
Updates acomment
according to the providedrequest
, with the following restrictions:- only the author of the comment may update the text of the comment
- only the author of the comment, the author of the pull request (in the case of comments on pull requests) or repository admins and above may update the other fields of a comment
- Parameters:
request
- the request describing how the comment should be updated- Returns:
- the updated comment
- Throws:
CommentOutOfDateException
- if the providedversion
doesn't match the comment's current versionNoSuchCommentException
- if the comment to update cannot be foundRepositoryArchivedException
- if the repository is archived
-