Skip to content

Commit

Permalink
feat: Add user object to update and authenticate responses (#72)
Browse files Browse the repository at this point in the history
  • Loading branch information
max-stytch authored May 20, 2022
1 parent 4cbfdf6 commit ae16762
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion stytch/config/config.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package config

const APIVersion = "5.4.2"
const APIVersion = "5.5.0"

type BaseURI string

Expand Down
1 change: 1 addition & 0 deletions stytch/cryptowallet.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,5 @@ type CryptoWalletAuthenticateResponse struct {
SessionToken string `json:"session_token,omitempty"`
SessionJWT string `json:"session_jwt,omitempty"`
Session Session `json:"session,omitempty"`
User User `jspon:"user,omitempty"`
}
1 change: 1 addition & 0 deletions stytch/magiclink.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ type MagicLinksAuthenticateResponse struct {
SessionToken string `json:"session_token,omitempty"`
SessionJWT string `json:"session_jwt,omitempty"`
Session Session `json:"session,omitempty"`
User User `jspon:"user,omitempty"`
}

// MAGIC LINK - EMAIL
Expand Down
1 change: 1 addition & 0 deletions stytch/otp.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ type OTPsAuthenticateResponse struct {
SessionToken string `json:"session_token,omitempty"`
Session Session `json:"session,omitempty"`
SessionJWT string `json:"session_jwt,omitempty"`
User User `jspon:"user,omitempty"`
}

// OTP - SMS
Expand Down
1 change: 1 addition & 0 deletions stytch/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ type SessionsAuthenticateResponse struct {
Session Session `json:"session,omitempty"`
SessionToken string `json:"session_token,omitempty"`
SessionJWT string `json:"session_jwt,omitempty"`
User User `jspon:"user,omitempty"`
}

type SessionsRevokeParams struct {
Expand Down
2 changes: 2 additions & 0 deletions stytch/totp.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ type TOTPsAuthenticateResponse struct {
SessionToken string `json:"session_token,omitempty"`
SessionJWT string `json:"session_jwt,omitempty"`
Session Session `json:"session,omitempty"`
User User `jspon:"user,omitempty"`
}

type TOTPsRecoveryCodesParams struct {
Expand Down Expand Up @@ -65,4 +66,5 @@ type TOTPsRecoverResponse struct {
SessionToken string `json:"session_token,omitempty"`
SessionJWT string `json:"session_jwt,omitempty"`
Session Session `json:"session,omitempty"`
User User `jspon:"user,omitempty"`
}
7 changes: 7 additions & 0 deletions stytch/user.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ type UsersCreateResponse struct {
EmailID string `json:"email_id,omitempty"`
PhoneID string `json:"phone_id,omitempty"`
Status string `json:"status,omitempty"`
User User `jspon:"user,omitempty"`
}

type UsersGetResponse struct {
Expand Down Expand Up @@ -110,6 +111,7 @@ type UsersUpdateResponse struct {
Emails []Email `json:"emails,omitempty"`
PhoneNumbers []PhoneNumber `json:"phone_numbers,omitempty"`
CryptoWallets []CryptoWallet `json:"crypto_wallets,omitempty"`
User User `jspon:"user,omitempty"`
}

type UsersDeleteResponse struct {
Expand All @@ -122,30 +124,35 @@ type UsersDeleteEmailResponse struct {
RequestID string `json:"request_id,omitempty"`
StatusCode int `json:"status_code,omitempty"`
UserID string `json:"user_id,omitempty"`
User User `jspon:"user,omitempty"`
}

type UsersDeletePhoneNumberResponse struct {
RequestID string `json:"request_id,omitempty"`
StatusCode int `json:"status_code,omitempty"`
UserID string `json:"user_id,omitempty"`
User User `jspon:"user,omitempty"`
}

type UsersDeleteWebAuthnRegistrationResponse struct {
RequestID string `json:"request_id,omitempty"`
StatusCode int `json:"status_code,omitempty"`
UserID string `json:"user_id,omitempty"`
User User `jspon:"user,omitempty"`
}

type UsersDeleteTOTPResponse struct {
RequestID string `json:"request_id,omitempty"`
StatusCode int `json:"status_code,omitempty"`
UserID string `json:"user_id,omitempty"`
User User `jspon:"user,omitempty"`
}

type UsersDeleteCryptoWalletResponse struct {
RequestID string `json:"request_id,omitempty"`
StatusCode int `json:"status_code,omitempty"`
UserID string `json:"user_id,omitempty"`
User User `jspon:"user,omitempty"`
}

/* User Search */
Expand Down
1 change: 1 addition & 0 deletions stytch/webauthn.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,5 @@ type WebAuthnAuthenticateResponse struct {
SessionToken string `json:"session_token,omitempty"`
SessionJWT string `json:"session_jwt,omitempty"`
Session Session `json:"session,omitempty"`
User User `jspon:"user,omitempty"`
}

2 comments on commit ae16762

@josharian
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a typo throughout this commit: jspon:"user,omitempty" instead of json:"user,omitempty". It still works as anticipated, because the field name matches the json name. But probably still worth fixing. :)

@josharian
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, and omitempty has no effect on struct fields. See e.g. golang/go#51261 and issues linked from there. Again, it doesn't do any harm in this case, but figured I should mention it.

Please sign in to comment.