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
- Create an instance of
EditPendingPostRequest
with the required parameters:postId
and other editable fields. - Call the
editPendingPost()
function using the instance of theLMFeedClient
class, passing the request as a parameter. - 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
Variable | Type | Description | Optional |
---|---|---|---|
postId | String | Unique identifier of the post | |
postText | String | Updated text content | |
heading | String | Updated heading | ✔ |
attachments | List<Attachment> | List of attachments | ✔ |
topicIds | List<String> | List of topic IDs | ✔ |
isRepost | bool | Indicates if it is a repost | ✔ |
EditPendingPostResponse
List of parameters for the EditPendingPostResponse
class
Variable | Type | Description | Optional |
---|---|---|---|
post | Post | The edited pending post entity | |
user | Map<String, User> | Map of users | |
topics | Map<String, Topic> | Map of topics | |
widgets | Map<String, WidgetModel> | Map of widgets | |
repostedPosts | Map<String, Post> | Map of reposted posts | |
userTopics | Map<String, List<String>> | Map of user topics | ✔ |