Update User Topics
The updateUserTopics()
function is used to update the topics associated with a specific user.
Steps to Update User Topics
- Build an
UpdateUserTopicsRequest
object using theUpdateUserTopicsRequestBuilder
class. - Call the
updateUserTopics()
function using an instance of theLMFeedClient
class. - Use the response to confirm if the topics were updated successfully.
note
The topicsId
field in the request is a Map<String, bool>
. Set the value as true
to add the topic and false
to remove the topic.
// Build the request object
UpdateUserTopicsRequest request = (UpdateUserTopicsRequestBuilder()
..topicsId({"topic_id_1": true, "topic_id_2": false})
..uuid("YOUR_USER_ID"))
.build();
// Get the response from calling the function
final UpdateUserTopicsResponse response =
await lmFeedClient.updateUserTopics(request);
// Process the response, as per your requirement
if (response.success) {
// Handle success scenario
handleUpdateSuccess();
} else {
// Handle error scenario
handleUpdateError(response.errorMessage);
}
Models
UpdateUserTopicsRequest
List of parameters for the UpdateUserTopicsRequest
class
Variable | Type | Description | Optional |
---|---|---|---|
topicsId | Map<String, bool> | Map of topic IDs with boolean values indicating add/remove | |
uuid | String | User ID whose topics are to be updated |
UpdateUserTopicsResponse
List of parameters for the UpdateUserTopicsResponse
class
Variable | Type | Description | Optional |
---|---|---|---|
success | bool | API success status | |
errorMessage | String? | Error message in case of failure | ✔ |
This documentation ensures that you understand how to correctly update user topics using the updateUserTopics
function, providing a clear guide on how to structure requests and handle responses.