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
- 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.
// 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
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 | [String: User] | Dictionary of user unique id to user object. |