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
- Create an instance of
DeletePostRequest
with the required parameters:postId
for the post to delete,deleteReason
for the reason behind deletion, andisRepost
to indicate if it's a repost. - Call the
deletePost()
function using the instance of theLMFeedClient
class, passing the request as a parameter. - 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
Variable | Type | Description | Optional |
---|---|---|---|
postId | String | ID of the post to delete | |
deleteReason | String | Reason for post deletion | |
isRepost | bool | Indicates 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
Variable | Type | Description | Optional |
---|---|---|---|
success | bool | API success status | |
errorMessage | String | Error message in case of failure | ✔ |