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.
Parameters
SelfRegisterBody the user information required for registration, including login email and password. Use the [SelfRegisterBody.Builder]
to construct this parameter.
RainbowListener<IRainbowContact, Unit> (optional) callback invoked upon completion of the operation. Set to null if not required.
Samples
import com.ale.infra.contact.IRainbowContact
import com.ale.infra.rest.listeners.RainbowError
import com.ale.infra.rest.listeners.RainbowListener
import com.ale.infra.rest.user.SelfRegisterBody
import com.ale.rainbowsdk.RainbowSdk
fun main() {
//sampleStart
val email = "your_email@domain.com"
val password = "Password"
val code = "123456"
RainbowSdk().user().selfRegisterByEmail(email, listener = object : RainbowListener<Unit, Unit> {
override fun onSuccess(data: Unit) {
val body = SelfRegisterBody.Builder()
.loginEmail(email)
.password(password)
.temporaryToken(code)
.firstName("FirstName")
.lastName("LastName")
.build()
RainbowSdk().user().selfRegisterUser(body, listener = object : RainbowListener<IRainbowContact, Unit> {
override fun onSuccess(data: IRainbowContact) {
// The user is registered and can now connect to the Rainbow environment.
}
override fun onError(error: RainbowError<Unit>) {
// Error handling
}
})
}
override fun onError(error: RainbowError<Unit>) {
// Error handling
}
})
//sampleEnd
}