commentId, which is an immutable string. When creating a new comment, you do not need to specify your own
commentId.You can leave it to SDK to generate. We also provide optimistic update on each comment. You will need to send a
referenceIdwhich is a
contentIdfor current supported version. You need to use
AmityCommentRepositorybefore starting any activity with comments, such as editing an operation and/or flagging a comment.
In the future, we may support another
referenceTypeand will be available in creation method.
AmityCommentRepositorywhich are creating a comment as well as getting a collection of comments. They all return a LiveCollection with the comment model.
AmityCommentRepositoryclass. Before being able to call any comment method, you must initialize a repository instance using the
AmitySocialClientinstance, which you created on setup:
posttype comment is a comment that is intended for a regular post. A
contenttype comment on the other hand is intended for a content type post. A content type comment will automatically create a content post if the
referenceIddoes not exist yet.
createComment()method to create comment. You can provide
textwhile creating a comment.
parentIdis an optional parameter, useful for replying to a comment. The concept is similar to the
AmityMessagewhere you can reply to a message object with a
textdata is supported in the creation method.
getComments()method to query for comments. The query returns a LiveCollection of all the matching comments available.
parentId = commentId. To get parent level, pass
parentId = null. Omitting
parentIdwill get all comments on all levels.
PageList<AmityComment>. If you want to know which comments are deleted, you can check from
isDeleted()method in the AmityComment.
Note: If you use the
includeDeleted(...)method, you don't need to check
isDeleted()method in the AmityComment for deleted comments.
lastparameters. By default, the number of items in each page is 15. To handle pagination to load more comments, refer to Implementing feed pagination.
AmityCommenthas one data type
TEXT. Other types are coming soon.
AmityComment.Data.TEXTmodel, there is an
edit()method that initiates text data editing chain. The replacing text can be passed to
isDeletedflag is set to
delete()method is available on the
AmityCommentmodel. You need to pass the
commentIdand a boolean parameter. Set the boolean parameter to
truefor hard delete and
falsefor soft delete.
unflagmethods are available.
isFlaggedByMe: Booleanare also available in the
react()method to help instantiate
AmityCommentmodel provides info such as the reactions