Skip to main content

Delete Comment

The deleteComment() function is used to remove a comment from a post. This functionality allows users to manage their comments by providing the capability to delete comments they no longer wish to keep.

note

Community Managers can delete other members commennts/replies as well, but reason is required.

Steps to Delete Comment

  1. Create an instance of DeleteCommentRequest with the required parameters: commentId, postId, and reason.
  2. Call the deleteComment() function using the instance of the LMFeedClient class, passing the request as a parameter.
  3. Use the response as per your requirement.
// Create an instance of DeleteCommentRequest
DeleteCommentRequest request = (DeleteCommentRequestBuilder()
..commentId("comment_id")
..postId("post_id")
..reason("reason_for_deletion"))
.build();

// Get the response from calling the function
final DeleteCommentResponse deleteCommentResponse = await lmFeedClient.deleteComment(deleteCommentRequest);

// Process the response, as per requirement
if (deleteCommentResponse.success) {
// your function to handle successful deletion of comment
handleDeleteCommentSuccess();
} else {
// your function to handle error message
handleDeleteCommentError(deleteCommentResponse.errorMessage);
}

Models

DeleteCommentRequest

List of parameters for the DeleteCommentRequest class

VariableTypeDescription
commentIdStringComment ID to be deleted
postIdStringPost ID for the comment
reasonStringOptional reason for deletion
note

deleteReason is only required when Community Manager deletes other members post.

DeleteCommentResponse

List of parameters for the DeleteCommentResponse class

VariableTypeDescriptionOptional
successboolAPI success status
errorMessageStringError message in failure