diff --git a/common.go b/common.go index b1c2bae..1a7859b 100644 --- a/common.go +++ b/common.go @@ -16,7 +16,7 @@ const ( // AuthTokenResponseFragment defines graphql response for auth token type, // which is common across various authorizer operations -var AuthTokenResponseFragment = fmt.Sprintf(`message access_token expires_in refresh_token id_token should_show_otp_screen user { %s }`, UserFragment) +var AuthTokenResponseFragment = fmt.Sprintf(`message access_token expires_in refresh_token id_token should_show_email_otp_screen should_show_mobile_otp_screen user { %s }`, UserFragment) // User defines attributes for user instance type User struct { @@ -43,13 +43,14 @@ type User struct { // AuthTokenResponse defines attribute for auth token response, // which is common across various authorizer operations type AuthTokenResponse struct { - Message *string `json:"message,omitempty"` - AccessToken *string `json:"access_token,omitempty"` - ExpiresIn *int64 `json:"expires_in,omitempty"` - IdToken *string `json:"id_token,omitempty"` - RefreshToken *string `json:"refresh_token,omitempty"` - OtpSent *bool `json:"should_show_otp_screen"` - User *User `json:"user,omitempty"` + Message *string `json:"message,omitempty"` + AccessToken *string `json:"access_token,omitempty"` + ExpiresIn *int64 `json:"expires_in,omitempty"` + IdToken *string `json:"id_token,omitempty"` + RefreshToken *string `json:"refresh_token,omitempty"` + ShouldShowEmailOtpScreen *bool `json:"should_show_email_otp_screen"` + ShouldShowMobileOtpScreen *bool `json:"should_show_mobile_otp_screen"` + User *User `json:"user,omitempty"` } // Response defines attribute for Response graphql type diff --git a/examples/resend_otp.go b/examples/resend_otp.go index 808bda5..b5cd765 100644 --- a/examples/resend_otp.go +++ b/examples/resend_otp.go @@ -12,9 +12,9 @@ func ResendOTPExample() { if err != nil { panic(err) } - + email := "test@yopmail.com" res, err := c.ResendOTP(&authorizer.ResendOTPInput{ - Email: "test@yopmail.com", + Email: &email, }) if err != nil { panic(err) diff --git a/examples/verify_otp.go b/examples/verify_otp.go index ed37f5e..17c2e2e 100644 --- a/examples/verify_otp.go +++ b/examples/verify_otp.go @@ -12,10 +12,10 @@ func VerifyOTPExample() { if err != nil { panic(err) } - + email := "test@yopmail.com" res, err := c.VerifyOTP(&authorizer.VerifyOTPInput{ OTP: "test", - Email: "test@yopmail.com", + Email: &email, }) if err != nil { panic(err) diff --git a/resend_otp.go b/resend_otp.go index 26def75..ff2d133 100644 --- a/resend_otp.go +++ b/resend_otp.go @@ -6,7 +6,8 @@ import ( // ResendOTPInput defines attributes for resend_otp request type ResendOTPInput struct { - Email string `json:"email"` + Email *string `json:"email"` + PhoneNumber *string `json:"phone_number"` } // ResendOTP is method attached to AuthorizerClient. diff --git a/verify_otp.go b/verify_otp.go index bc7a0a3..72f4e1b 100644 --- a/verify_otp.go +++ b/verify_otp.go @@ -7,8 +7,9 @@ import ( // VerifyOTPInput defines attributes for verify_otp request type VerifyOTPInput struct { - Email string `json:"email"` - OTP string `json:"otp"` + Email *string `json:"email"` + OTP string `json:"otp"` + PhoneNumber *string `json:"phone_number"` } // VerifyOTP is method attached to AuthorizerClient.