Skip to main content

Get User Topics

The getUserTopics() function is used to fetch a list of topics which a user have followed.

Steps to Get Topics

  1. Build a GetUserTopicsRequest object using the GetUserTopicsRequestBuilder class.
  2. Call the getUserTopics() function using the instance of the LMFeedClient class.
  3. Use the response as per your requirement.
note

isEnabled key is nullable, if you want to fetch enabled topics send isEnabled = true. For disabled topics send isEnabled = false and to fetch all the existing topics send send isEnabled = null

 // Build the request object
GetUserTopicsRequest request = (GetUserTopicsRequestBuilder()
..uuids(["YOUR_USER_ID"])
)
.build();

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

// Process the response, as per requirement
if(response.success){
// your function to handle successful retrieval of topics
handleTopics(response.topics);
}else{
// your function to handle error message
handleTopicsError(response.errorMessage);
}

Models

GetUserTopicsRequest

List of parameters for the GetTopicsRequest class

VariableTypeDescriptionOptional
uuidsList<String>List of user id who's followed topic to be fetched

GetUserTopicsResponse

List of parameters for the GetUserTopicsResponse class

VariableTypeDescriptionOptional
successboolAPI success status
errorMessageString?Error message in case of failure
userTopicsMap<String, List<String>>?Map of user IDs to their associated topics
topicsMap<String, Topic>?Map of topic IDs to Topic entities
usersMap<String, User>?Map of user IDs to User entities
widgetsMap<String, WidgetModel>?Map of widget IDs to WidgetModel entities