Skip to main content

Edit Pending Post

The editPendingPost() function is used to edit a pending post. It takes an EditPendingPostRequest as input, which includes the postId and other editable fields. The function returns an LMResponse<EditPendingPostResponse> as a Future.

Steps to Edit a Pending Post

  1. Create an instance of EditPendingPostRequest with the required parameters: postId and other editable fields.
  2. Call the editPendingPost() 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 EditPendingPostRequest
EditPendingPostRequest request = EditPendingPostRequest(
postId: "post_id",
postText: "Updated text",
heading: "Updated heading",
attachments: [Attachment()],
topicIds: ["topic1", "topic2"],
isRepost: true
);

// Get the response from calling the function
final LMResponse<EditPendingPostResponse> editPendingPostResponse = await lmFeedClient.editPendingPost(request);

// Process the response, as per requirement
if (editPendingPostResponse.success) {
// your function to handle successful edit of the pending post
handleEditPendingPostSuccess(editPendingPostResponse.data.post);
} else {
// your function to handle error message
handleEditPendingPostError(editPendingPostResponse.errorMessage);
}

Models

EditPendingPostRequest

List of parameters for the EditPendingPostRequest class

VariableTypeDescriptionOptional
postIdStringUnique identifier of the post
postTextStringUpdated text content
headingStringUpdated heading
attachmentsList<Attachment>List of attachments
topicIdsList<String>List of topic IDs
isRepostboolIndicates if it is a repost

EditPendingPostResponse

List of parameters for the EditPendingPostResponse class

VariableTypeDescriptionOptional
postPostThe edited pending post entity
userMap<String, User>Map of users
topicsMap<String, Topic>Map of topics
widgetsMap<String, WidgetModel>Map of widgets
repostedPostsMap<String, Post>Map of reposted posts
userTopicsMap<String, List<String>>Map of user topics