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
- Create an instance of
DeleteCommentRequestwith the required parameters:commentId,postId, andreason. - Call the
deleteComment()function using the instance of theLMFeedClientclass, passing the request as a parameter. - 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
| Variable | Type | Description |
|---|---|---|
| commentId | String | Comment ID to be deleted |
| postId | String | Post ID for the comment |
| reason | String | Optional reason for deletion |
note
deleteReason is only required when Community Manager deletes other members post.
DeleteCommentResponse
List of parameters for the DeleteCommentResponse class
| Variable | Type | Description | Optional |
|---|---|---|---|
| success | bool | API success status | |
| errorMessage | String | Error message in failure | ✔ |