Skip to main content

Fetch Comment

The LikeMinds Android feed SDK provides feature to fetch Comment. Elevate user interaction in your Android app with by integrate a powerful and customizable comment section that encourages dynamic conversations among users.

Steps to fetch a comment

  1. Create a GetCommentRequest object using GetCommentRequest.Builder class by passing all the required parameters.
  2. Call getComment() function using the instance of LMFeedClient.
  3. Process the response (LMResponse<GetCommentResponse>) as per your requirement.
CoroutineScope(Dispatchers.IO).launch {
// object of GetCommentRequest
val getCommentRequest = GetCommentRequest.Builder()
.postId("ENTER POST ID") // post id of the comment fetched
.commentId("ENTER COMMENT ID") // id of the comment fetched
.page(1) // page number for paginated replies on comment
.pageSize(5) // page size for paginated replies on comment
.build()
// get response (LMResponse<GetCommentResponse>)
val response = LMFeedClient.getInstance().getComment(getCommentRequest)
if (response.success) {
// your function to process the response data
processGetCommentResponse(response.data)
} else {
// your function to process error message
processError(response.errorMessage)
}
}
note

Same function can be used to fetch a reply as well. Just pass the id of the reply as comment id.

Models

GetCommentRequest

VARIABLETYPEDESCRIPTIONOPTIONAL
postIdStringPost ID of the comment fetched.
commentIdStringID of the comment fetched.
pageIntPage number of paginated replies on comment.
pageSizeIntPage size for paginated creplies on comment.

GetCommentResponse

VARIABLETYPEDESCRIPTIONOPTIONAL
commentCommentObject of the fetched comment.
usersMap<String, User>Map of user unique id to user object.