User Profile Management
Pre-requisite: The user has to be signed in to perform the following operations.
Get User
To get the user profile information, the following method can be called.
InstaVision.userServices.getUser(
onSuccess = { user ->
// The user object contains the user profile information
},
onError = { error ->
// The error object contains the error code and message
}
)
Update User
To update the user profile information, the following method can be called.
request(required): The user profile update request object.
val updatedUser = UpdateUserRequest(
name = Name("John", "Doe") // The updated name of the user
)
InstaVision.userServices.updateUser(
request = updatedUser,
onSuccess = { user ->
// The user object contains the updated user profile information
},
onError = { error ->
// The error object contains the error code and message
}
)
Request desktop access
To email the signed in user a link for accessing their cameras from a desktop browser, the following method can be used:
InstaVision.userServices.sendEmailForDesktopAccess(
onSuccess = { response ->
// response.email is the address the link was sent to (nullable)
// response.resendEmailSeconds is how long to wait before allowing another request
},
onError = { error ->
// The error object contains the error code and message
}
)
Use resendEmailSeconds to disable the resend button until the cooldown has elapsed.