Improve documentation

This commit is contained in:
Benoit Marty 2022-05-05 23:54:00 +02:00 committed by Benoit Marty
parent 6e3979a32d
commit d92875e3c2
2 changed files with 41 additions and 8 deletions

View file

@ -18,13 +18,31 @@ package org.matrix.android.sdk.api.auth.registration
import org.matrix.android.sdk.api.session.Session
// Either a session or an object containing data about registration stages
/**
* Either a session or an object containing data about registration stages
*/
sealed class RegistrationResult {
/**
* The registration is successful, the [Session] is provided
*/
data class Success(val session: Session) : RegistrationResult()
/**
* The registration still miss some steps. See [FlowResult] to know the details
*/
data class FlowResponse(val flowResult: FlowResult) : RegistrationResult()
}
/**
* Information about the missing and completed [Stage]
*/
data class FlowResult(
/**
* List of missing stages
*/
val missingStages: List<Stage>,
/**
* List of completed stages
*/
val completedStages: List<Stage>
)

View file

@ -16,25 +16,40 @@
package org.matrix.android.sdk.api.auth.registration
/**
* Registration stages
*/
sealed class Stage(open val mandatory: Boolean) {
// m.login.recaptcha
/**
* m.login.recaptcha stage
*/
data class ReCaptcha(override val mandatory: Boolean, val publicKey: String) : Stage(mandatory)
// m.login.email.identity
/**
* m.login.email.identity stage
*/
data class Email(override val mandatory: Boolean) : Stage(mandatory)
// m.login.msisdn
/**
* m.login.msisdn stage
*/
data class Msisdn(override val mandatory: Boolean) : Stage(mandatory)
// m.login.dummy, can be mandatory if there is no other stages. In this case the account cannot be created by just sending a username
// and a password, the dummy stage has to be done
/**
* m.login.dummy, can be mandatory if there is no other stages. In this case the account cannot be created by just sending a username
* and a password, the dummy stage has to be done
*/
data class Dummy(override val mandatory: Boolean) : Stage(mandatory)
// Undocumented yet: m.login.terms
/**
* Undocumented yet: m.login.terms stage
*/
data class Terms(override val mandatory: Boolean, val policies: TermPolicies) : Stage(mandatory)
// For unknown stages
/**
* For unknown stages
*/
data class Other(override val mandatory: Boolean, val type: String, val params: Map<*, *>?) : Stage(mandatory)
}