Skip to main content

Fetch Comment

The getComment() function serves the purpose of fetching a specific comment along with its associated replies. By utilizing this function, developers can seamlessly retrieve detailed information about a comment and the ensuing conversation.

Steps to Get Comment​

  1. Create an instance of GetCommentRequest with the required parameters: commentId, postId, and page.
  2. Call the getComment() function using the instance of the LMFeedClient class, passing the request as a parameter.
  3. Utilize the response as per your application's requirements.
// Create an instance of GetCommentRequest
GetCommentRequest request = (GetCommentRequestBuilder()
..postId("post_id")
..commentId("comment_id")
..page(1))
.build();

// Get the response from calling the function
final GetCommentResponse commentResponse = await lmFeedClient.getComment(commentRequest);

// Process the response, as per requirement
if (commentResponse.success) {
// your function to handle successful retrieval of the comment and replies
handleGetCommentSuccess(commentResponse.postReplies, commentResponse.users);
} else {
// your function to handle error message
handleGetCommentError(commentResponse.errorMessage);
}

Models​

GetCommentRequest​

List of parameters for the GetCommentRequest class

VariableTypeDescription
commentIdStringComment ID to retrieve
postIdStringPost ID associated with the comment
pageintPage number for pagination

GetCommentResponse​

List of parameters for the GetCommentResponse class

VariableTypeDescriptionOptional
successboolAPI success status
errorMessageStringError message in failure✔
postRepliesCommentComment and replies entity✔
usersMap<String, User>Map of user UUIDs to User entities✔
topicsMap<String, Topic>Map of topic IDs to Topic entities
widgetsMap<String, WidgetModel>Map of widget IDs to WidgetModel entities
userTopicsMap<String, List<String>>Map of user topics (key: user ID)✔