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
- Create a GetCommentRequest object using
GetCommentRequest.Builder
class by passing all the required parameters. - Call
getComment()
function using the instance ofLMFeedClient
. - 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
VARIABLE | TYPE | DESCRIPTION | OPTIONAL |
---|---|---|---|
postId | String | Post ID of the comment fetched. | |
commentId | String | ID of the comment fetched. | |
page | Int | Page number of paginated replies on comment. | |
pageSize | Int | Page size for paginated creplies on comment. |
GetCommentResponse
VARIABLE | TYPE | DESCRIPTION | OPTIONAL |
---|---|---|---|
comment | Comment | Object of the fetched comment. | |
users | Map<String, User> | Map of user unique id to user object. |