Skip to main content

Fetch Comment

The LikeMinds iOS feed SDK provides feature to fetch Comment. Elevate user interaction in your iOS 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.
// object of GetCommentRequest
let request = GetCommentRequest.builder()
.postId(ENTER_POST_ID) // post id of the comment fetched
.commentId(ENTER_COMMENT_ID) // id of the comment to be replies fetched
.page(1) // page number for paginated comment
.pageSize(5) // page size for paginated comments
.build()
LMFeedClient.shared.getComment(request) { response in
// response (LMResponse<GetCommentResponse>)
if (response.success) {
// your function to process the response data
processResponse(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.
users[String: User]Dictionary of user unique id to user object.