Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix response of the resend confirmation code request #43

Merged
merged 3 commits into from
Jan 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ open class IdentityProviderClient(region: String, clientId: String) : IdentityPr

override suspend fun resendConfirmationCode(
username: String
): Result<CodeDeliveryDetails> = request(
): Result<ResendConfirmationCodeResponse> = request(
Request.ResendConfirmationCode,
ResendConfirmationCode(
ClientId = configuration.clientId,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<CodeDeliveryDetails>
suspend fun resendConfirmationCode(username: String): Result<ResendConfirmationCodeResponse>

/**
* Signs in the user with the given parameters
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ data class SignUpResponse(
val UserSub: String
)

@Serializable
data class ResendConfirmationCodeResponse(
val CodeDeliveryDetails: CodeDeliveryDetails
)

@Serializable
data class CodeDeliveryDetails(
val AttributeName: String,
Expand Down
4 changes: 2 additions & 2 deletions src/jsMain/kotlin/IdentityProviderJS.kt
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ class IdentityProviderClientJS(region: String, clientId: String) {
.getOrThrow()
}

fun resendConfirmationCode(username: String): Promise<CodeDeliveryDetailsJS> =
fun resendConfirmationCode(username: String): Promise<ResendConfirmationCodeResponseJS> =
gaebel marked this conversation as resolved.
Show resolved Hide resolved
MainScope().promise {
provider.resendConfirmationCode(username)
.getOrThrow().let { it.toJs() }
.getOrThrow().let { ResendConfirmationCodeResponseJS(it.CodeDeliveryDetails.toJs()) }
}

fun signIn(username: String, password: String): Promise<SignInResponseJS> =
Expand Down
3 changes: 3 additions & 0 deletions src/jsMain/kotlin/ResponseJS.kt
Original file line number Diff line number Diff line change
Expand Up @@ -102,3 +102,6 @@ data class MFAOptionsJS(
val AttributeName: String,
val DeliveryMedium: String
)
data class ResendConfirmationCodeResponseJS(
val CodeDeliveryDetails: CodeDeliveryDetailsJS
)