@@ -299,7 +299,7 @@ public class MyAccountAPIClient @VisibleForTesting(otherwise = VisibleForTesting
299299
300300 val request = factory.get(
301301 url.toString(),
302- GsonAdapter (AuthenticationMethods ::class .java, gson )
302+ GsonAdapter (AuthenticationMethods ::class .java)
303303 )
304304 .addHeader(AUTHORIZATION_KEY , " Bearer $accessToken " )
305305
@@ -348,7 +348,7 @@ public class MyAccountAPIClient @VisibleForTesting(otherwise = VisibleForTesting
348348
349349 val request = factory.get(
350350 url.toString(),
351- GsonAdapter (AuthenticationMethod ::class .java, gson )
351+ GsonAdapter (AuthenticationMethod ::class .java)
352352 )
353353 .addHeader(AUTHORIZATION_KEY , " Bearer $accessToken " )
354354
@@ -391,8 +391,8 @@ public class MyAccountAPIClient @VisibleForTesting(otherwise = VisibleForTesting
391391 */
392392 public fun updateAuthenticationMethodById (
393393 authenticationMethodId : String ,
394- preferredAuthenticationMethod : String ,
395- authenticationMethodName : String
394+ authenticationMethodName : String ,
395+ preferredAuthenticationMethod : String
396396 ): Request <AuthenticationMethod , MyAccountException > {
397397 val url =
398398 getDomainUrlBuilder()
@@ -401,13 +401,13 @@ public class MyAccountAPIClient @VisibleForTesting(otherwise = VisibleForTesting
401401 .build()
402402
403403 val params = ParameterBuilder .newBuilder().apply {
404- set(PREFERRED_AUTHENTICATION_METHOD , preferredAuthenticationMethod)
405404 set(AUTHENTICATION_METHOD_NAME , authenticationMethodName)
405+ set(PREFERRED_AUTHENTICATION_METHOD , preferredAuthenticationMethod)
406406 }.asDictionary()
407407
408408 val request = factory.patch(
409409 url.toString(),
410- GsonAdapter (AuthenticationMethod ::class .java, gson )
410+ GsonAdapter (AuthenticationMethod ::class .java)
411411 )
412412 .addHeader(AUTHORIZATION_KEY , " Bearer $accessToken " )
413413 .addParameters(params)
@@ -466,6 +466,7 @@ public class MyAccountAPIClient @VisibleForTesting(otherwise = VisibleForTesting
466466 }
467467 val request = factory.delete(url.toString(), voidAdapter)
468468 .addHeader(AUTHORIZATION_KEY , " Bearer $accessToken " )
469+
469470 return request
470471 }
471472
@@ -493,18 +494,13 @@ public class MyAccountAPIClient @VisibleForTesting(otherwise = VisibleForTesting
493494 * ```
494495 * @return A request to get the list of available factors.
495496 */
496- public fun getFactors (): Request <List < Factor > , MyAccountException> {
497+ public fun getFactors (): Request <Factors , MyAccountException > {
497498 val url = getDomainUrlBuilder()
498499 .addPathSegment(FACTORS )
499500 .build()
500- val factorListAdapter = object : JsonAdapter <List <Factor >> {
501- override fun fromJson (reader : Reader , metadata : Map <String , Any >): List <Factor > {
502- val listType = object : TypeToken <List <Factor >>() {}.type
503- return gson.fromJson(reader, listType)
504- }
505- }
501+ val adapter = GsonAdapter (Factors ::class .java, gson)
506502
507- return factory.get(url.toString(), factorListAdapter )
503+ return factory.get(url.toString(), adapter )
508504 .addHeader(AUTHORIZATION_KEY , " Bearer $accessToken " )
509505 }
510506
@@ -678,7 +674,7 @@ public class MyAccountAPIClient @VisibleForTesting(otherwise = VisibleForTesting
678674 * ```
679675 * @return a request that will yield an enrollment challenge.
680676 */
681- public fun enrollWebAuthnPlatform (): Request <EnrollmentChallenge , MyAccountException > {
677+ private fun enrollWebAuthnPlatform (): Request <EnrollmentChallenge , MyAccountException > {
682678 val params = ParameterBuilder .newBuilder().set(TYPE_KEY , " webauthn-platform" ).asDictionary()
683679 return factory.post(
684680 getDomainUrlBuilder().addPathSegment(AUTHENTICATION_METHODS ).build().toString(),
@@ -709,7 +705,7 @@ public class MyAccountAPIClient @VisibleForTesting(otherwise = VisibleForTesting
709705 * ```
710706 * @return a request that will yield an enrollment challenge.
711707 */
712- public fun enrollWebAuthnRoaming (): Request <EnrollmentChallenge , MyAccountException > {
708+ private fun enrollWebAuthnRoaming (): Request <EnrollmentChallenge , MyAccountException > {
713709 val params = ParameterBuilder .newBuilder().set(TYPE_KEY , " webauthn-roaming" ).asDictionary()
714710 return factory.post(
715711 getDomainUrlBuilder().addPathSegment(AUTHENTICATION_METHODS ).build().toString(),
@@ -816,7 +812,6 @@ public class MyAccountAPIClient @VisibleForTesting(otherwise = VisibleForTesting
816812 .addHeader(AUTHORIZATION_KEY , " Bearer $accessToken " )
817813 }
818814
819-
820815 private fun getDomainUrlBuilder (): HttpUrl .Builder {
821816 return auth0.getDomainUrl().toHttpUrl().newBuilder()
822817 .addPathSegment(ME_PATH )
0 commit comments