Skip to main content

Delete Post

Users have the capability to delete their own posts, allowing them to easily remove any content they no longer wish to share.

note

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

Follow these steps to delete a post

  1. Create a DeletePostRequest object using DeletePostRequest.Builder class by passing all the required parameters.
  2. Call deletePost() function using the instance of LMFeedClient.
  3. Process the response (LMResponse<Nothing>) as per your requirement.
CoroutineScope(Dispatchers.IO).launch {
// object of DeletePostRequest
val deletePostRequest = DeletePostRequest.Builder()
.postId("ENTER POST ID") // id of the post to be deleted
.deleteReason("ENTER DELETE REASON") // reason for deletion required when CM deletes others post
.build()
// get response (LMResponse<Nothing>)
val response = LMFeedClient.getInstance().deletePost(deletePostRequest)
if (response.success) {
// your function to process post deleted action
processPostDeleted()
} else {
// your function to process error message
processError(response.errorMessage)
}
}

Models

DeletePostRequest

VARIABLETYPEDESCRIPTIONOPTIONAL
postIdStringUnique id of the post to be deleted.
deleteReasonStringReason for post deletion.
note

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