public interface

CommentService

com.atlassian.bitbucket.comment.CommentService

Summary

Public Methods
@Nonnull Comment addComment(AddLineCommentRequest request)
Adds a comment on a line on a file in a diff
@Nonnull Comment addComment(AddFileCommentRequest request)
Adds a comment on a file in a diff
@Nonnull Comment addComment(AddCommentRequest request)
Adds a general comment on a commentable
@Nonnull Comment addReply(AddCommentReplyRequest request)
Adds a comment reply to a tread
long countComments(CommentSearchRequest request)
Count all the comments matching the provided request.
long countThreads(CommentSearchRequest request)
Count all the threads matching the provided request.
boolean deleteComment(long commentId, int version)
Delete a comment
@Nonnull Optional<Comment> getComment(long commentId)
Find a comment with the given ID
@Nonnull Page<CommentThread> searchThreads(CommentSearchRequest request, PageRequest pageRequest)
Search for all threads matching the provided request.
@Nonnull Comment updateComment(CommentUpdateRequest request)
Updates a comment according to the provided request.

Public Methods

@Nonnull public Comment addComment (AddLineCommentRequest request)

Adds a comment on a line on a file in a diff

Parameters
request describes the comment to create
Returns
  • the created comment

@Nonnull public Comment addComment (AddFileCommentRequest request)

Adds a comment on a file in a diff

Parameters
request describes the comment to create
Returns
  • the created comment

@Nonnull public Comment addComment (AddCommentRequest request)

Adds a general comment on a commentable

Parameters
request describes the comment to create
Returns
  • the created comment

@Nonnull public Comment addReply (AddCommentReplyRequest request)

Adds a comment reply to a tread

Parameters
request a request describing the comment to be added
Returns
  • the created comment
Throws
NoSuchCommentException if the parent comment cannot be found

public long countComments (CommentSearchRequest request)

Count all the comments 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

public long countThreads (CommentSearchRequest request)

Count all the threads 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

public boolean deleteComment (long commentId, int version)

Delete a comment

Parameters
commentId the ID for the comment that should be deleted
version 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 replies
CommentOutOfDateException if the provided version doesn't match the comment's current version
NoSuchCommentException if the comment to delete cannot be found

@Nonnull public Optional<Comment> getComment (long commentId)

Find a comment with the given ID

Parameters
commentId the ID for the comment to look for
Returns
  • the comment with the given ID

@Nonnull public Page<CommentThread> searchThreads (CommentSearchRequest request, PageRequest pageRequest)

Search for all threads 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 search
pageRequest the request specifying the start and limit of the page
Returns
  • the threads matching the request

@Nonnull public Comment updateComment (CommentUpdateRequest request)

Updates a comment according to the provided request.

Parameters
request the request describing how the comment should be updated
Returns
  • the updated comment
Throws
CommentOutOfDateException if the provided version doesn't match the comment's current version
NoSuchCommentException if the comment to update cannot be found