Skip to content

Commit 13da6ba

Browse files
committed
adding KDoc for methods with Usage
1 parent a702900 commit 13da6ba

File tree

1 file changed

+89
-30
lines changed

1 file changed

+89
-30
lines changed

auth0/src/main/java/com/auth0/android/myaccount/MyAccountAPIClient.kt

Lines changed: 89 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ public class MyAccountAPIClient @VisibleForTesting(otherwise = VisibleForTesting
426426
* Please reach out to Auth0 support to get it enabled for your tenant.
427427
*
428428
* ## Scopes Required
429-
* `delete:me:authentication-methods:passkey`
429+
* `delete:me:authentication_methods`
430430
*
431431
* ## Usage
432432
*
@@ -521,14 +521,14 @@ public class MyAccountAPIClient @VisibleForTesting(otherwise = VisibleForTesting
521521
* val apiClient = MyAccountAPIClient(auth0, accessToken)
522522
*
523523
* apiClient.enrollPhone("+11234567890", "sms")
524-
* .start(object : Callback<EnrollmentChallenge, MyAccountException> {
525-
* override fun onSuccess(result: EnrollmentChallenge) {
524+
* .start(object : Callback<EnrollmentChallenge, MyAccountException> {
525+
* override fun onSuccess(result: EnrollmentChallenge) {
526526
* // The enrollment has started. 'result.id' contains the ID for verification.
527-
* Log.d("MyApp", "Enrollment started. ID: ${result.id}")
528-
* }
529-
* override fun onFailure(error: MyAccountException) {
530-
* Log.e("MyApp", "Failed with: ${error.message}")
531-
* }
527+
* Log.d("MyApp", "Enrollment started. ID: ${result.id}")
528+
* }
529+
* override fun onFailure(error: MyAccountException) {
530+
* Log.e("MyApp", "Failed with: ${error.message}")
531+
* }
532532
* })
533533
* ```
534534
* @param phoneNumber The phone number to enroll in E.164 format.
@@ -560,14 +560,14 @@ public class MyAccountAPIClient @VisibleForTesting(otherwise = VisibleForTesting
560560
* val apiClient = MyAccountAPIClient(auth0, accessToken)
561561
*
562562
* apiClient.enrollEmail("[email protected]")
563-
* .start(object : Callback<EnrollmentChallenge, MyAccountException> {
564-
* override fun onSuccess(result: EnrollmentChallenge) {
565-
* // The enrollment has started. 'result.id' contains the ID for verification.
566-
* Log.d("MyApp", "Enrollment started. ID: ${result.id}")
567-
* }
568-
* override fun onFailure(error: MyAccountException) {
569-
* Log.e("MyApp", "Failed with: ${error.message}")
570-
* }
563+
* .start(object : Callback<EnrollmentChallenge, MyAccountException> {
564+
* override fun onSuccess(result: EnrollmentChallenge) {
565+
* // The enrollment has started. 'result.id' contains the ID for verification.
566+
* Log.d("MyApp", "Enrollment started. ID: ${result.id}")
567+
* }
568+
* override fun onFailure(error: MyAccountException) {
569+
* Log.e("MyApp", "Failed with: ${error.message}")
570+
* }
571571
* })
572572
* ```
573573
* @param email the email address to enroll.
@@ -602,10 +602,10 @@ public class MyAccountAPIClient @VisibleForTesting(otherwise = VisibleForTesting
602602
* val otp = "123456"
603603
*
604604
* apiClient.verifyOtp(authMethodId, otp, authSession)
605-
* .start(object : Callback<AuthenticationMethod, MyAccountException> {
606-
* override fun onSuccess(result: AuthenticationMethod) { //... }
607-
* override fun onFailure(error: MyAccountException) { //... }
608-
* })
605+
* .start(object : Callback<AuthenticationMethod, MyAccountException> {
606+
* override fun onSuccess(result: AuthenticationMethod) { //... }
607+
* override fun onFailure(error: MyAccountException) { //... }
608+
* })
609609
* ```
610610
* @param authenticationMethodId The ID of the method being verified (from the enrollment challenge).
611611
* @param otpCode The OTP code sent to the user's phone or email, or from their authenticator app.
@@ -618,7 +618,6 @@ public class MyAccountAPIClient @VisibleForTesting(otherwise = VisibleForTesting
618618
.addPathSegment(authenticationMethodId)
619619
.addPathSegment(VERIFY)
620620
.build()
621-
//FIX: Added the required 'auth_session' parameter
622621
val params = mapOf("otp_code" to otpCode, AUTH_SESSION_KEY to authSession)
623622
return factory.post(url.toString(), GsonAdapter(AuthenticationMethod::class.java, gson))
624623
.addParameters(params)
@@ -638,12 +637,12 @@ public class MyAccountAPIClient @VisibleForTesting(otherwise = VisibleForTesting
638637
* val apiClient = MyAccountAPIClient(auth0, accessToken)
639638
*
640639
* apiClient.enrollTotp()
641-
* .start(object : Callback<EnrollmentChallenge, MyAccountException> {
642-
* override fun onSuccess(result: EnrollmentChallenge) {
643-
* // The result will be a TotpEnrollmentChallenge with a barcode_uri
644-
* Log.d("MyApp", "Enrollment started for TOTP.")
645-
* }
646-
* override fun onFailure(error: MyAccountException) { //... }
640+
* .start(object : Callback<EnrollmentChallenge, MyAccountException> {
641+
* override fun onSuccess(result: EnrollmentChallenge) {
642+
* // The result will be a TotpEnrollmentChallenge with a barcode_uri
643+
* Log.d("MyApp", "Enrollment started for TOTP.")
644+
* }
645+
* override fun onFailure(error: MyAccountException) { //... }
647646
* })
648647
* ```
649648
* @return a request that will yield an enrollment challenge.
@@ -662,6 +661,21 @@ public class MyAccountAPIClient @VisibleForTesting(otherwise = VisibleForTesting
662661
* ## Scopes Required
663662
* `create:me:authentication_methods`
664663
*
664+
* ## Usage
665+
*
666+
* ```kotlin
667+
* val auth0 = Auth0.getInstance("YOUR_CLIENT_ID", "YOUR_DOMAIN")
668+
* val apiClient = MyAccountAPIClient(auth0, accessToken)
669+
*
670+
* apiClient.enrollWebAuthnPlatform()
671+
* .start(object : Callback<EnrollmentChallenge, MyAccountException> {
672+
* override fun onSuccess(result: EnrollmentChallenge) {
673+
* // The result will be a PasskeyEnrollmentChallenge for WebAuthn
674+
* Log.d("MyApp", "Enrollment started for WebAuthn Platform.")
675+
* }
676+
* override fun onFailure(error: MyAccountException) { //... }
677+
* })
678+
* ```
665679
* @return a request that will yield an enrollment challenge.
666680
*/
667681
public fun enrollWebAuthnPlatform(): Request<EnrollmentChallenge, MyAccountException> {
@@ -678,6 +692,21 @@ public class MyAccountAPIClient @VisibleForTesting(otherwise = VisibleForTesting
678692
* ## Scopes Required
679693
* `create:me:authentication_methods`
680694
*
695+
* ## Usage
696+
*
697+
* ```kotlin
698+
* val auth0 = Auth0.getInstance("YOUR_CLIENT_ID", "YOUR_DOMAIN")
699+
* val apiClient = MyAccountAPIClient(auth0, accessToken)
700+
*
701+
* apiClient.enrollWebAuthnRoaming()
702+
* .start(object : Callback<EnrollmentChallenge, MyAccountException> {
703+
* override fun onSuccess(result: EnrollmentChallenge) {
704+
* // The result will be a PasskeyEnrollmentChallenge for WebAuthn
705+
* Log.d("MyApp", "Enrollment started for WebAuthn Roaming.")
706+
* }
707+
* override fun onFailure(error: MyAccountException) { //... }
708+
* })
709+
* ```
681710
* @return a request that will yield an enrollment challenge.
682711
*/
683712
public fun enrollWebAuthnRoaming(): Request<EnrollmentChallenge, MyAccountException> {
@@ -694,6 +723,21 @@ public class MyAccountAPIClient @VisibleForTesting(otherwise = VisibleForTesting
694723
* ## Scopes Required
695724
* `create:me:authentication_methods`
696725
*
726+
* ## Usage
727+
*
728+
* ```kotlin
729+
* val auth0 = Auth0.getInstance("YOUR_CLIENT_ID", "YOUR_DOMAIN")
730+
* val apiClient = MyAccountAPIClient(auth0, accessToken)
731+
*
732+
* apiClient.enrollPushNotification()
733+
* .start(object : Callback<EnrollmentChallenge, MyAccountException> {
734+
* override fun onSuccess(result: EnrollmentChallenge) {
735+
* // The result will be a TotpEnrollmentChallenge containing a barcode_uri
736+
* Log.d("MyApp", "Enrollment started for Push Notification.")
737+
* }
738+
* override fun onFailure(error: MyAccountException) { //... }
739+
* })
740+
* ```
697741
* @return a request that will yield an enrollment challenge.
698742
*/
699743
public fun enrollPushNotification(): Request<EnrollmentChallenge, MyAccountException> {
@@ -710,6 +754,21 @@ public class MyAccountAPIClient @VisibleForTesting(otherwise = VisibleForTesting
710754
* ## Scopes Required
711755
* `create:me:authentication_methods`
712756
*
757+
* ## Usage
758+
*
759+
* ```kotlin
760+
* val auth0 = Auth0.getInstance("YOUR_CLIENT_ID", "YOUR_DOMAIN")
761+
* val apiClient = MyAccountAPIClient(auth0, accessToken)
762+
*
763+
* apiClient.enrollRecoveryCode()
764+
* .start(object : Callback<EnrollmentChallenge, MyAccountException> {
765+
* override fun onSuccess(result: EnrollmentChallenge) {
766+
* // The result will be a RecoveryCodeEnrollmentChallenge containing the code
767+
* Log.d("MyApp", "Recovery Code enrollment started.")
768+
* }
769+
* override fun onFailure(error: MyAccountException) { //... }
770+
* })
771+
* ```
713772
* @return a request that will yield an enrollment challenge containing the recovery code.
714773
*/
715774
public fun enrollRecoveryCode(): Request<EnrollmentChallenge, MyAccountException> {
@@ -736,9 +795,9 @@ public class MyAccountAPIClient @VisibleForTesting(otherwise = VisibleForTesting
736795
* val authSession = "from_enrollment_challenge"
737796
*
738797
* apiClient.verify(authMethodId, authSession)
739-
* .start(object : Callback<AuthenticationMethod, MyAccountException> {
740-
* override fun onSuccess(result: AuthenticationMethod) { //... }
741-
* override fun onFailure(error: MyAccountException) { //... }
798+
* .start(object : Callback<AuthenticationMethod, MyAccountException> {
799+
* override fun onSuccess(result: AuthenticationMethod) { //... }
800+
* override fun onFailure(error: MyAccountException) { //... }
742801
* })
743802
* ```
744803
* @param authenticationMethodId The ID of the method being verified (from the enrollment challenge).

0 commit comments

Comments
 (0)