Class CommentAPI


  • public class CommentAPI
    extends BaseAPI
    Comments are made by users on different objects. Objects can f.ex. be items, status, etc. Comments is simply a text that can be any length. Comments are made from the API of the object, see f.ex. Items for more details. Comments are however updated and deleted from the comment API.
    • Constructor Detail

    • Method Detail

      • getComments

        public List<Comment> getComments​(Reference reference)
        Used to retrieve all the comments that have been made on an object of the given type and with the given id. It returns a list of all the comments sorted in ascending order by time created.
        Parameters:
        reference - The reference to the object from which the comments should be retrieved
        Returns:
        The comments on the object
      • getComment

        public Comment getComment​(int commentId)
        Returns the contents of a comment. It is not possible to see where the comment was made, only the comment itself.
        Parameters:
        commentId - The id of the comment
        Returns:
        The comment
      • addComment

        public int addComment​(Reference reference,
                              CommentCreate comment,
                              boolean silent,
                              boolean hook)
        Adds a new comment to the object of the given type and id, f.ex. item 1.
        Parameters:
        reference - The reference to the object the comment should be added to
        comment - The comment that should be added
        silent - True if the update should be silent, false otherwise
      • updateComment

        public void updateComment​(int commentId,
                                  CommentUpdate comment)
        Updates an already created comment. This should only be used to correct spelling and grammatical mistakes in the comment.
        Parameters:
        commentId - The id of the comment
        comment - The updated comment definition
      • deleteComment

        public void deleteComment​(int commentId)
        Deletes a comment made by a user. This can be used to retract a comment that was made and which the user regrets.
        Parameters:
        commentId - The id of the comment