self Register User
Finalizes a user's registration within the Rainbow environment. This method serves as the concluding step following the user registration initiation via selfRegisterByEmail.
Upon obtaining the 6-digit code via email, use this method to complete the registration process.
You must provide one of the following properties to proceed:
SelfRegisterBody.Builder.temporaryToken — The 6-digit code received via email after invoking selfRegisterByEmail.
SelfRegisterBody.Builder.invitationId — The code received when someone invites you to join their network or an IRainbowRoom by email.
SelfRegisterBody.Builder.joinCompanyInvitationId — The code received when a company administrator sends an invitation to the user email address.
SelfRegisterBody.Builder.joinCompanyLinkId — The public link sent by a company administrator to join his company.
SelfRegisterBody.Builder.openInviteId — The public link sent by a Rainbow user to join an IRainbowRoom.
Return
RainbowResult
Parameters
SelfRegisterBody the user information required for registration, including login email and password. Use the [SelfRegisterBody.Builder] to construct this parameter.
Samples
import com.ale.infra.rest.listeners.onFailure
import com.ale.infra.rest.listeners.onSuccess
import com.ale.infra.rest.user.SelfRegisterBody
import com.ale.rainbowsdk.RainbowSdk
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
fun main() {
//sampleStart
val email = "your_email@domain.com"
val password = "Password"
val code = "123456"
CoroutineScope(Dispatchers.Main).launch {
RainbowSdk().user().selfRegisterByEmail(email).onSuccess { data ->
val body = SelfRegisterBody.Builder()
.loginEmail(email)
.password(password)
.temporaryToken(code)
.firstName("FirstName")
.lastName("LastName")
.build()
RainbowSdk().user().selfRegisterUser(body).onSuccess {
// The user is registered and can now connect to the Rainbow environment.
}.onFailure {
// Error handling
}
}.onFailure {
// Error handling
}
}
//sampleEnd
}