Skip to main content

Fetch User Created Comment

To retrieve comments created by a specific user, you need to fetch them within the system. This process allows you to get all comments associated with a user in the LikeMinds Feed.

Steps to Fetch User Created Comments​

  1. Build a GetUserCommentsRequest object using the GetUserCommentsRequestBuilder class.

  2. Call the getUserComments() function using the instance of the LMFeedClient class.

  3. Use the response as per your requirement.

    // Provide user details for fetching comments
    String uuid = "user_uuid_here";
    int page = 1;
    int pageSize = 20;

    // Build the request object
    GetUserCommentsRequest request = (GetUserCommentsRequestBuilder()
    ..uuid(uuid)
    ..page(page)
    ..pageSize(pageSize))
    .build();

    // Get the response from calling the function
    final GetUserCommentsResponse response = await lmFeedClient.getUserComments(request);

    // Process the response, as per requirement
    if(response.success){
    // your function to process fetched comments
    processFetchedComments(response.comments);
    }else{
    // your function to process error message
    processError(response.errorMessage);
    }
tip

Fetching user-created comments allows you to display all comments made by a user in the LikeMinds community.

Models​

GetUserCommentsRequest​

List of parameters for the GetUserCommentsRequest class

VariableTypeDescriptionOptional
uuidStringUUID of the user
pageintPage number for pagination
pageSizeintNumber of items per page

GetUserCommentsResponse​

List of parameters for the GetUserCommentsResponse class

VariableTypeDescriptionOptional
successboolAPI success status
errorMessageStringError message in case of failure✔
commentsList<Comment>List of comments created by the user✔
usersMap<String, User>Map of user details✔
postsMap<String, Post>Map of post details✔
topicsMap<String, Topic>Map of topic details✔
widgetsMap<String, WidgetModel>Map of widget details✔
userTopicsMap<String, List<String>>Map of user topics✔