From f02d7c05baa75c7a2f59b59d3b9d47c1432ca2ee Mon Sep 17 00:00:00 2001 From: Lammert Westerhoff Date: Tue, 11 Jan 2022 12:40:43 -0600 Subject: [PATCH] Fix response of the resend confirmation code request --- .../com/liftric/cognito/idp/IdentityProviderClient.kt | 2 +- .../kotlin/com/liftric/cognito/idp/core/IdentityProvider.kt | 4 ++-- .../kotlin/com/liftric/cognito/idp/core/Response.kt | 6 ++++++ 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/commonMain/kotlin/com/liftric/cognito/idp/IdentityProviderClient.kt b/src/commonMain/kotlin/com/liftric/cognito/idp/IdentityProviderClient.kt index e917767..067cdcb 100644 --- a/src/commonMain/kotlin/com/liftric/cognito/idp/IdentityProviderClient.kt +++ b/src/commonMain/kotlin/com/liftric/cognito/idp/IdentityProviderClient.kt @@ -73,7 +73,7 @@ open class IdentityProviderClient(region: String, clientId: String) : IdentityPr override suspend fun resendConfirmationCode( username: String - ): Result = request( + ): Result = request( Request.ResendConfirmationCode, ResendConfirmationCode( ClientId = configuration.clientId, diff --git a/src/commonMain/kotlin/com/liftric/cognito/idp/core/IdentityProvider.kt b/src/commonMain/kotlin/com/liftric/cognito/idp/core/IdentityProvider.kt index 17ba4b8..b7ed08d 100644 --- a/src/commonMain/kotlin/com/liftric/cognito/idp/core/IdentityProvider.kt +++ b/src/commonMain/kotlin/com/liftric/cognito/idp/core/IdentityProvider.kt @@ -21,9 +21,9 @@ interface IdentityProvider { /** * Resends the confirmation (for confirmation of registration) to a specific user in the user pool. * @param username The username - * @return Result object containing CodeDeliveryDetails on success or an error on failure + * @return Result object containing ResendConfirmationCodeResponse on success or an error on failure */ - suspend fun resendConfirmationCode(username: String): Result + suspend fun resendConfirmationCode(username: String): Result /** * Signs in the user with the given parameters diff --git a/src/commonMain/kotlin/com/liftric/cognito/idp/core/Response.kt b/src/commonMain/kotlin/com/liftric/cognito/idp/core/Response.kt index 86f2e43..13803a5 100644 --- a/src/commonMain/kotlin/com/liftric/cognito/idp/core/Response.kt +++ b/src/commonMain/kotlin/com/liftric/cognito/idp/core/Response.kt @@ -34,6 +34,12 @@ data class SignUpResponse( val UserSub: String ) +@Serializable +data class ResendConfirmationCodeResponse( + val CodeDeliveryDetails: CodeDeliveryDetails? = null, +) + +@JsExport @Serializable data class CodeDeliveryDetails( val AttributeName: String,