Initiate User
To start using the LikeMinds Feed and enable personalized experiences for your users, you need to initiate them within the system. This process associates a user in your application with a user in the LikeMinds Feed, allowing for seamless integration and personalized recommendations.
Steps to initiate User
- Create a InitiateUserRequest object using
InitiateUserRequest.Builder
class by passing all the required parameters. - Call
initiateUser()
function using the instance ofLMFeedClient
. - Process the response (LMResponse<InitiateUserResponse>) as per your requirement.
CoroutineScope(Dispatchers.IO).launch {
// object of InitiateUserRequest
val initiateUserRequest = InitiateUserRequest.Builder()
.apiKey("ENTER API KEY") // api key of the community
.deviceId("ENTER DEVICE ID") // unique id of the device
.uuid("ENTER UUID") // client side user unique Id
.userName("ENTER USER NAME") // name of the user
.isGuest(false) // user is a guest or not
.build()
// get response (LMResponse<InitiateUserResponse>)
val response = LMFeedClient.getInstance().initiateUser(initiateUserRequest)
if (response.success) {
// your function to process the response data
processInitiateUserResponse(response.data)
} else {
// your function to process error message
processError(response.errorMessage)
}
}
Models
InitiateUserRequest
VARIABLE | TYPE | DESCRIPTION | OPTIONAL |
---|---|---|---|
apiKey | String | Api key of the community. | |
deviceId | String | Unique id of the device. | |
userName | String | Name of the user. | |
uuid | String | Client side user unique id. | ✔ |
isGuest | Boolean | true if user is a guest, false otherwise. | ✔ |
InitiateUserResponse
VARIABLE | TYPE | DESCRIPTION | OPTIONAL |
---|---|---|---|
accessToken | String | Access token of the user. | ✔ |
refreshToken | String | Refresh token of the user. | ✔ |
user | User | Object of the user initiated. | ✔ |
community | Community | Object of the community. | ✔ |
appAccess | Boolean | Object of the user initiated. | ✔ |
logoutResponse | LMResponse<Nothing> | Logout response in case the user doesn't have the access. | ✔ |
Community
VARIABLE | TYPE | DESCRIPTION | OPTIONAL |
---|---|---|---|
id | String | ID of the community. | |
name | String | Name of the community. | |
imageUrl | String | Profile image url of the community. | ✔ |
membersCount | Int | Number of users in the community. | ✔ |
updatedAt | Long | Timestamp when the community was last updated. | ✔ |