Skip to main content

Delete Post

The deletePost() function enables users to delete the published post.

note

Community Managers can also delete other members' posts, but a reason is required.

Steps to Delete a Post​

  1. Create an instance of DeletePostRequest with the required parameters: postId for the post to delete, deleteReason for the reason behind deletion, and isRepost to indicate if it's a repost.
  2. Call the deletePost() 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 DeletePostRequest
DeletePostRequest request = (DeletePostRequestBuilder()
..deleteReason("reason_for_deletion")
..postId("post_id")
..isRepost(false)) // send true, if deleting a reposted post
.build();

// Get the response from calling the function
final DeletePostResponse deletePostResponse = await lmFeedClient.deletePost(deletePostRequest);

// Process the response, as per requirement
if (deletePostResponse.success) {
// your function to handle successful post deletion
handleDeletePostSuccess();
} else {
// your function to handle error message
handleDeletePostError(deletePostResponse.errorMessage);
}

Models​

DeletePostRequest​

List of parameters for the DeletePostRequest class

VariableTypeDescriptionOptional
postIdStringID of the post to delete
deleteReasonStringReason for post deletion
isRepostboolIndicates if it's a repost✔
note

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

DeletePostResponse​

List of parameters for the DeletePostResponse class

VariableTypeDescriptionOptional
successboolAPI success status
errorMessageStringError message in case of failure✔