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
- Create a DeletePostRequest object using
DeletePostRequest.Builder
class by passing all the required parameters. - Call
deletePost()
function using the instance ofLMFeedClient
. - 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
VARIABLE | TYPE | DESCRIPTION | OPTIONAL |
---|---|---|---|
postId | String | Unique id of the post to be deleted. | |
deleteReason | String | Reason for post deletion. | ✔ |
note
deleteReason
is only required when Community Manager deletes other members post.